[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20201007021613.13646-1-rdunlap@infradead.org>
Date: Tue, 6 Oct 2020 19:16:13 -0700
From: Randy Dunlap <rdunlap@...radead.org>
To: linux-kernel@...r.kernel.org
Cc: Randy Dunlap <rdunlap@...radead.org>,
Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>, netdev@...r.kernel.org,
bpf@...r.kernel.org, Martin KaFai Lau <kafai@...com>,
linux-next@...r.kernel.org
Subject: [PATCH bpf-next] kernel/bpf/verifier: fix build when NET is not enabled
Fix build errors in kernel/bpf/verifier.c when CONFIG_NET is
not enabled.
../kernel/bpf/verifier.c:3995:13: error: ‘btf_sock_ids’ undeclared here (not in a function); did you mean ‘bpf_sock_ops’?
.btf_id = &btf_sock_ids[BTF_SOCK_TYPE_SOCK_COMMON],
../kernel/bpf/verifier.c:3995:26: error: ‘BTF_SOCK_TYPE_SOCK_COMMON’ undeclared here (not in a function); did you mean ‘PTR_TO_SOCK_COMMON’?
.btf_id = &btf_sock_ids[BTF_SOCK_TYPE_SOCK_COMMON],
Fixes: 1df8f55a37bd ("bpf: Enable bpf_skc_to_* sock casting helper to networking prog type")
Signed-off-by: Randy Dunlap <rdunlap@...radead.org>
Cc: Alexei Starovoitov <ast@...nel.org>
Cc: Daniel Borkmann <daniel@...earbox.net>
Cc: netdev@...r.kernel.org
Cc: bpf@...r.kernel.org
Cc: Martin KaFai Lau <kafai@...com>
Cc: linux-next@...r.kernel.org
---
First reported by me in linux-next-20200928.
kernel/bpf/verifier.c | 4 ++++
1 file changed, 4 insertions(+)
--- mmotm-2020-1006-1550.orig/kernel/bpf/verifier.c
+++ mmotm-2020-1006-1550/kernel/bpf/verifier.c
@@ -3984,6 +3984,7 @@ static const struct bpf_reg_types sock_t
},
};
+#ifdef CONFIG_NET
static const struct bpf_reg_types btf_id_sock_common_types = {
.types = {
PTR_TO_SOCK_COMMON,
@@ -3994,6 +3995,7 @@ static const struct bpf_reg_types btf_id
},
.btf_id = &btf_sock_ids[BTF_SOCK_TYPE_SOCK_COMMON],
};
+#endif
static const struct bpf_reg_types mem_types = {
.types = {
@@ -4037,7 +4039,9 @@ static const struct bpf_reg_types *compa
[ARG_PTR_TO_CTX] = &context_types,
[ARG_PTR_TO_CTX_OR_NULL] = &context_types,
[ARG_PTR_TO_SOCK_COMMON] = &sock_types,
+#ifdef CONFIG_NET
[ARG_PTR_TO_BTF_ID_SOCK_COMMON] = &btf_id_sock_common_types,
+#endif
[ARG_PTR_TO_SOCKET] = &fullsock_types,
[ARG_PTR_TO_SOCKET_OR_NULL] = &fullsock_types,
[ARG_PTR_TO_BTF_ID] = &btf_ptr_types,
Powered by blists - more mailing lists