bpf, lsm: Mark the BPF LSM hook overrides noinline

The stubs that bpf_lsm_proto.c overrides are generated as:

  #define LSM_HOOK(RET, DEFAULT, NAME, ...)     \
  __weak noinline RET bpf_lsm_##NAME(__VA_ARGS__)       \
  {                                             \
          return DEFAULT;                       \
  }

Mark the overrides noinline as well so they hold up the same contract
as the stubs they replace.

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://patch.msgid.link/20260915150739.284189-6-daniel@iogearbox.net
This commit is contained in:
Daniel Borkmann 2026-09-15 17:07:36 +02:00 committed by Alexei Starovoitov
parent ff0d1c0915
commit 3479e396ee
No known key found for this signature in database

View File

@ -13,8 +13,8 @@
* explicitly enforces that BPF LSM programs check for NULL before attempting to
* dereference it.
*/
int bpf_lsm_mmap_file(struct file *file__nullable, unsigned long reqprot,
unsigned long prot, unsigned long flags)
noinline int bpf_lsm_mmap_file(struct file *file__nullable, unsigned long reqprot,
unsigned long prot, unsigned long flags)
{
return 0;
}
@ -25,10 +25,10 @@ int bpf_lsm_mmap_file(struct file *file__nullable, unsigned long reqprot,
* suffix marks it as PTR_MAYBE_NULL. BPF LSM programs have to check before
* dereferencing them or handing them to bpf_inode_init_xattr().
*/
int bpf_lsm_inode_init_security(struct inode *inode, struct inode *dir,
const struct qstr *qstr__nullable,
struct xattr *xattrs__nullable,
int *xattr_count)
noinline int bpf_lsm_inode_init_security(struct inode *inode, struct inode *dir,
const struct qstr *qstr__nullable,
struct xattr *xattrs__nullable,
int *xattr_count)
{
return -EOPNOTSUPP;
}