bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Puranjay Mohan <puranjay@kernel.org>
To: Eduard Zingerman <eddyz87@gmail.com>,
	Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Andrii Nakryiko <andrii@kernel.org>,
	Martin KaFai Lau <martin.lau@linux.dev>,
	Song Liu <song@kernel.org>,
	Yonghong Song <yonghong.song@linux.dev>,
	John Fastabend <john.fastabend@gmail.com>,
	KP Singh <kpsingh@kernel.org>,
	Stanislav Fomichev <sdf@fomichev.me>, Hao Luo <haoluo@google.com>,
	Jiri Olsa <jolsa@kernel.org>,
	Xu Kuohai <xukuohai@huaweicloud.com>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will@kernel.org>,
	Kumar Kartikeya Dwivedi <memxor@gmail.com>,
	bpf@vger.kernel.org
Subject: Re: [PATCH bpf-next v5 4/4] selftests/bpf: Add tests for arena fault reporting
Date: Fri, 05 Sep 2025 14:00:19 +0000	[thread overview]
Message-ID: <mb61ptt1hq9sc.fsf@kernel.org> (raw)
In-Reply-To: <3105c65cd99c483ecb4eb63d590fcec9601891bd.camel@gmail.com>

Eduard Zingerman <eddyz87@gmail.com> writes:

> On Mon, 2025-09-01 at 19:37 +0000, Puranjay Mohan wrote:
>
> [...]
>
>> diff --git a/tools/testing/selftests/bpf/prog_tests/stream.c b/tools/testing/selftests/bpf/prog_tests/stream.c
>> index 9d0e5d93edee7..b2a85364e3c4f 100644
>> --- a/tools/testing/selftests/bpf/prog_tests/stream.c
>> +++ b/tools/testing/selftests/bpf/prog_tests/stream.c
>> @@ -41,6 +41,22 @@ struct {
>>  		"([a-zA-Z_][a-zA-Z0-9_]*\\+0x[0-9a-fA-F]+/0x[0-9a-fA-F]+\n"
>>  		"|[ \t]+[^\n]+\n)*",
>>  	},
>> +	{
>> +		offsetof(struct stream, progs.stream_arena_read_fault),
>> +		"ERROR: Arena READ access at unmapped address 0x.*\n"
>> +		"CPU: [0-9]+ UID: 0 PID: [0-9]+ Comm: .*\n"
>> +		"Call trace:\n"
>> +		"([a-zA-Z_][a-zA-Z0-9_]*\\+0x[0-9a-fA-F]+/0x[0-9a-fA-F]+\n"
>> +		"|[ \t]+[^\n]+\n)*",
>> +	},
>> +	{
>> +		offsetof(struct stream, progs.stream_arena_write_fault),
>> +		"ERROR: Arena WRITE access at unmapped address 0x.*\n"
>> +		"CPU: [0-9]+ UID: 0 PID: [0-9]+ Comm: .*\n"
>> +		"Call trace:\n"
>> +		"([a-zA-Z_][a-zA-Z0-9_]*\\+0x[0-9a-fA-F]+/0x[0-9a-fA-F]+\n"
>> +		"|[ \t]+[^\n]+\n)*",
>> +	},
>
> I commented when prog_tests/stream.c was first introduced but it was
> decided to postpone the change back then.
> It would be nice to have the above expressed in terms similar to
> bpf_misc.h:__msg() macro. E.g. name it __bpf_{stdout,stderr} and
> have something like this in the progs/stream.c:
>
>   SEC("syscall")
>   __success __retval(0)
>   __bpf_stderr("ERROR: Arena WRITE access at unmapped address 0x{{.*}}")

I would prefer naming them __stderr and __stdout

>   __bpf_stderr("CPU: {{[0-9]+}} UID: 0 PID: {{[0-9]+}} Comm: {{.*}}")
>   ...
>   int stream_arena_write_fault(void *ctx)
>   {
> 	...
>   }
>
> Now that more tests are added, what do you think about such extension?

I tried implementing this and it looks nice, so I think we
should have it.
Will add it with the next version.

Thanks,
Puranjay

  reply	other threads:[~2025-09-05 14:00 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-01 19:37 [PATCH bpf-next v5 0/4] bpf: report arena faults to BPF streams Puranjay Mohan
2025-09-01 19:37 ` [PATCH bpf-next v5 1/4] bpf: arm64: simplify exception table handling Puranjay Mohan
2025-09-01 19:37 ` [PATCH bpf-next v5 2/4] bpf: core: introduce main_prog_aux for stream access Puranjay Mohan
2025-09-02  2:25   ` Alexei Starovoitov
2025-09-02  2:32     ` Kumar Kartikeya Dwivedi
2025-09-01 19:37 ` [PATCH bpf-next v5 3/4] bpf: Report arena faults to BPF stderr Puranjay Mohan
2025-09-02 12:42   ` kernel test robot
2025-09-03  0:01   ` Eduard Zingerman
2025-09-01 19:37 ` [PATCH bpf-next v5 4/4] selftests/bpf: Add tests for arena fault reporting Puranjay Mohan
2025-09-02 16:22   ` Yonghong Song
2025-09-02 22:21   ` Eduard Zingerman
2025-09-05 14:00     ` Puranjay Mohan [this message]
2025-09-05 18:38       ` Eduard Zingerman

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=mb61ptt1hq9sc.fsf@kernel.org \
    --to=puranjay@kernel.org \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=daniel@iogearbox.net \
    --cc=eddyz87@gmail.com \
    --cc=haoluo@google.com \
    --cc=john.fastabend@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=kpsingh@kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=memxor@gmail.com \
    --cc=sdf@fomichev.me \
    --cc=song@kernel.org \
    --cc=will@kernel.org \
    --cc=xukuohai@huaweicloud.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;
as well as URLs for NNTP newsgroup(s).