From: Cupertino Miranda <cupertino.miranda@oracle.com>
To: Eduard Zingerman <eddyz87@gmail.com>, bpf@vger.kernel.org
Cc: David Faust <david.faust@oracle.com>,
Jose Marchesi <jose.marchesi@oracle.com>,
Elena Zannoni <elena.zannoni@oracle.com>
Subject: Re: [PATCH 2/2] selftests/bpf: tests to non_null ptr detection using register operand in JEQ/JNE
Date: Tue, 3 Mar 2026 18:38:56 +0000 [thread overview]
Message-ID: <f45fd58a-5945-48fc-be4c-975c63e28141@oracle.com> (raw)
In-Reply-To: <f68ad995294f3223d6bf3eef0176193b52ae54f9.camel@gmail.com>
Hi Edward,
Thanks for the quick feedback.
Will prepare a v2, soon.
Cheers,
Cupertino
On 03-03-2026 6:12 PM, Eduard Zingerman wrote:
> On Mon, 2026-03-02 at 16:17 +0000, Cupertino Miranda wrote:
>> The 5 added tests are copies of the already existing tests in the same
>> file, but changed to use R3 instead of an immediate 0.
>>
>> Signed-off-by: Cupertino Miranda <cupertino.miranda@oracle.com>
>> Cc: David Faust <david.faust@oracle.com>
>> Cc: Jose Marchesi <jose.marchesi@oracle.com>
>> Cc: Elena Zannoni <elena.zannoni@oracle.com>
>> ---
>
> I think this is an overkill, these tests check nullness propagation
> over id chains etc. For the purpose of this change something like
> below should suffice:
>
> +SEC("xdp")
> +__success __log_level(2)
> +/* to make sure the branch is not falsely predicted*/
> +__msg("r0 = *(u32 *)(r0 +0)")
> +__msg("from 7 to 9")
> +__naked void jeq_reg_reg_null_check(void)
> +{
> + asm volatile (" \
> + *(u32*)(r10 - 8) = 0; \
> + r1 = %[map_xskmap] ll; \
> + r2 = r10; \
> + r2 += -8; \
> + call %[bpf_map_lookup_elem]; \
> + r1 = 0; \
> + if r0 == r1 goto 1f; \
> + r0 = *(u32*)(r0 +0); \
> +1: r0 = 0; \
> + exit; \
> +" :
> + : __imm(bpf_map_lookup_elem),
> + __imm_addr(map_xskmap)
> + : __clobber_all);
> +}
>
> And maybe a variant of this with `if r1 != r0` or maybe not.
>
> [...]
prev parent reply other threads:[~2026-03-03 18:39 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-02 16:17 [PATCH 0/2] bpf: support for non_null ptr detection with JEQ/JNE with register operand Cupertino Miranda
2026-03-02 16:17 ` [PATCH 1/2] bpf: detect non null pointer with register operand in JEQ/JNE Cupertino Miranda
2026-03-02 16:58 ` bot+bpf-ci
2026-03-03 17:51 ` Eduard Zingerman
2026-03-02 16:17 ` [PATCH 2/2] selftests/bpf: tests to non_null ptr detection using " Cupertino Miranda
2026-03-03 18:12 ` Eduard Zingerman
2026-03-03 18:38 ` Cupertino Miranda [this message]
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=f45fd58a-5945-48fc-be4c-975c63e28141@oracle.com \
--to=cupertino.miranda@oracle.com \
--cc=bpf@vger.kernel.org \
--cc=david.faust@oracle.com \
--cc=eddyz87@gmail.com \
--cc=elena.zannoni@oracle.com \
--cc=jose.marchesi@oracle.com \
/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