public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] bpf, lsm: Fix getlsmprop hooks BTF IDs
@ 2024-11-23 10:19 Thomas Weißschuh
  2024-11-23 12:37 ` Jiri Olsa
  2024-11-24 23:45 ` Alexei Starovoitov
  0 siblings, 2 replies; 5+ messages in thread
From: Thomas Weißschuh @ 2024-11-23 10:19 UTC (permalink / raw)
  To: KP Singh, Matt Bobrowski, Alexei Starovoitov, Daniel Borkmann,
	Andrii Nakryiko, Martin KaFai Lau, Eduard Zingerman, Song Liu,
	Yonghong Song, John Fastabend, Stanislav Fomichev, Hao Luo,
	Jiri Olsa, Paul Moore, Casey Schaufler
  Cc: bpf, linux-kernel, audit, selinux, Thomas Weißschuh

The hooks got renamed, adapt the BTF IDs.
Fixes the following build warning:

  BTFIDS  vmlinux
WARN: resolve_btfids: unresolved symbol bpf_lsm_task_getsecid_obj
WARN: resolve_btfids: unresolved symbol bpf_lsm_current_getsecid_subj

Fixes: 37f670aacd48 ("lsm: use lsm_prop in security_current_getsecid")
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
 kernel/bpf/bpf_lsm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/bpf/bpf_lsm.c b/kernel/bpf/bpf_lsm.c
index 3bc61628ab251e05d7837eb27dabc3b62bcc4783..5be76572ab2e8a0c6e18a81f9e4c14812a11aad2 100644
--- a/kernel/bpf/bpf_lsm.c
+++ b/kernel/bpf/bpf_lsm.c
@@ -375,8 +375,8 @@ BTF_ID(func, bpf_lsm_socket_socketpair)
 
 BTF_ID(func, bpf_lsm_syslog)
 BTF_ID(func, bpf_lsm_task_alloc)
-BTF_ID(func, bpf_lsm_current_getsecid_subj)
-BTF_ID(func, bpf_lsm_task_getsecid_obj)
+BTF_ID(func, bpf_lsm_current_getlsmprop_subj)
+BTF_ID(func, bpf_lsm_task_getlsmprop_obj)
 BTF_ID(func, bpf_lsm_task_prctl)
 BTF_ID(func, bpf_lsm_task_setscheduler)
 BTF_ID(func, bpf_lsm_task_to_inode)

---
base-commit: 228a1157fb9fec47eb135b51c0202b574e079ebf
change-id: 20241123-bpf_lsm_task_getsecid_obj-afdd47f84c7f

Best regards,
-- 
Thomas Weißschuh <linux@weissschuh.net>


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] bpf, lsm: Fix getlsmprop hooks BTF IDs
  2024-11-23 10:19 [PATCH] bpf, lsm: Fix getlsmprop hooks BTF IDs Thomas Weißschuh
@ 2024-11-23 12:37 ` Jiri Olsa
  2024-11-24 23:45 ` Alexei Starovoitov
  1 sibling, 0 replies; 5+ messages in thread
From: Jiri Olsa @ 2024-11-23 12:37 UTC (permalink / raw)
  To: Thomas Weißschuh
  Cc: KP Singh, Matt Bobrowski, Alexei Starovoitov, Daniel Borkmann,
	Andrii Nakryiko, Martin KaFai Lau, Eduard Zingerman, Song Liu,
	Yonghong Song, John Fastabend, Stanislav Fomichev, Hao Luo,
	Paul Moore, Casey Schaufler, bpf, linux-kernel, audit, selinux

On Sat, Nov 23, 2024 at 11:19:01AM +0100, Thomas Weißschuh wrote:
> The hooks got renamed, adapt the BTF IDs.
> Fixes the following build warning:
> 
>   BTFIDS  vmlinux
> WARN: resolve_btfids: unresolved symbol bpf_lsm_task_getsecid_obj
> WARN: resolve_btfids: unresolved symbol bpf_lsm_current_getsecid_subj
> 
> Fixes: 37f670aacd48 ("lsm: use lsm_prop in security_current_getsecid")
> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>

Acked-by: Jiri Olsa <olsajiri@gmail.com>

thanks,
jirka

