diff mbox series

[v16,01/12] bpf: Allow kfuncs to be used in LSM programs

Message ID 20220905143318.1592015-2-roberto.sassu@huaweicloud.com (mailing list archive)
State Handled Elsewhere
Headers show
Series bpf: Add kfuncs for PKCS#7 signature verification | expand

Commit Message

Roberto Sassu Sept. 5, 2022, 2:33 p.m. UTC
From: KP Singh <kpsingh@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@kernel.org>
Signed-off-by: Roberto Sassu <roberto.sassu@huawei.com>
---
 kernel/bpf/btf.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Kumar Kartikeya Dwivedi Sept. 6, 2022, 2:28 a.m. UTC | #1
On Mon, 5 Sept 2022 at 16:34, Roberto Sassu
<roberto.sassu@huaweicloud.com> wrote:
>
> From: KP Singh <kpsingh@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@kernel.org>
> Signed-off-by: Roberto Sassu <roberto.sassu@huawei.com>
> ---

Acked-by: Kumar Kartikeya Dwivedi <memxor@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 903719b89238..e49b3b6d48ad 100644
> --- a/kernel/bpf/btf.c
> +++ b/kernel/bpf/btf.c
> @@ -7243,6 +7243,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
>
diff mbox series

Patch

diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c
index 903719b89238..e49b3b6d48ad 100644
--- a/kernel/bpf/btf.c
+++ b/kernel/bpf/btf.c
@@ -7243,6 +7243,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;