* [PATCH bpf-next] bpf: Define bpf_token_show_fdinfo with CONFIG_PROC_FS
@ 2025-03-17 15:51 Tao Chen
2025-03-17 18:01 ` Song Liu
0 siblings, 1 reply; 7+ messages in thread
From: Tao Chen @ 2025-03-17 15:51 UTC (permalink / raw)
To: ast, daniel, andrii, martin.lau, eddyz87, song, yonghong.song,
john.fastabend, kpsingh, sdf, haoluo, jolsa, brauner
Cc: bpf, linux-kernel, Tao Chen
Protect bpf_token_show_fdinfo with CONFIG_PROC_FS check, otherwise
it will compile error if CONFIG_PROC_FS is not set.
Fixes: 35f96de04127 ("bpf: Introduce BPF token object")
Signed-off-by: Tao Chen <chen.dylane@linux.dev>
---
kernel/bpf/token.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/kernel/bpf/token.c b/kernel/bpf/token.c
index 26057aa13..4396eefde 100644
--- a/kernel/bpf/token.c
+++ b/kernel/bpf/token.c
@@ -105,7 +105,9 @@ static const struct inode_operations bpf_token_iops = { };
static const struct file_operations bpf_token_fops = {
.release = bpf_token_release,
+#ifdef CONFIG_PROC_FS
.show_fdinfo = bpf_token_show_fdinfo,
+#endif
};
int bpf_token_create(union bpf_attr *attr)
--
2.43.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH bpf-next] bpf: Define bpf_token_show_fdinfo with CONFIG_PROC_FS
2025-03-17 15:51 Tao Chen
@ 2025-03-17 18:01 ` Song Liu
2025-03-18 5:00 ` Tao Chen
0 siblings, 1 reply; 7+ messages in thread
From: Song Liu @ 2025-03-17 18:01 UTC (permalink / raw)
To: Tao Chen
Cc: ast, daniel, andrii, martin.lau, eddyz87, yonghong.song,
john.fastabend, kpsingh, sdf, haoluo, jolsa, brauner, bpf,
linux-kernel
On Mon, Mar 17, 2025 at 8:52 AM Tao Chen <chen.dylane@linux.dev> wrote:
>
> Protect bpf_token_show_fdinfo with CONFIG_PROC_FS check, otherwise
> it will compile error if CONFIG_PROC_FS is not set.
On bpt-next/master, I don't see compile error with
CONFIG_BPF_SYSCALL=y
...
# CONFIG_PROC_FS is not set
Are you testing with a different tree/branch?
Thanks,
Song
>
> Fixes: 35f96de04127 ("bpf: Introduce BPF token object")
> Signed-off-by: Tao Chen <chen.dylane@linux.dev>
> ---
> kernel/bpf/token.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/kernel/bpf/token.c b/kernel/bpf/token.c
> index 26057aa13..4396eefde 100644
> --- a/kernel/bpf/token.c
> +++ b/kernel/bpf/token.c
> @@ -105,7 +105,9 @@ static const struct inode_operations bpf_token_iops = { };
>
> static const struct file_operations bpf_token_fops = {
> .release = bpf_token_release,
> +#ifdef CONFIG_PROC_FS
> .show_fdinfo = bpf_token_show_fdinfo,
> +#endif
> };
>
> int bpf_token_create(union bpf_attr *attr)
> --
> 2.43.0
>
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH bpf-next] bpf: Define bpf_token_show_fdinfo with CONFIG_PROC_FS
2025-03-17 18:01 ` Song Liu
@ 2025-03-18 5:00 ` Tao Chen
0 siblings, 0 replies; 7+ messages in thread
From: Tao Chen @ 2025-03-18 5:00 UTC (permalink / raw)
To: Song Liu
Cc: ast, daniel, andrii, martin.lau, eddyz87, yonghong.song,
john.fastabend, kpsingh, sdf, haoluo, jolsa, brauner, bpf,
linux-kernel
在 2025/3/18 02:01, Song Liu 写道:
> On Mon, Mar 17, 2025 at 8:52 AM Tao Chen <chen.dylane@linux.dev> wrote:
>>
>> Protect bpf_token_show_fdinfo with CONFIG_PROC_FS check, otherwise
>> it will compile error if CONFIG_PROC_FS is not set.
>
> On bpt-next/master, I don't see compile error with
>
> CONFIG_BPF_SYSCALL=y
> ...
> # CONFIG_PROC_FS is not set
>
> Are you testing with a different tree/branch?
>
> Thanks,
> Song
>
>>
>> Fixes: 35f96de04127 ("bpf: Introduce BPF token object")
>> Signed-off-by: Tao Chen <chen.dylane@linux.dev>
>> ---
>> kernel/bpf/token.c | 2 ++
>> 1 file changed, 2 insertions(+)
>>
>> diff --git a/kernel/bpf/token.c b/kernel/bpf/token.c
>> index 26057aa13..4396eefde 100644
>> --- a/kernel/bpf/token.c
>> +++ b/kernel/bpf/token.c
>> @@ -105,7 +105,9 @@ static const struct inode_operations bpf_token_iops = { };
>>
>> static const struct file_operations bpf_token_fops = {
>> .release = bpf_token_release,
>> +#ifdef CONFIG_PROC_FS
>> .show_fdinfo = bpf_token_show_fdinfo,
>> +#endif
>> };
>>
>> int bpf_token_create(union bpf_attr *attr)
>> --
>> 2.43.0
>>
>>
Hi Song,
I try it, it seems that i had some misunderstandings before about
CONFIG_PROC_FS, and the description in the changelog is not quite
correct. Please ignore this patch, and i will resend it. Just to follow
the pattern used with other *_show_fdinfo functions and only define
bpf_token_show_fdinfo when CONFIG_PROC_FS is set. Thank you for your
reminder.
--
Best Regards
Tao Chen
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH bpf-next] bpf: Define bpf_token_show_fdinfo with CONFIG_PROC_FS
@ 2025-03-18 6:25 Tao Chen
2025-03-18 9:28 ` Jiri Olsa
0 siblings, 1 reply; 7+ messages in thread
From: Tao Chen @ 2025-03-18 6:25 UTC (permalink / raw)
To: ast, daniel, andrii, martin.lau, eddyz87, song, yonghong.song,
john.fastabend, kpsingh, sdf, haoluo, jolsa, brauner
Cc: bpf, linux-kernel, Tao Chen
Protect bpf_token_show_fdinfo with CONFIG_PROC_FS check, follow the
pattern used with other *_show_fdinfo functions.
Fixes: 35f96de04127 ("bpf: Introduce BPF token object")
Signed-off-by: Tao Chen <chen.dylane@linux.dev>
---
kernel/bpf/token.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/kernel/bpf/token.c b/kernel/bpf/token.c
index 26057aa13..104ca37e9 100644
--- a/kernel/bpf/token.c
+++ b/kernel/bpf/token.c
@@ -65,6 +65,7 @@ static int bpf_token_release(struct inode *inode, struct file *filp)
return 0;
}
+#ifdef CONFIG_PROC_FS
static void bpf_token_show_fdinfo(struct seq_file *m, struct file *filp)
{
struct bpf_token *token = filp->private_data;
@@ -98,6 +99,7 @@ static void bpf_token_show_fdinfo(struct seq_file *m, struct file *filp)
else
seq_printf(m, "allowed_attachs:\t0x%llx\n", token->allowed_attachs);
}
+#endif
#define BPF_TOKEN_INODE_NAME "bpf-token"
@@ -105,7 +107,9 @@ static const struct inode_operations bpf_token_iops = { };
static const struct file_operations bpf_token_fops = {
.release = bpf_token_release,
+#ifdef CONFIG_PROC_FS
.show_fdinfo = bpf_token_show_fdinfo,
+#endif
};
int bpf_token_create(union bpf_attr *attr)
--
2.43.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH bpf-next] bpf: Define bpf_token_show_fdinfo with CONFIG_PROC_FS
2025-03-18 6:25 [PATCH bpf-next] bpf: Define bpf_token_show_fdinfo with CONFIG_PROC_FS Tao Chen
@ 2025-03-18 9:28 ` Jiri Olsa
2025-03-18 14:59 ` Alexei Starovoitov
0 siblings, 1 reply; 7+ messages in thread
From: Jiri Olsa @ 2025-03-18 9:28 UTC (permalink / raw)
To: Tao Chen
Cc: ast, daniel, andrii, martin.lau, eddyz87, song, yonghong.song,
john.fastabend, kpsingh, sdf, haoluo, brauner, bpf, linux-kernel
On Tue, Mar 18, 2025 at 02:25:57PM +0800, Tao Chen wrote:
> Protect bpf_token_show_fdinfo with CONFIG_PROC_FS check, follow the
> pattern used with other *_show_fdinfo functions.
>
> Fixes: 35f96de04127 ("bpf: Introduce BPF token object")
> Signed-off-by: Tao Chen <chen.dylane@linux.dev>
> ---
> kernel/bpf/token.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/kernel/bpf/token.c b/kernel/bpf/token.c
> index 26057aa13..104ca37e9 100644
> --- a/kernel/bpf/token.c
> +++ b/kernel/bpf/token.c
> @@ -65,6 +65,7 @@ static int bpf_token_release(struct inode *inode, struct file *filp)
> return 0;
> }
>
> +#ifdef CONFIG_PROC_FS
> static void bpf_token_show_fdinfo(struct seq_file *m, struct file *filp)
> {
> struct bpf_token *token = filp->private_data;
> @@ -98,6 +99,7 @@ static void bpf_token_show_fdinfo(struct seq_file *m, struct file *filp)
> else
> seq_printf(m, "allowed_attachs:\t0x%llx\n", token->allowed_attachs);
> }
> +#endif
>
> #define BPF_TOKEN_INODE_NAME "bpf-token"
>
> @@ -105,7 +107,9 @@ static const struct inode_operations bpf_token_iops = { };
>
> static const struct file_operations bpf_token_fops = {
> .release = bpf_token_release,
> +#ifdef CONFIG_PROC_FS
> .show_fdinfo = bpf_token_show_fdinfo,
> +#endif
there's many more of such cases.. I'm not sure if it makes sense to fix that,
because it does not break the build and only save space for !CONFIG_PROC_FS
kernels
jirka
> };
>
> int bpf_token_create(union bpf_attr *attr)
> --
> 2.43.0
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH bpf-next] bpf: Define bpf_token_show_fdinfo with CONFIG_PROC_FS
2025-03-18 9:28 ` Jiri Olsa
@ 2025-03-18 14:59 ` Alexei Starovoitov
2025-03-18 15:20 ` Tao Chen
0 siblings, 1 reply; 7+ messages in thread
From: Alexei Starovoitov @ 2025-03-18 14:59 UTC (permalink / raw)
To: Jiri Olsa
Cc: Tao Chen, Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
Martin KaFai Lau, Eddy Z, Song Liu, Yonghong Song, John Fastabend,
KP Singh, Stanislav Fomichev, Hao Luo, Christian Brauner, bpf,
LKML
On Tue, Mar 18, 2025 at 2:29 AM Jiri Olsa <olsajiri@gmail.com> wrote:
>
> On Tue, Mar 18, 2025 at 02:25:57PM +0800, Tao Chen wrote:
> > Protect bpf_token_show_fdinfo with CONFIG_PROC_FS check, follow the
> > pattern used with other *_show_fdinfo functions.
> >
> > Fixes: 35f96de04127 ("bpf: Introduce BPF token object")
> > Signed-off-by: Tao Chen <chen.dylane@linux.dev>
> > ---
> > kernel/bpf/token.c | 4 ++++
> > 1 file changed, 4 insertions(+)
> >
> > diff --git a/kernel/bpf/token.c b/kernel/bpf/token.c
> > index 26057aa13..104ca37e9 100644
> > --- a/kernel/bpf/token.c
> > +++ b/kernel/bpf/token.c
> > @@ -65,6 +65,7 @@ static int bpf_token_release(struct inode *inode, struct file *filp)
> > return 0;
> > }
> >
> > +#ifdef CONFIG_PROC_FS
> > static void bpf_token_show_fdinfo(struct seq_file *m, struct file *filp)
> > {
> > struct bpf_token *token = filp->private_data;
> > @@ -98,6 +99,7 @@ static void bpf_token_show_fdinfo(struct seq_file *m, struct file *filp)
> > else
> > seq_printf(m, "allowed_attachs:\t0x%llx\n", token->allowed_attachs);
> > }
> > +#endif
> >
> > #define BPF_TOKEN_INODE_NAME "bpf-token"
> >
> > @@ -105,7 +107,9 @@ static const struct inode_operations bpf_token_iops = { };
> >
> > static const struct file_operations bpf_token_fops = {
> > .release = bpf_token_release,
> > +#ifdef CONFIG_PROC_FS
> > .show_fdinfo = bpf_token_show_fdinfo,
> > +#endif
>
> there's many more of such cases.. I'm not sure if it makes sense to fix that,
> because it does not break the build and only save space for !CONFIG_PROC_FS
> kernels
+1.
let's keep the code as-is.
pw-bot: cr
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH bpf-next] bpf: Define bpf_token_show_fdinfo with CONFIG_PROC_FS
2025-03-18 14:59 ` Alexei Starovoitov
@ 2025-03-18 15:20 ` Tao Chen
0 siblings, 0 replies; 7+ messages in thread
From: Tao Chen @ 2025-03-18 15:20 UTC (permalink / raw)
To: Alexei Starovoitov, Jiri Olsa
Cc: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
Martin KaFai Lau, Eddy Z, Song Liu, Yonghong Song, John Fastabend,
KP Singh, Stanislav Fomichev, Hao Luo, Christian Brauner, bpf,
LKML
在 2025/3/18 22:59, Alexei Starovoitov 写道:
> On Tue, Mar 18, 2025 at 2:29 AM Jiri Olsa <olsajiri@gmail.com> wrote:
>>
>> On Tue, Mar 18, 2025 at 02:25:57PM +0800, Tao Chen wrote:
>>> Protect bpf_token_show_fdinfo with CONFIG_PROC_FS check, follow the
>>> pattern used with other *_show_fdinfo functions.
>>>
>>> Fixes: 35f96de04127 ("bpf: Introduce BPF token object")
>>> Signed-off-by: Tao Chen <chen.dylane@linux.dev>
>>> ---
>>> kernel/bpf/token.c | 4 ++++
>>> 1 file changed, 4 insertions(+)
>>>
>>> diff --git a/kernel/bpf/token.c b/kernel/bpf/token.c
>>> index 26057aa13..104ca37e9 100644
>>> --- a/kernel/bpf/token.c
>>> +++ b/kernel/bpf/token.c
>>> @@ -65,6 +65,7 @@ static int bpf_token_release(struct inode *inode, struct file *filp)
>>> return 0;
>>> }
>>>
>>> +#ifdef CONFIG_PROC_FS
>>> static void bpf_token_show_fdinfo(struct seq_file *m, struct file *filp)
>>> {
>>> struct bpf_token *token = filp->private_data;
>>> @@ -98,6 +99,7 @@ static void bpf_token_show_fdinfo(struct seq_file *m, struct file *filp)
>>> else
>>> seq_printf(m, "allowed_attachs:\t0x%llx\n", token->allowed_attachs);
>>> }
>>> +#endif
>>>
>>> #define BPF_TOKEN_INODE_NAME "bpf-token"
>>>
>>> @@ -105,7 +107,9 @@ static const struct inode_operations bpf_token_iops = { };
>>>
>>> static const struct file_operations bpf_token_fops = {
>>> .release = bpf_token_release,
>>> +#ifdef CONFIG_PROC_FS
>>> .show_fdinfo = bpf_token_show_fdinfo,
>>> +#endif
>>
>> there's many more of such cases.. I'm not sure if it makes sense to fix that,
>> because it does not break the build and only save space for !CONFIG_PROC_FS
>> kernels
>
> +1.
> let's keep the code as-is.
>
Got it, thanks anyway.
> pw-bot: cr
--
Best Regards
Tao Chen
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2025-03-18 15:20 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-18 6:25 [PATCH bpf-next] bpf: Define bpf_token_show_fdinfo with CONFIG_PROC_FS Tao Chen
2025-03-18 9:28 ` Jiri Olsa
2025-03-18 14:59 ` Alexei Starovoitov
2025-03-18 15:20 ` Tao Chen
-- strict thread matches above, loose matches on Subject: below --
2025-03-17 15:51 Tao Chen
2025-03-17 18:01 ` Song Liu
2025-03-18 5:00 ` Tao Chen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox