[PATCH] bpf: Fix undeclared function 'barrier_nospec' warning
From: Viresh Kumar
Date: Wed Feb 22 2023 - 03:24:39 EST
Add the missing header for architectures that don't define
the barrier_nospec() macro. The nospec.h header is added after the
inclusion of barrier.h to avoid redefining the macro for architectures
that already define barrier_nospec() in their respective barrier.h
headers.
Fixes: 74e19ef0ff80 ("uaccess: Add speculation barrier to copy_from_user()")
Signed-off-by: Viresh Kumar <viresh.kumar@xxxxxxxxxx>
---
Linus's master branch fails currently to build for arm64 without this commit.
kernel/bpf/core.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/kernel/bpf/core.c b/kernel/bpf/core.c
index 933869983e2a..92aeb388e422 100644
--- a/kernel/bpf/core.c
+++ b/kernel/bpf/core.c
@@ -38,6 +38,8 @@
#include <linux/memcontrol.h>
#include <asm/barrier.h>
+#include <linux/nospec.h>
+
#include <asm/unaligned.h>
/* Registers */
--
2.31.1.272.g89b43f80a514