From: "Alexei Starovoitov" <alexei.starovoitov@gmail.com>
To: <bot+bpf-ci@kernel.org>, <leon.hwang@linux.dev>, <bpf@vger.kernel.org>
Cc: <ast@kernel.org>, <daniel@iogearbox.net>,
<john.fastabend@gmail.com>, <andrii@kernel.org>,
<martin.lau@linux.dev>, <eddyz87@gmail.com>, <song@kernel.org>,
<yonghong.song@linux.dev>, <kpsingh@kernel.org>,
<sdf@fomichev.me>, <haoluo@google.com>, <jolsa@kernel.org>,
<shuah@kernel.org>, <brauner@kernel.org>, <sforshee@kernel.org>,
<yuichtsu@amazon.com>, <aalbersh@redhat.com>,
<willemb@google.com>, <kerneljasonxing@gmail.com>,
<chen.dylane@linux.dev>, <yatsenko@meta.com>, <memxor@gmail.com>,
<a.s.protopopov@gmail.com>, <ameryhung@gmail.com>,
<rongtao@cestc.cn>, <linux-kernel@vger.kernel.org>,
<linux-api@vger.kernel.org>, <linux-kselftest@vger.kernel.org>,
<kernel-patches-bot@fb.com>, <martin.lau@kernel.org>,
<clm@meta.com>, <ihor.solodrai@linux.dev>
Subject: Re: [PATCH bpf-next v13 1/8] bpf: Extend BPF syscall with common attributes support
Date: Mon, 11 May 2026 09:53:17 -0700 [thread overview]
Message-ID: <DIG05KI4QZ2H.3JE4OWSK6KC29@gmail.com> (raw)
In-Reply-To: <810f123d14450d09d147d90dea25ddf5091e636542fcc5729d0594bfbd622757@mail.kernel.org>
On Mon May 11, 2026 at 9:19 AM PDT, bot+bpf-ci wrote:
>> diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
>> index f5639d5ac331..50055ab73649 100644
>> --- a/include/linux/syscalls.h
>> +++ b/include/linux/syscalls.h
>> @@ -936,7 +936,8 @@ asmlinkage long sys_seccomp(unsigned int op, unsigned int flags,
>> asmlinkage long sys_getrandom(char __user *buf, size_t count,
>> unsigned int flags);
>> asmlinkage long sys_memfd_create(const char __user *uname_ptr, unsigned int flags);
>> -asmlinkage long sys_bpf(int cmd, union bpf_attr __user *attr, unsigned int size);
>> +asmlinkage long sys_bpf(int cmd, union bpf_attr __user *attr, unsigned int size,
>> + struct bpf_common_attr __user *attr_common, unsigned int size_common);
>> asmlinkage long sys_execveat(int dfd, const char __user *filename,
>> const char __user *const __user *argv,
>> const char __user *const __user *envp, int flags);
>
> [ ... ]
>
>> diff --git a/tools/include/uapi/linux/bpf.h b/tools/include/uapi/linux/bpf.h
>> index 677be9a47347..16ff0968fc21 100644
>> --- a/tools/include/uapi/linux/bpf.h
>> +++ b/tools/include/uapi/linux/bpf.h
>> @@ -994,6 +994,7 @@ enum bpf_cmd {
>> BPF_PROG_STREAM_READ_BY_FD,
>> BPF_PROG_ASSOC_STRUCT_OPS,
>> __MAX_BPF_CMD,
>> + BPF_COMMON_ATTRS = 1 << 16, /* Indicate carrying syscall common attrs. */
>> };
>
> [ ... ]
>
>> @@ -1500,6 +1501,13 @@ struct bpf_stack_build_id {
>> };
>> };
>>
>> +struct bpf_common_attr {
>> + __u64 log_buf;
>> + __u32 log_size;
>> + __u32 log_level;
>> + __u32 log_true_size;
>> +};
>> +
>
> Should log_buf use __aligned_u64 instead of plain __u64?
>
> Looking at other pointer-bearing fields in the BPF UAPI, they consistently
> use __aligned_u64. For example, the existing BPF_PROG_LOAD log_buf in union
> bpf_attr is declared as:
>
> __aligned_u64 log_buf; /* user supplied buffer */
>
> The __aligned_u64 attribute forces 8-byte alignment on all architectures,
> including 32-bit systems where native unsigned long long alignment is only
> 4 bytes. Without this attribute, struct bpf_common_attr will have different
> layouts between 32-bit and 64-bit ABIs:
>
> - 32-bit: 20 bytes, 4-byte aligned
> - 64-bit: 24 bytes (4 bytes of tail padding), 8-byte aligned
>
> While the current __sys_bpf() implementation with bpf_check_uarg_tail_zero()
> and min_t() capped copying handles this gracefully, deviating from the
> established BPF UAPI convention could create problems for future extensions.
> If another __u64 field is added later, the inter-field offsets would diverge
> between ABIs.
>
> Would it be better to use __aligned_u64 log_buf to match union bpf_attr and
> preserve identical struct layouts across 32/64-bit ABIs?
bot has a point.
pw-bot: cr
next prev parent reply other threads:[~2026-05-11 16:53 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-11 15:28 [PATCH bpf-next v13 0/8] bpf: Extend BPF syscall with common attributes support Leon Hwang
2026-05-11 15:28 ` [PATCH bpf-next v13 1/8] " Leon Hwang
2026-05-11 16:19 ` bot+bpf-ci
2026-05-11 16:53 ` Alexei Starovoitov [this message]
2026-05-12 2:41 ` Leon Hwang
2026-05-11 15:28 ` [PATCH bpf-next v13 2/8] libbpf: Add support for extended BPF syscall Leon Hwang
2026-05-11 15:28 ` [PATCH bpf-next v13 3/8] bpf: Refactor reporting log_true_size for prog_load Leon Hwang
2026-05-11 15:28 ` [PATCH bpf-next v13 4/8] bpf: Add syscall common attributes support " Leon Hwang
2026-05-11 15:28 ` [PATCH bpf-next v13 5/8] bpf: Add syscall common attributes support for btf_load Leon Hwang
2026-05-11 15:28 ` [PATCH bpf-next v13 6/8] bpf: Add syscall common attributes support for map_create Leon Hwang
2026-05-11 16:19 ` bot+bpf-ci
2026-05-11 17:07 ` Alexei Starovoitov
2026-05-12 2:47 ` Leon Hwang
2026-05-11 15:28 ` [PATCH bpf-next v13 7/8] libbpf: " Leon Hwang
2026-05-11 15:28 ` [PATCH bpf-next v13 8/8] selftests/bpf: Add tests to verify map create failure log Leon Hwang
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=DIG05KI4QZ2H.3JE4OWSK6KC29@gmail.com \
--to=alexei.starovoitov@gmail.com \
--cc=a.s.protopopov@gmail.com \
--cc=aalbersh@redhat.com \
--cc=ameryhung@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bot+bpf-ci@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=brauner@kernel.org \
--cc=chen.dylane@linux.dev \
--cc=clm@meta.com \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=haoluo@google.com \
--cc=ihor.solodrai@linux.dev \
--cc=john.fastabend@gmail.com \
--cc=jolsa@kernel.org \
--cc=kernel-patches-bot@fb.com \
--cc=kerneljasonxing@gmail.com \
--cc=kpsingh@kernel.org \
--cc=leon.hwang@linux.dev \
--cc=linux-api@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=martin.lau@kernel.org \
--cc=martin.lau@linux.dev \
--cc=memxor@gmail.com \
--cc=rongtao@cestc.cn \
--cc=sdf@fomichev.me \
--cc=sforshee@kernel.org \
--cc=shuah@kernel.org \
--cc=song@kernel.org \
--cc=willemb@google.com \
--cc=yatsenko@meta.com \
--cc=yonghong.song@linux.dev \
--cc=yuichtsu@amazon.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