diff mbox series

BPF: Include missing nospec.h to avoid build error

Message ID 20230222025048.3677315-1-chenhuacai@loongson.cn (mailing list archive)
State Accepted
Commit 345d24a91c79f408e355c8b7e873ccde0f097eea
Delegated to: BPF
Headers show
Series BPF: Include missing nospec.h to avoid build error | expand

Checks

Context Check Description
bpf/vmtest-bpf-VM_Test-1 success Logs for ShellCheck
bpf/vmtest-bpf-VM_Test-3 success Logs for build for aarch64 with llvm-16
bpf/vmtest-bpf-VM_Test-7 success Logs for llvm-toolchain
bpf/vmtest-bpf-VM_Test-8 success Logs for set-matrix
bpf/vmtest-bpf-VM_Test-2 success Logs for build for aarch64 with gcc
bpf/vmtest-bpf-VM_Test-4 success Logs for build for s390x with gcc
bpf/vmtest-bpf-VM_Test-5 success Logs for build for x86_64 with gcc
bpf/vmtest-bpf-VM_Test-6 success Logs for build for x86_64 with llvm-16
bpf/vmtest-bpf-VM_Test-9 success Logs for test_maps on aarch64 with gcc
bpf/vmtest-bpf-VM_Test-12 success Logs for test_maps on x86_64 with gcc
bpf/vmtest-bpf-VM_Test-13 success Logs for test_maps on x86_64 with llvm-16
bpf/vmtest-bpf-VM_Test-22 success Logs for test_progs_no_alu32 on x86_64 with gcc
bpf/vmtest-bpf-VM_Test-23 fail Logs for test_progs_no_alu32 on x86_64 with llvm-16
bpf/vmtest-bpf-VM_Test-24 success Logs for test_progs_no_alu32_parallel on aarch64 with gcc
bpf/vmtest-bpf-VM_Test-25 success Logs for test_progs_no_alu32_parallel on aarch64 with llvm-16
bpf/vmtest-bpf-VM_Test-27 success Logs for test_progs_no_alu32_parallel on x86_64 with gcc
bpf/vmtest-bpf-VM_Test-28 success Logs for test_progs_no_alu32_parallel on x86_64 with llvm-16
bpf/vmtest-bpf-VM_Test-29 success Logs for test_progs_parallel on aarch64 with gcc
bpf/vmtest-bpf-VM_Test-30 success Logs for test_progs_parallel on aarch64 with llvm-16
bpf/vmtest-bpf-VM_Test-32 success Logs for test_progs_parallel on x86_64 with gcc
bpf/vmtest-bpf-VM_Test-33 success Logs for test_progs_parallel on x86_64 with llvm-16
bpf/vmtest-bpf-VM_Test-34 success Logs for test_verifier on aarch64 with gcc
bpf/vmtest-bpf-VM_Test-35 success Logs for test_verifier on aarch64 with llvm-16
bpf/vmtest-bpf-VM_Test-37 success Logs for test_verifier on x86_64 with gcc
bpf/vmtest-bpf-VM_Test-38 success Logs for test_verifier on x86_64 with llvm-16
bpf/vmtest-bpf-VM_Test-10 success Logs for test_maps on aarch64 with llvm-16
bpf/vmtest-bpf-VM_Test-14 success Logs for test_progs on aarch64 with gcc
bpf/vmtest-bpf-VM_Test-15 fail Logs for test_progs on aarch64 with llvm-16
bpf/vmtest-bpf-VM_Test-17 success Logs for test_progs on x86_64 with gcc
bpf/vmtest-bpf-VM_Test-18 success Logs for test_progs on x86_64 with llvm-16
bpf/vmtest-bpf-VM_Test-19 success Logs for test_progs_no_alu32 on aarch64 with gcc
bpf/vmtest-bpf-VM_Test-20 success Logs for test_progs_no_alu32 on aarch64 with llvm-16
bpf/vmtest-bpf-VM_Test-26 success Logs for test_progs_no_alu32_parallel on s390x with gcc
bpf/vmtest-bpf-VM_Test-36 success Logs for test_verifier on s390x with gcc
bpf/vmtest-bpf-VM_Test-16 success Logs for test_progs on s390x with gcc
bpf/vmtest-bpf-VM_Test-21 success Logs for test_progs_no_alu32 on s390x with gcc
bpf/vmtest-bpf-VM_Test-31 success Logs for test_progs_parallel on s390x with gcc
bpf/vmtest-bpf-PR fail PR summary
bpf/vmtest-bpf-VM_Test-11 success Logs for test_maps on s390x with gcc
netdev/tree_selection success Guessing tree name failed - patch did not apply
bpf/vmtest-bpf-next-VM_Test-1 success Logs for ShellCheck
bpf/vmtest-bpf-next-PR success PR summary
bpf/vmtest-bpf-next-VM_Test-2 pending Logs for build for aarch64 with gcc
bpf/vmtest-bpf-next-VM_Test-3 pending Logs for build for aarch64 with llvm-16
bpf/vmtest-bpf-next-VM_Test-4 pending Logs for build for s390x with gcc
bpf/vmtest-bpf-next-VM_Test-5 pending Logs for build for x86_64 with gcc
bpf/vmtest-bpf-next-VM_Test-6 pending Logs for build for x86_64 with llvm-16
bpf/vmtest-bpf-next-VM_Test-7 success Logs for llvm-toolchain
bpf/vmtest-bpf-next-VM_Test-8 success Logs for set-matrix

