bpf/tests: Fix error in tail call limit tests
authorJohan Almbladh <johan.almbladh@anyfinetworks.com>
Tue, 14 Sep 2021 09:18:41 +0000 (11:18 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 18 Nov 2021 18:16:26 +0000 (19:16 +0100)
commite1ddaa5dcef63c8083cb2e3a8a4ea14a7fd04bc2
treeef1ffe29627280d2d68110aebc4a2955927ce534
parent739b92765e0463cbb612d8e0efe3ac0fab70cafb
bpf/tests: Fix error in tail call limit tests

[ Upstream commit 18935a72eb25525b655262579e1652362a3b29bb ]

This patch fixes an error in the tail call limit test that caused the
test to fail on for x86-64 JIT. Previously, the register R0 was used to
report the total number of tail calls made. However, after a tail call
fall-through, the value of the R0 register is undefined. Now, all tail
call error path tests instead use context state to store the count.

Fixes: 874be05f525e ("bpf, tests: Add tail call test suite")
Reported-by: Paul Chaignon <paul@cilium.io>
Reported-by: Tiezhu Yang <yangtiezhu@loongson.cn>
Signed-off-by: Johan Almbladh <johan.almbladh@anyfinetworks.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Tested-by: Tiezhu Yang <yangtiezhu@loongson.cn>
Link: https://lore.kernel.org/bpf/20210914091842.4186267-14-johan.almbladh@anyfinetworks.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
lib/test_bpf.c