[PATCH v18 01/13] bpf: Allow kfuncs to be used in LSM programs

Roberto Sassu roberto.sassu at huaweicloud.com
Tue Sep 20 07:59:39 UTC 2022


From: KP Singh <kpsingh at kernel.org>

In preparation for the addition of new kfuncs, allow kfuncs defined in the
tracing subsystem to be used in LSM programs by mapping the LSM program
type to the TRACING hook.

Signed-off-by: KP Singh <kpsingh at kernel.org>
Signed-off-by: Roberto Sassu <roberto.sassu at huawei.com>
Acked-by: Kumar Kartikeya Dwivedi <memxor at gmail.com>
---
 kernel/bpf/btf.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c
index b3940c605aac..dd60cd0efcf8 100644
--- a/kernel/bpf/btf.c
+++ b/kernel/bpf/btf.c
@@ -7381,6 +7381,7 @@ static int bpf_prog_type_to_kfunc_hook(enum bpf_prog_type prog_type)
 	case BPF_PROG_TYPE_STRUCT_OPS:
 		return BTF_KFUNC_HOOK_STRUCT_OPS;
 	case BPF_PROG_TYPE_TRACING:
+	case BPF_PROG_TYPE_LSM:
 		return BTF_KFUNC_HOOK_TRACING;
 	case BPF_PROG_TYPE_SYSCALL:
 		return BTF_KFUNC_HOOK_SYSCALL;
-- 
2.25.1



More information about the Linux-security-module-archive mailing list