> ---
>  kernel/bpf/bpf_lsm.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/kernel/bpf/bpf_lsm.c b/kernel/bpf/bpf_lsm.c
> index 3bc61628ab251e05d7837eb27dabc3b62bcc4783..5be76572ab2e8a0c6e18a81f9e4c14812a11aad2 100644
> --- a/kernel/bpf/bpf_lsm.c
> +++ b/kernel/bpf/bpf_lsm.c
> @@ -375,8 +375,8 @@ BTF_ID(func, bpf_lsm_socket_socketpair)
>  
>  BTF_ID(func, bpf_lsm_syslog)
>  BTF_ID(func, bpf_lsm_task_alloc)
> -BTF_ID(func, bpf_lsm_current_getsecid_subj)
> -BTF_ID(func, bpf_lsm_task_getsecid_obj)
> +BTF_ID(func, bpf_lsm_current_getlsmprop_subj)
> +BTF_ID(func, bpf_lsm_task_getlsmprop_obj)
>  BTF_ID(func, bpf_lsm_task_prctl)
>  BTF_ID(func, bpf_lsm_task_setscheduler)
>  BTF_ID(func, bpf_lsm_task_to_inode)
> 
> ---
> base-commit: 228a1157fb9fec47eb135b51c0202b574e079ebf
> change-id: 20241123-bpf_lsm_task_getsecid_obj-afdd47f84c7f
> 
> Best regards,
> -- 
> Thomas Weißschuh <linux@weissschuh.net>
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] bpf, lsm: Fix getlsmprop hooks BTF IDs
  2024-11-23 10:19 [PATCH] bpf, lsm: Fix getlsmprop hooks BTF IDs Thomas Weißschuh
  2024-11-23 12:37 ` Jiri Olsa
@ 2024-11-24 23:45 ` Alexei Starovoitov
  2024-11-25  8:25   ` Thomas Weißschuh
  1 sibling, 1 reply; 5+ messages in thread
From: Alexei Starovoitov @ 2024-11-24 23:45 UTC (permalink / raw)
  To: Thomas Weißschuh
  Cc: KP Singh, Matt Bobrowski, Alexei Starovoitov, Daniel Borkmann,
	Andrii Nakryiko, Martin KaFai Lau, Eduard Zingerman, Song Liu,
	Yonghong Song, John Fastabend, Stanislav Fomichev, Hao Luo,
	Jiri Olsa, Paul Moore, Casey Schaufler, bpf, LKML, audit, selinux

On Sat, Nov 23, 2024 at 2:19 AM Thomas Weißschuh <linux@weissschuh.net> wrote:
>
> The hooks got renamed, adapt the BTF IDs.
> Fixes the following build warning:
>
>   BTFIDS  vmlinux
> WARN: resolve_btfids: unresolved symbol bpf_lsm_task_getsecid_obj
> WARN: resolve_btfids: unresolved symbol bpf_lsm_current_getsecid_subj
>
> Fixes: 37f670aacd48 ("lsm: use lsm_prop in security_current_getsecid")
> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
> ---
>  kernel/bpf/bpf_lsm.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/bpf/bpf_lsm.c b/kernel/bpf/bpf_lsm.c
> index 3bc61628ab251e05d7837eb27dabc3b62bcc4783..5be76572ab2e8a0c6e18a81f9e4c14812a11aad2 100644
> --- a/kernel/bpf/bpf_lsm.c
> +++ b/kernel/bpf/bpf_lsm.c
> @@ -375,8 +375,8 @@ BTF_ID(func, bpf_lsm_socket_socketpair)
>
>  BTF_ID(func, bpf_lsm_syslog)
>  BTF_ID(func, bpf_lsm_task_alloc)
> -BTF_ID(func, bpf_lsm_current_getsecid_subj)
> -BTF_ID(func, bpf_lsm_task_getsecid_obj)
> +BTF_ID(func, bpf_lsm_current_getlsmprop_subj)
> +BTF_ID(func, bpf_lsm_task_getlsmprop_obj)

Maybe we can remove these two instead?
I couldn't come up with a reason for bpf_lsm to attach to these two.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] bpf, lsm: Fix getlsmprop hooks BTF IDs
  2024-11-24 23:45 ` Alexei Starovoitov
@ 2024-11-25  8:25   ` Thomas Weißschuh
  2024-11-25 19:35     ` Matt Bobrowski
  0 siblings, 1 reply; 5+ messages in thread
From: Thomas Weißschuh @ 2024-11-25  8:25 UTC (permalink / raw)
  To: Alexei Starovoitov
  Cc: KP Singh, Matt Bobrowski, Alexei Starovoitov, Daniel Borkmann,
	Andrii Nakryiko, Martin KaFai Lau, Eduard Zingerman, Song Liu,
	Yonghong Song, John Fastabend, Stanislav Fomichev, Hao Luo,
	Jiri Olsa, Paul Moore, Casey Schaufler, bpf, LKML, audit, selinux

