diff mbox series

[bpf-next] bpf: Fix build without BPF_LSM.

Message ID 20200831163132.66521-1-alexei.starovoitov@gmail.com
State Accepted
Delegated to: BPF Maintainers
Headers show
Series [bpf-next] bpf: Fix build without BPF_LSM. | expand

Commit Message

Alexei Starovoitov Aug. 31, 2020, 4:31 p.m. UTC
From: Alexei Starovoitov <ast@kernel.org>

resolve_btfids doesn't like empty set. Add unused ID when BPF_LSM is off.

Reported-by: Björn Töpel <bjorn.topel@gmail.com>
Fixes: 1e6c62a88215 ("bpf: Introduce sleepable BPF programs")
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
---
 kernel/bpf/verifier.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Song Liu Aug. 31, 2020, 5:24 p.m. UTC | #1
> On Aug 31, 2020, at 9:31 AM, Alexei Starovoitov <alexei.starovoitov@gmail.com> wrote:
> 
> From: Alexei Starovoitov <ast@kernel.org>
> 
> resolve_btfids doesn't like empty set. Add unused ID when BPF_LSM is off.
> 
> Reported-by: Björn Töpel <bjorn.topel@gmail.com>
> Fixes: 1e6c62a88215 ("bpf: Introduce sleepable BPF programs")
> Signed-off-by: Alexei Starovoitov <ast@kernel.org>

Thanks for the fix!

Tested-by: Song Liu <songliubraving@fb.com>


> ---
> kernel/bpf/verifier.c | 2 ++
> 1 file changed, 2 insertions(+)
> 
> diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
> index 3ebfdb7bd427..b4c22b5ce5a2 100644
> --- a/kernel/bpf/verifier.c
> +++ b/kernel/bpf/verifier.c
> @@ -11008,6 +11008,8 @@ BTF_SET_START(btf_sleepable_lsm_hooks)
> #ifdef CONFIG_BPF_LSM
> BTF_ID(func, bpf_lsm_file_mprotect)
> BTF_ID(func, bpf_lsm_bprm_committed_creds)
> +#else
> +BTF_ID_UNUSED
> #endif
> BTF_SET_END(btf_sleepable_lsm_hooks)
> 
> -- 
> 2.23.0
>
KP Singh Aug. 31, 2020, 5:40 p.m. UTC | #2
On Mon, Aug 31, 2020 at 7:25 PM Song Liu <songliubraving@fb.com> wrote:
>
>
>
> > On Aug 31, 2020, at 9:31 AM, Alexei Starovoitov <alexei.starovoitov@gmail.com> wrote:
> >
> > From: Alexei Starovoitov <ast@kernel.org>
> >
> > resolve_btfids doesn't like empty set. Add unused ID when BPF_LSM is off.
> >
> > Reported-by: Björn Töpel <bjorn.topel@gmail.com>
> > Fixes: 1e6c62a88215 ("bpf: Introduce sleepable BPF programs")
> > Signed-off-by: Alexei Starovoitov <ast@kernel.org>
>
> Thanks for the fix!
>
> Tested-by: Song Liu <songliubraving@fb.com>

Thanks Björn for reporting and Alexei for fixing!

Acked-by: KP Singh <kpsingh@google.com>
Daniel Borkmann Aug. 31, 2020, 8:07 p.m. UTC | #3
On 8/31/20 6:31 PM, Alexei Starovoitov wrote:
> From: Alexei Starovoitov <ast@kernel.org>
> 
> resolve_btfids doesn't like empty set. Add unused ID when BPF_LSM is off.
> 
> Reported-by: Björn Töpel <bjorn.topel@gmail.com>
> Fixes: 1e6c62a88215 ("bpf: Introduce sleepable BPF programs")
> Signed-off-by: Alexei Starovoitov <ast@kernel.org>

Applied, thanks!
diff mbox series

Patch

diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
index 3ebfdb7bd427..b4c22b5ce5a2 100644
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -11008,6 +11008,8 @@  BTF_SET_START(btf_sleepable_lsm_hooks)
 #ifdef CONFIG_BPF_LSM
 BTF_ID(func, bpf_lsm_file_mprotect)
 BTF_ID(func, bpf_lsm_bprm_committed_creds)
+#else
+BTF_ID_UNUSED
 #endif
 BTF_SET_END(btf_sleepable_lsm_hooks)