bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mikko Ylinen <mikko.ylinen@linux.intel.com>
To: KP Singh <kpsingh@kernel.org>
Cc: bpf <bpf@vger.kernel.org>,
	open list <linux-kernel@vger.kernel.org>,
	KP Singh <kpsingh@google.com>,
	Daniel Borkmann <daniel@iogearbox.net>
Subject: Re: [PATCH] bpf: Drop disabled LSM hooks from the sleepable set
Date: Mon, 25 Jan 2021 08:55:24 +0200	[thread overview]
Message-ID: <YA5rXLwy4mcgcvLx@outtakka> (raw)
In-Reply-To: <CACYkzJ5i6DNxY3D3SqiO_LO2HBbA-EgPFdK8ZBcFNmTVWweucg@mail.gmail.com>

On Sat, Jan 23, 2021 at 12:50:21AM +0100, KP Singh wrote:
> On Fri, Jan 22, 2021 at 11:33 PM KP Singh <kpsingh@kernel.org> wrote:
> >
> > On Fri, Jan 22, 2021 at 1:32 PM Mikko Ylinen
> > <mikko.ylinen@linux.intel.com> wrote:
> > >
> > > Networking LSM hooks are conditionally enabled and when building the new
> > > sleepable BPF LSM hooks with the networking LSM hooks disabled, the
> > > following build error occurs:
> > >
> > > BTFIDS  vmlinux
> > > FAILED unresolved symbol bpf_lsm_socket_socketpair
> > >
> > > To fix the error, conditionally add the networking LSM hooks to the
> > > sleepable set.
> > >
> > > Fixes: 423f16108c9d8 ("bpf: Augment the set of sleepable LSM hooks")
> > > Signed-off-by: Mikko Ylinen <mikko.ylinen@linux.intel.com>
> >
> > Thanks!
> >
> > Acked-by: KP Singh <kpsingh@kernel.org>
> 
> Btw, I was noticing that there's another hook that is surrounded by ifdefs:
> 
> diff --git a/kernel/bpf/bpf_lsm.c b/kernel/bpf/bpf_lsm.c
> index 70e5e0b6d69d..f7f7754e938d 100644
> --- a/kernel/bpf/bpf_lsm.c
> +++ b/kernel/bpf/bpf_lsm.c
> @@ -166,7 +166,11 @@ BTF_ID(func, bpf_lsm_inode_symlink)
>  BTF_ID(func, bpf_lsm_inode_unlink)
>  BTF_ID(func, bpf_lsm_kernel_module_request)
>  BTF_ID(func, bpf_lsm_kernfs_init_security)
> +
> +#ifdef CONFIG_KEYS
>  BTF_ID(func, bpf_lsm_key_free)
> +#endif
> +
>  BTF_ID(func, bpf_lsm_mmap_file)
>  BTF_ID(func, bpf_lsm_netlink_send)
>  BTF_ID(func, bpf_lsm_path_notify)
> 
> It would be great if you can also add this to your patch :)

Thanks for noticing! I cross-checked the sleepable set but somehow
missed this. Just posted v2.

> I guess the cleanest solution to never let this happen would be to
> incorporate this in
> lsm_hook_defs.h and mark hooks as SLEEPABLE and NON_SLEEPABLE with an
> extra parameter to the LSM_HOOK macro and then only generate the BTF IDs
> based on this macro parameter.

Agree, a way to get the set automatically created makes sense. But the
extra parameter to LSM_HOOK macro would be BPF specific, right?

-- Regards, Mikko

  parent reply	other threads:[~2021-01-25  6:59 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-22 12:30 [PATCH] bpf: Drop disabled LSM hooks from the sleepable set Mikko Ylinen
2021-01-22 22:33 ` KP Singh
2021-01-22 23:50   ` KP Singh
2021-01-25  6:39     ` [PATCH v2] " Mikko Ylinen
2021-01-25 17:45       ` KP Singh
2021-01-26 16:20       ` patchwork-bot+netdevbpf
2021-01-25  6:55     ` Mikko Ylinen [this message]
2021-01-25 17:49       ` [PATCH] " KP Singh

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=YA5rXLwy4mcgcvLx@outtakka \
    --to=mikko.ylinen@linux.intel.com \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=kpsingh@google.com \
    --cc=kpsingh@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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).