2020-03-30 20:42:50

by KP Singh

[permalink] [raw]
Subject: [PATCH bpf-next] bpf: lsm: Make BPF_LSM depend on BPF_EVENTS

From: KP Singh <[email protected]>

LSM and tracing programs share their helpers with bpf_tracing_func_proto
which is only defined (in bpf_trace.c) when BPF_EVENTS is enabled.

Instead of adding __weak symbol, make BPF_LSM depend on
BPF_EVENTS so that both tracing and LSM programs can actually share
helpers.

Signed-off-by: KP Singh <[email protected]>
Reported-by: Randy Dunlap <[email protected]>
Fixes: fc611f47f218 ("bpf: Introduce BPF_PROG_TYPE_LSM")
---
init/Kconfig | 1 +
1 file changed, 1 insertion(+)

diff --git a/init/Kconfig b/init/Kconfig
index deae572d1927..7b7ea70e64ac 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -1619,6 +1619,7 @@ config KALLSYMS_BASE_RELATIVE

config BPF_LSM
bool "LSM Instrumentation with BPF"
+ depends on BPF_EVENTS
depends on BPF_SYSCALL
depends on SECURITY
depends on BPF_JIT
--
2.20.1


2020-03-30 21:01:20

by Daniel Borkmann

[permalink] [raw]
Subject: Re: [PATCH bpf-next] bpf: lsm: Make BPF_LSM depend on BPF_EVENTS

On 3/30/20 10:40 PM, KP Singh wrote:
> From: KP Singh <[email protected]>
>
> LSM and tracing programs share their helpers with bpf_tracing_func_proto
> which is only defined (in bpf_trace.c) when BPF_EVENTS is enabled.
>
> Instead of adding __weak symbol, make BPF_LSM depend on
> BPF_EVENTS so that both tracing and LSM programs can actually share
> helpers.
>
> Signed-off-by: KP Singh <[email protected]>
> Reported-by: Randy Dunlap <[email protected]>
> Fixes: fc611f47f218 ("bpf: Introduce BPF_PROG_TYPE_LSM")

Applied, thanks!

2020-03-30 21:02:06

by Randy Dunlap

[permalink] [raw]
Subject: Re: [PATCH bpf-next] bpf: lsm: Make BPF_LSM depend on BPF_EVENTS

On 3/30/20 2:00 PM, Daniel Borkmann wrote:
> On 3/30/20 10:40 PM, KP Singh wrote:
>> From: KP Singh <[email protected]>
>>
>> LSM and tracing programs share their helpers with bpf_tracing_func_proto
>> which is only defined (in bpf_trace.c) when BPF_EVENTS is enabled.
>>
>> Instead of adding __weak symbol, make BPF_LSM depend on
>> BPF_EVENTS so that both tracing and LSM programs can actually share
>> helpers.
>>
>> Signed-off-by: KP Singh <[email protected]>
>> Reported-by: Randy Dunlap <[email protected]>
>> Fixes: fc611f47f218 ("bpf: Introduce BPF_PROG_TYPE_LSM")
>
> Applied, thanks!

Acked-by: Randy Dunlap <[email protected]> # build-tested

thanks.
--
~Randy