Commit Message

Huacai Chen Feb. 22, 2023, 2:50 a.m. UTC
Commit 74e19ef0ff8061ef55957c3a ("uaccess: Add speculation barrier to
copy_from_user()") defines a default barrier_nospec() and removes the
#ifdefs in kernel/bpf/core.c, but doesn't include nospec.h, which causes
such a build error:

  CC      kernel/bpf/core.o
kernel/bpf/core.c: In function ‘___bpf_prog_run’:
kernel/bpf/core.c:1913:3: error: implicit declaration of function ‘barrier_nospec’; did you mean ‘barrier_data’? [-Werror=implicit-function-declaration]
   barrier_nospec();
   ^~~~~~~~~~~~~~
   barrier_data
cc1: some warnings being treated as errors

So include nospec.h to avoid the build error.

Fixes: 74e19ef0ff8061ef55957c3a ("uaccess: Add speculation barrier to copy_from_user()")
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
---
 kernel/bpf/core.c | 1 +
 1 file changed, 1 insertion(+)

Comments

patchwork-bot+netdevbpf@kernel.org Feb. 22, 2023, 5:10 a.m. UTC | #1
Hello:

This patch was applied to bpf/bpf.git (master)
by Alexei Starovoitov <ast@kernel.org>:

On Wed, 22 Feb 2023 10:50:48 +0800 you wrote:
> Commit 74e19ef0ff8061ef55957c3a ("uaccess: Add speculation barrier to
> copy_from_user()") defines a default barrier_nospec() and removes the
> #ifdefs in kernel/bpf/core.c, but doesn't include nospec.h, which causes
> such a build error:
> 
>   CC      kernel/bpf/core.o
> kernel/bpf/core.c: In function ‘___bpf_prog_run’:
> kernel/bpf/core.c:1913:3: error: implicit declaration of function ‘barrier_nospec’; did you mean ‘barrier_data’? [-Werror=implicit-function-declaration]
>    barrier_nospec();
>    ^~~~~~~~~~~~~~
>    barrier_data
> cc1: some warnings being treated as errors
> 
> [...]

Here is the summary with links:
  - BPF: Include missing nospec.h to avoid build error
    https://git.kernel.org/bpf/bpf/c/345d24a91c79

You are awesome, thank you!
Huacai Chen Feb. 22, 2023, 6:26 a.m. UTC | #2
Oh, I'm sorry but the modified commit message seems broken.

Huacai

On Wed, Feb 22, 2023 at 1:10 PM <patchwork-bot+netdevbpf@kernel.org> wrote:
>
> Hello:
>
> This patch was applied to bpf/bpf.git (master)
> by Alexei Starovoitov <ast@kernel.org>:
>
> On Wed, 22 Feb 2023 10:50:48 +0800 you wrote:
> > Commit 74e19ef0ff8061ef55957c3a ("uaccess: Add speculation barrier to
> > copy_from_user()") defines a default barrier_nospec() and removes the
> > #ifdefs in kernel/bpf/core.c, but doesn't include nospec.h, which causes
> > such a build error:
> >
> >   CC      kernel/bpf/core.o
> > kernel/bpf/core.c: In function ‘___bpf_prog_run’:
> > kernel/bpf/core.c:1913:3: error: implicit declaration of function ‘barrier_nospec’; did you mean ‘barrier_data’? [-Werror=implicit-function-declaration]
> >    barrier_nospec();
> >    ^~~~~~~~~~~~~~
> >    barrier_data
> > cc1: some warnings being treated as errors
> >
> > [...]
>
> Here is the summary with links:
>   - BPF: Include missing nospec.h to avoid build error
>     https://git.kernel.org/bpf/bpf/c/345d24a91c79
>
> You are awesome, thank you!
> --
> Deet-doot-dot, I am a bot.
> https://korg.docs.kernel.org/patchwork/pwbot.html
>
>
Alexei Starovoitov Feb. 22, 2023, 4:29 p.m. UTC | #3
On Tue, Feb 21, 2023 at 10:27 PM Huacai Chen <chenhuacai@gmail.com> wrote:
>
> Oh, I'm sorry but the modified commit message seems broken.

You didn't do it correctly. I fixed it up while applying.
diff mbox series

Patch

diff --git a/kernel/bpf/core.c b/kernel/bpf/core.c
index 430c66d59ec7..f9c3b1033ec3 100644
--- a/kernel/bpf/core.c
+++ b/kernel/bpf/core.c
@@ -34,6 +34,7 @@ 
 #include <linux/log2.h>
 #include <linux/bpf_verifier.h>
 #include <linux/nodemask.h>
+#include <linux/nospec.h>
 #include <linux/bpf_mem_alloc.h>
 
 #include <asm/barrier.h>