BPF List
 help / color / mirror / Atom feed
From: Cupertino Miranda <cupertino.miranda@oracle.com>
To: Eduard Zingerman <eddyz87@gmail.com>
Cc: bpf@vger.kernel.org, jose.marchesi@oracle.com,
	david.faust@oracle.com, Yonghong Song <yonghong.song@linux.dev>,
	Andrii Nakryiko <andrii.nakryiko@gmail.com>
Subject: Re: [PATCH bpf-next v3 2/2] selftests/bpf: Match tests against regular expres
Date: Wed, 12 Jun 2024 11:35:09 +0100	[thread overview]
Message-ID: <87y17a5u02.fsf@oracle.com> (raw)
In-Reply-To: <b22c50a1f73bdb88b728a1e5c1e3af143e8c92d5.camel@gmail.com>


Eduard Zingerman writes:

> On Tue, 2024-06-11 at 18:40 +0100, Cupertino Miranda wrote:
>> This patch changes a few tests to make use of reg
>> would otherwise fail when compiled with GCC.
>>
>> Signed-off-by: Cupertino Miranda <cupertino.miranda@oracle.com>
>> Cc: jose.marchesi@oracle.com
>> Cc: david.faust@oracle.com
>> Cc: Yonghong Song <yonghong.song@linux.dev>
>> Cc: Eduard Zingerman <eddyz87@gmail.com>
>> Cc: Andrii Nakryiko <andrii.nakryiko@gmail.com>
>> ---
>
> Looks good, but I think that changes for 'off' for three cases below
> are not necessary.
>
> [...]
>
>> diff --git a/tools/testing/selftests/bpf/progs/rbtree_fail.c b/tools/testing/selftests/bpf/progs/rbtree_fail.c
>> index 3fecf1c6dfe5..8399304eca72 100644
>> --- a/tools/testing/selftests/bpf/progs/rbtree_fail.c
>> +++ b/tools/testing/selftests/bpf/progs/rbtree_fail.c
>> @@ -29,7 +29,7 @@ static bool less(struct bpf_rb_node *a, const struct bpf_rb_node *b)
>>  }
>>
>>  SEC("?tc")
>> -__failure __msg("bpf_spin_lock at off=16 must be held for bpf_rb_root")
>> +__failure __regex("bpf_spin_lock at off=[0-9]+ must be held for bpf_rb_root")
>
> This error message is reported in a single place in
> verifier.c:__process_kf_arg_ptr_to_graph_root():
>
> 	if (check_reg_allocation_locked(env, reg)) {
> 		verbose(env, "bpf_spin_lock at off=%d must be held for %s\n",
> 			rec->spin_lock_off, head_type_name);
> 		return -EINVAL;
> 	}
>
> Where `rec` is a description of the BTF type, `off` is an offset
> inside the structure, why do you need to change it to regex?
>
In GCC the off value would print something else.
Judging by the message I deduced that off was refering to an instruction
location and so, tight to the compiler.
Now I see the value is rather tight to BTF content.

I will remove the offset patching from the series and later on evaluate
what is happening in GCC for the result difference.

>
>>  long rbtree_api_nolock_add(void *ctx)
>>  {
>>  	struct node_data *n;
>> @@ -43,7 +43,7 @@ long rbtree_api_nolock_add(void *ctx)
>>  }
>>
>>  SEC("?tc")
>> -__failure __msg("bpf_spin_lock at off=16 must be held for bpf_rb_root")
>> +__failure __regex("bpf_spin_lock at off=[0-9]+ must be held for bpf_rb_root")
>>  long rbtree_api_nolock_remove(void *ctx)
>>  {
>>  	struct node_data *n;
>> @@ -61,7 +61,7 @@ long rbtree_api_nolock_remove(void *ctx)
>>  }
>>
>>  SEC("?tc")
>> -__failure __msg("bpf_spin_lock at off=16 must be held for bpf_rb_root")
>> +__failure __regex("bpf_spin_lock at off=[0-9]+ must be held for bpf_rb_root")
>>  long rbtree_api_nolock_first(void *ctx)
>>  {
>>  	bpf_rbtree_first(&groot);
>
> [...]

      reply	other threads:[~2024-06-12 10:35 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-11 17:40 [PATCH bpf-next v3 0/2] Regular expression support for test output matching Cupertino Miranda
2024-06-11 17:40 ` [PATCH bpf-next v3 1/2] selftests/bpf: Support checks against a regular expression Cupertino Miranda
2024-06-11 18:29   ` Eduard Zingerman
2024-06-11 17:40 ` [PATCH bpf-next v3 2/2] selftests/bpf: Match tests against regular expres Cupertino Miranda
2024-06-11 18:39   ` Eduard Zingerman
2024-06-12 10:35     ` 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=87y17a5u02.fsf@oracle.com \
    --to=cupertino.miranda@oracle.com \
    --cc=andrii.nakryiko@gmail.com \
    --cc=bpf@vger.kernel.org \
    --cc=david.faust@oracle.com \
    --cc=eddyz87@gmail.com \
    --cc=jose.marchesi@oracle.com \
    --cc=yonghong.song@linux.dev \
    /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