From 3479e396eef4db6514ab59d2ec889ae237869486 Mon Sep 17 00:00:00 2001 From: Daniel Borkmann Date: Tue, 15 Sep 2026 17:07:36 +0200 Subject: [PATCH] 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 Signed-off-by: Alexei Starovoitov Link: https://patch.msgid.link/20260915150739.284189-6-daniel@iogearbox.net --- kernel/bpf/bpf_lsm_proto.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/kernel/bpf/bpf_lsm_proto.c b/kernel/bpf/bpf_lsm_proto.c index 4a776df76cbb..b81179ae2e08 100644 --- a/kernel/bpf/bpf_lsm_proto.c +++ b/kernel/bpf/bpf_lsm_proto.c @@ -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; }