Linux Kernel Selftest development
 help / color / mirror / Atom feed
From: Hari Bathini <hbathini@linux.ibm.com>
To: Ilya Leoshkevich <iii@linux.ibm.com>, bpf@vger.kernel.org
Cc: Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Andrii Nakryiko <andrii@kernel.org>,
	linux-kselftest@vger.kernel.org, Shuah Khan <shuah@kernel.org>
Subject: Re: [PATCH] selftests/bpf: test accounting of tail calls when prog is NULL
Date: Fri, 20 Feb 2026 12:04:39 +0530	[thread overview]
Message-ID: <83243860-4c05-4a16-aeb2-7cc07fa1252e@linux.ibm.com> (raw)
In-Reply-To: <4085b3b0-3f3f-4d4c-8b10-78d144ed0883@linux.ibm.com>



On 17/02/26 6:23 pm, Ilya Leoshkevich wrote:
> 
> On 2/16/26 10:08, Hari Bathini wrote:
>> Test whether tail call count is incorrectly accounted for, when the
>> tail call fails due to a missing BPF program.
>>
>> Signed-off-by: Hari Bathini <hbathini@linux.ibm.com>
>> ---
>>
>> - powerpc64 BPF JIT has been incorrectly accounting for tailcall count
>>    even when BPF program to tailcall into is missing. A simple change
>>    to one of the tailcall selftests could have flagged it earlier.
>>
>>      https://lore.kernel.org/all/20260216065639.1750181-2- 
>> hbathini@linux.ibm.com/
>>
>>   tools/testing/selftests/bpf/progs/tailcall3.c | 5 ++++-
>>   1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/tools/testing/selftests/bpf/progs/tailcall3.c b/tools/ 
>> testing/selftests/bpf/progs/tailcall3.c
>> index f60bcd7b8d4b..204f19c30a3e 100644
>> --- a/tools/testing/selftests/bpf/progs/tailcall3.c
>> +++ b/tools/testing/selftests/bpf/progs/tailcall3.c
>> @@ -5,7 +5,7 @@
>>   struct {
>>       __uint(type, BPF_MAP_TYPE_PROG_ARRAY);
>> -    __uint(max_entries, 1);
>> +    __uint(max_entries, 2);
>>       __uint(key_size, sizeof(__u32));
>>       __uint(value_size, sizeof(__u32));
>>   } jmp_table SEC(".maps");
>> @@ -23,6 +23,9 @@ int classifier_0(struct __sk_buff *skb)
>>   SEC("tc")
>>   int entry(struct __sk_buff *skb)
>>   {
>> +    /* prog == NULL case */
>> +    bpf_tail_call_static(skb, &jmp_table, 1);
>> +
>>       bpf_tail_call_static(skb, &jmp_table, 0);
>>       return 0;
>>   }
> 
> Seems like the x86_64 JIT passes this already, but the interpreter still 
> has:
> 
>          if (unlikely(tail_call_cnt >= MAX_TAIL_CALL_CNT))
>              goto out;
> 
>          tail_call_cnt++;
> 
>          prog = READ_ONCE(array->ptrs[index]);
>          if (!prog)
>              goto out;
> 
> Should it be changed too? Regardless:

Yeah, I guess. Posted 
https://lore.kernel.org/bpf/20260220062959.195101-1-hbathini@linux.ibm.com/

> 
> Reviewed-by: Ilya Leoshkevich <iii@linux.ibm.com>

Thanks, Ilya.

- Hari

  reply	other threads:[~2026-02-20  6:34 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-16  9:08 [PATCH] selftests/bpf: test accounting of tail calls when prog is NULL Hari Bathini
2026-02-16 11:08 ` Venkat
2026-02-16 11:11   ` Hari Bathini
2026-02-16 15:01     ` Venkat Rao Bagalkote
2026-02-21  3:48       ` Venkat Rao Bagalkote
2026-02-17 12:53 ` Ilya Leoshkevich
2026-02-20  6:34   ` Hari Bathini [this message]
2026-02-25  1:20 ` patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83243860-4c05-4a16-aeb2-7cc07fa1252e@linux.ibm.com \
    --to=hbathini@linux.ibm.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=iii@linux.ibm.com \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=shuah@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox