From: bot+bpf-ci@kernel.org
To: tasos.papagiannnis@gmail.com,bpf@vger.kernel.org
Cc: linux-fsdevel@vger.kernel.org,linux-kernel@vger.kernel.org,linux-mm@kvack.org,david@kernel.org,akpm@linux-foundation.org,andrii@kernel.org,ast@kernel.org,brauner@kernel.org,daniel@iogearbox.net,eddyz87@gmail.com,kpsingh@kernel.org,ljs@kernel.org,matt@bobrowski.net,memxor@gmail.com,song@kernel.org,sun.jian.kdev@gmail.com,utilityemal77@gmail.com,viro@zeniv.linux.org.uk,tasos.papagiannnis@gmail.com,ast@kernel.org,andrii@kernel.org,daniel@iogearbox.net,martin.lau@kernel.org,eddyz87@gmail.com,yonghong.song@linux.dev,mason@kernel.org,ihor.solodrai@linux.dev
Subject: Re: [PATCH bpf-next v7 5/5] selftests/bpf: Test mm_struct user memory kfuncs with linux_binprm
Date: Tue, 15 Sep 2026 09:01:49 +0000 (UTC) [thread overview]
Message-ID: <9e4c6c05feaa894234b5941f694c04db8da58169ab1165ff1a6579ce63dff8f2@mail.kernel.org> (raw)
In-Reply-To: <20260915080255.48929-6-tasos.papagiannnis@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 2538 bytes --]
> diff --git a/tools/testing/selftests/bpf/progs/copy_from_user_bprm.c b/tools/testing/selftests/bpf/progs/copy_from_user_bprm.c
> new file mode 100644
> index 0000000000000..07ca96d9db45f
> --- /dev/null
> +++ b/tools/testing/selftests/bpf/progs/copy_from_user_bprm.c
> @@ -0,0 +1,122 @@
[ ... ]
> +static const char expected_arg0[] = "first";
> +static const char expected_arg1[] = "second-argument";
> +static const char expected_env0[] = "SOME_ENV=a";
> +static const char expected_env1[] = "OTHER_ENV=something";
[ ... ]
> + char arg0[32] = {};
> + char arg1[32] = {};
> + char env0[32] = {};
> + char env1[32] = {};
> + u64 offset = 0;
[ ... ]
> + /* arg0 is at bprm->p */
> + str_arg0_ret = bpf_copy_from_user_mm_str(arg0, sizeof(arg0),
> + (void *)(bprm->p + offset),
> + mm, BPF_F_PAD_ZEROS);
> + if (str_arg0_ret != sizeof(expected_arg0))
> + return 0;
> + offset += str_arg0_ret;
> +
> + /* arg1 is at bprm->p + sizeof(arg0) */
> + str_arg1_ret = bpf_copy_from_user_mm_str(arg1, sizeof(arg1),
> + (void *)(bprm->p + offset),
> + mm, BPF_F_PAD_ZEROS);
Do the offset comments describe the right quantities? Looking at the
buffer declarations, arg0 is a 32-byte array (char arg0[32]) while
expected_arg0 is a 6-byte string ("first"). The comment says arg1 is at
bprm->p + sizeof(arg0), which would be +32, but the code advances offset
by str_arg0_ret, which is sizeof(expected_arg0) = 6:
offset += str_arg0_ret; /* str_arg0_ret is 6, not 32 */
The same pattern continues for the env0 and env1 comments - they name the
destination buffers (32 bytes each) rather than the expected strings (11
and 20 bytes). Should these reference the expected_* arrays instead?
> + if (str_arg1_ret != sizeof(expected_arg1))
> + return 0;
> + offset += str_arg1_ret;
> +
> + /* env0 is at bprm->p + sizeof(arg0) + sizeof(arg1) */
> + str_env0_ret = bpf_copy_from_user_mm_str(env0, sizeof(env0),
> + (void *)(bprm->p + offset),
> + mm, BPF_F_PAD_ZEROS);
> + if (str_env0_ret != sizeof(expected_env0))
> + return 0;
> + offset += str_env0_ret;
> +
> + /* env1 is at bprm->p + sizeof(arg0) + sizeof(arg1) + sizeof(env0) */
> + str_env1_ret = bpf_copy_from_user_mm_str(env1, sizeof(env1),
> + (void *)(bprm->p + offset),
> + mm, BPF_F_PAD_ZEROS);
---
AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md
CI run summary: https://github.com/kernel-patches/bpf/actions/runs/34946192265
next prev parent reply other threads:[~2026-09-15 9:01 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-15 8:02 [PATCH bpf-next v7 0/5] bpf: Add user memory access kfuncs for mm_struct Anastasios Papagiannis
2026-09-15 8:02 ` [PATCH bpf-next v7 1/5] mm: Add copy_remote_mm_str() Anastasios Papagiannis
2026-09-15 9:01 ` bot+bpf-ci
2026-09-17 22:08 ` Andrii Nakryiko
2026-09-18 9:13 ` Anastasios Papagiannis
2026-09-18 12:04 ` David Hildenbrand (Arm)
2026-09-15 8:02 ` [PATCH bpf-next v7 2/5] exec: Clear bprm->mm before dropping its reference Anastasios Papagiannis
2026-09-17 22:09 ` Andrii Nakryiko
2026-09-15 8:02 ` [PATCH bpf-next v7 3/5] bpf: Add user memory access kfuncs for mm_struct Anastasios Papagiannis
2026-09-18 1:04 ` Matt Bobrowski
2026-09-15 8:02 ` [PATCH bpf-next v7 4/5] bpf: Mark linux_binprm->mm as trusted-or-null Anastasios Papagiannis
2026-09-15 8:02 ` [PATCH bpf-next v7 5/5] selftests/bpf: Test mm_struct user memory kfuncs with linux_binprm Anastasios Papagiannis
2026-09-15 9:01 ` bot+bpf-ci [this message]
2026-09-17 22:14 ` Andrii Nakryiko
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=9e4c6c05feaa894234b5941f694c04db8da58169ab1165ff1a6579ce63dff8f2@mail.kernel.org \
--to=bot+bpf-ci@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=brauner@kernel.org \
--cc=daniel@iogearbox.net \
--cc=david@kernel.org \
--cc=eddyz87@gmail.com \
--cc=ihor.solodrai@linux.dev \
--cc=kpsingh@kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=ljs@kernel.org \
--cc=martin.lau@kernel.org \
--cc=mason@kernel.org \
--cc=matt@bobrowski.net \
--cc=memxor@gmail.com \
--cc=song@kernel.org \
--cc=sun.jian.kdev@gmail.com \
--cc=tasos.papagiannnis@gmail.com \
--cc=utilityemal77@gmail.com \
--cc=viro@zeniv.linux.org.uk \
--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
all inboxes | Powered by JetHome®