From: Eduard Zingerman <eddyz87@gmail.com>
To: Alexei Starovoitov <alexei.starovoitov@gmail.com>,
Song Liu <song@kernel.org>, "Jose E. Marchesi" <jemarch@gnu.org>,
"Jose E. Marchesi" <jose.marchesi@oracle.com>
Cc: bpf <bpf@vger.kernel.org>,
Linux-Fsdevel <linux-fsdevel@vger.kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
LSM List <linux-security-module@vger.kernel.org>,
Kernel Team <kernel-team@meta.com>,
Andrii Nakryiko <andrii@kernel.org>,
Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Martin KaFai Lau <martin.lau@linux.dev>,
Alexander Viro <viro@zeniv.linux.org.uk>,
Christian Brauner <brauner@kernel.org>, Jan Kara <jack@suse.cz>,
KP Singh <kpsingh@kernel.org>,
Matt Bobrowski <mattbobrowski@google.com>,
Amir Goldstein <amir73il@gmail.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Tejun Heo <tj@kernel.org>,
Daan De Meyer <daan.j.demeyer@gmail.com>
Subject: Re: [PATCH v2 bpf-next 4/5] selftests/bpf: Add tests for bpf_cgroup_read_xattr
Date: Fri, 20 Jun 2025 11:36:40 -0700 [thread overview]
Message-ID: <de68f43f9e83230bbb055fdecba564ee662d6091.camel@gmail.com> (raw)
In-Reply-To: <CAADnVQKKQ8G91EudWVpw5TZ6zg3DTaKx9nVBUj1EdLu=7K+ByQ@mail.gmail.com>
On Fri, 2025-06-20 at 11:11 -0700, Alexei Starovoitov wrote:
> On Thu, Jun 19, 2025 at 3:02 PM Song Liu <song@kernel.org> wrote:
> > + bpf_dynptr_from_mem(xattr_value, sizeof(xattr_value), 0, &value_ptr);
>
> https://github.com/kernel-patches/bpf/actions/runs/15767046528/job/44445539248
>
> progs/cgroup_read_xattr.c:19:9: error: ‘bpf_dynptr_from_mem’ is static
> but used in inline function ‘read_xattr’ which is not static [-Werror]
> 19 | bpf_dynptr_from_mem(value, sizeof(value), 0, &value_ptr);
> > ^~~~~~~~~~~~~~~~~~~
>
>
> Jose,
>
> Could you please help us understand this gcc-bpf error ?
> What does it mean?
Not Jose, but was curious.
Some googling lead to the following C99 wording [1]:
> An inline definition of a function with external linkage shall not
> contain a definition of a modifiable object with static storage
> duration, and shall not contain a reference to an identifier with
> internal linkage
[1] https://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf
6.7.4 Function specifiers, paragraph 3
The helper is defined as `static`:
static long (* const bpf_dynptr_from_mem)(...) = (void *) 197;
While `read_xattr` has external linkage:
__always_inline void read_xattr(struct cgroup *cgroup)
{
...
bpf_dynptr_from_mem(value, sizeof(value), 0, &value_ptr);
...
}
I think that declaring `read_xattr` as `static` should help with gcc.
next prev parent reply other threads:[~2025-06-20 18:36 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-19 22:01 [PATCH v2 bpf-next 0/5] Introduce bpf_cgroup_read_xattr Song Liu
2025-06-19 22:01 ` [PATCH v2 bpf-next 1/5] kernfs: remove iattr_mutex Song Liu
2025-06-19 22:01 ` [PATCH v2 bpf-next 2/5] bpf: Introduce bpf_cgroup_read_xattr to read xattr of cgroup's node Song Liu
2025-06-21 2:44 ` Tejun Heo
2025-06-21 3:50 ` Song Liu
2025-06-19 22:01 ` [PATCH v2 bpf-next 3/5] bpf: Mark cgroup_subsys_state->cgroup RCU safe Song Liu
2025-06-21 2:45 ` Tejun Heo
2025-06-19 22:01 ` [PATCH v2 bpf-next 4/5] selftests/bpf: Add tests for bpf_cgroup_read_xattr Song Liu
2025-06-20 18:11 ` Alexei Starovoitov
2025-06-20 18:36 ` Eduard Zingerman [this message]
2025-06-20 19:09 ` Jose E. Marchesi
2025-06-19 22:01 ` [PATCH v2 bpf-next 5/5] bpf: Make bpf_cgroup_read_xattr available to cgroup and struct_ops progs Song Liu
2025-06-20 18:18 ` Alexei Starovoitov
2025-06-20 20:48 ` Song Liu
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=de68f43f9e83230bbb055fdecba564ee662d6091.camel@gmail.com \
--to=eddyz87@gmail.com \
--cc=alexei.starovoitov@gmail.com \
--cc=amir73il@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=brauner@kernel.org \
--cc=daan.j.demeyer@gmail.com \
--cc=daniel@iogearbox.net \
--cc=gregkh@linuxfoundation.org \
--cc=jack@suse.cz \
--cc=jemarch@gnu.org \
--cc=jose.marchesi@oracle.com \
--cc=kernel-team@meta.com \
--cc=kpsingh@kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=martin.lau@linux.dev \
--cc=mattbobrowski@google.com \
--cc=song@kernel.org \
--cc=tj@kernel.org \
--cc=viro@zeniv.linux.org.uk \
/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).