On 2024-11-24 15:45:04-0800, Alexei Starovoitov wrote:
> On Sat, Nov 23, 2024 at 2:19 AM Thomas Weißschuh <linux@weissschuh.net> wrote:
> >
> > The hooks got renamed, adapt the BTF IDs.
> > Fixes the following build warning:
> >
> >   BTFIDS  vmlinux
> > WARN: resolve_btfids: unresolved symbol bpf_lsm_task_getsecid_obj
> > WARN: resolve_btfids: unresolved symbol bpf_lsm_current_getsecid_subj
> >
> > Fixes: 37f670aacd48 ("lsm: use lsm_prop in security_current_getsecid")
> > Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
> > ---
> >  kernel/bpf/bpf_lsm.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/kernel/bpf/bpf_lsm.c b/kernel/bpf/bpf_lsm.c
> > index 3bc61628ab251e05d7837eb27dabc3b62bcc4783..5be76572ab2e8a0c6e18a81f9e4c14812a11aad2 100644
> > --- a/kernel/bpf/bpf_lsm.c
> > +++ b/kernel/bpf/bpf_lsm.c
> > @@ -375,8 +375,8 @@ BTF_ID(func, bpf_lsm_socket_socketpair)
> >
> >  BTF_ID(func, bpf_lsm_syslog)
> >  BTF_ID(func, bpf_lsm_task_alloc)
> > -BTF_ID(func, bpf_lsm_current_getsecid_subj)
> > -BTF_ID(func, bpf_lsm_task_getsecid_obj)
> > +BTF_ID(func, bpf_lsm_current_getlsmprop_subj)
> > +BTF_ID(func, bpf_lsm_task_getlsmprop_obj)
> 
> Maybe we can remove these two instead?
> I couldn't come up with a reason for bpf_lsm to attach to these two.

Personally I have no idea about bps_lsm, how it works or how it is used.
I only tried to get rid of the warning.
If you prefer I can drop the IDs.

In my opinion this is a discussion that would have been better in
the original patch, if the CI would have caught it.


Thomas

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] bpf, lsm: Fix getlsmprop hooks BTF IDs
  2024-11-25  8:25   ` Thomas Weißschuh
@ 2024-11-25 19:35     ` Matt Bobrowski
  0 siblings, 0 replies; 5+ messages in thread
From: Matt Bobrowski @ 2024-11-25 19:35 UTC (permalink / raw)
  To: Thomas Weißschuh
  Cc: Alexei Starovoitov, KP Singh, Alexei Starovoitov, Daniel Borkmann,
	Andrii Nakryiko, Martin KaFai Lau, Eduard Zingerman, Song Liu,
	Yonghong Song, John Fastabend, Stanislav Fomichev, Hao Luo,
	Jiri Olsa, Paul Moore, Casey Schaufler, bpf, LKML, audit, selinux

On Mon, Nov 25, 2024 at 09:25:24AM +0100, Thomas Weißschuh wrote:
> On 2024-11-24 15:45:04-0800, Alexei Starovoitov wrote:
> > On Sat, Nov 23, 2024 at 2:19 AM Thomas Weißschuh <linux@weissschuh.net> wrote:
> > >
> > > The hooks got renamed, adapt the BTF IDs.
> > > Fixes the following build warning:
> > >
> > >   BTFIDS  vmlinux
> > > WARN: resolve_btfids: unresolved symbol bpf_lsm_task_getsecid_obj
> > > WARN: resolve_btfids: unresolved symbol bpf_lsm_current_getsecid_subj
> > >
> > > Fixes: 37f670aacd48 ("lsm: use lsm_prop in security_current_getsecid")
> > > Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
> > > ---
> > >  kernel/bpf/bpf_lsm.c | 4 ++--
> > >  1 file changed, 2 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/kernel/bpf/bpf_lsm.c b/kernel/bpf/bpf_lsm.c
> > > index 3bc61628ab251e05d7837eb27dabc3b62bcc4783..5be76572ab2e8a0c6e18a81f9e4c14812a11aad2 100644
> > > --- a/kernel/bpf/bpf_lsm.c
> > > +++ b/kernel/bpf/bpf_lsm.c
> > > @@ -375,8 +375,8 @@ BTF_ID(func, bpf_lsm_socket_socketpair)
> > >
> > >  BTF_ID(func, bpf_lsm_syslog)
> > >  BTF_ID(func, bpf_lsm_task_alloc)
> > > -BTF_ID(func, bpf_lsm_current_getsecid_subj)
> > > -BTF_ID(func, bpf_lsm_task_getsecid_obj)
> > > +BTF_ID(func, bpf_lsm_current_getlsmprop_subj)
> > > +BTF_ID(func, bpf_lsm_task_getlsmprop_obj)
> > 
> > Maybe we can remove these two instead?
> > I couldn't come up with a reason for bpf_lsm to attach to these two.
> 
> Personally I have no idea about bps_lsm, how it works or how it is used.
> I only tried to get rid of the warning.
> If you prefer I can drop the IDs.
> 
> In my opinion this is a discussion that would have been better in
> the original patch, if the CI would have caught it.

I agree with Alexei here, we can probably just remove these
instead. ATM, I don't think we could do anything useful with them from
the context of a BPF LSM program anyway.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-11-25 19:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-23 10:19 [PATCH] bpf, lsm: Fix getlsmprop hooks BTF IDs Thomas Weißschuh
2024-11-23 12:37 ` Jiri Olsa
2024-11-24 23:45 ` Alexei Starovoitov
2024-11-25  8:25   ` Thomas Weißschuh
2024-11-25 19:35     ` Matt Bobrowski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox