mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-23 07:12:09 +00:00
bpf: Fix build error without CONFIG_INET
If CONFIG_INET is not set, building fails:
kernel/bpf/verifier.o: In function `check_mem_access':
verifier.c: undefined reference to `bpf_xdp_sock_is_valid_access'
kernel/bpf/verifier.o: In function `convert_ctx_accesses':
verifier.c: undefined reference to `bpf_xdp_sock_convert_ctx_access'
Reported-by: Hulk Robot <hulkci@huawei.com>
Fixes: fada7fdc83
("bpf: Allow bpf_map_lookup_elem() on an xskmap")
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Acked-by: Jonathan Lemon <jonathan.lemon@gmail.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
This commit is contained in:
parent
69d96519db
commit
7f94208c8f
1 changed files with 24 additions and 7 deletions
|
@ -728,13 +728,6 @@ void __cpu_map_insert_ctx(struct bpf_map *map, u32 index);
|
||||||
void __cpu_map_flush(struct bpf_map *map);
|
void __cpu_map_flush(struct bpf_map *map);
|
||||||
int cpu_map_enqueue(struct bpf_cpu_map_entry *rcpu, struct xdp_buff *xdp,
|
int cpu_map_enqueue(struct bpf_cpu_map_entry *rcpu, struct xdp_buff *xdp,
|
||||||
struct net_device *dev_rx);
|
struct net_device *dev_rx);
|
||||||
bool bpf_xdp_sock_is_valid_access(int off, int size, enum bpf_access_type type,
|
|
||||||
struct bpf_insn_access_aux *info);
|
|
||||||
u32 bpf_xdp_sock_convert_ctx_access(enum bpf_access_type type,
|
|
||||||
const struct bpf_insn *si,
|
|
||||||
struct bpf_insn *insn_buf,
|
|
||||||
struct bpf_prog *prog,
|
|
||||||
u32 *target_size);
|
|
||||||
|
|
||||||
/* Return map's numa specified by userspace */
|
/* Return map's numa specified by userspace */
|
||||||
static inline int bpf_map_attr_numa_node(const union bpf_attr *attr)
|
static inline int bpf_map_attr_numa_node(const union bpf_attr *attr)
|
||||||
|
@ -1110,6 +1103,15 @@ u32 bpf_tcp_sock_convert_ctx_access(enum bpf_access_type type,
|
||||||
struct bpf_insn *insn_buf,
|
struct bpf_insn *insn_buf,
|
||||||
struct bpf_prog *prog,
|
struct bpf_prog *prog,
|
||||||
u32 *target_size);
|
u32 *target_size);
|
||||||
|
|
||||||
|
bool bpf_xdp_sock_is_valid_access(int off, int size, enum bpf_access_type type,
|
||||||
|
struct bpf_insn_access_aux *info);
|
||||||
|
|
||||||
|
u32 bpf_xdp_sock_convert_ctx_access(enum bpf_access_type type,
|
||||||
|
const struct bpf_insn *si,
|
||||||
|
struct bpf_insn *insn_buf,
|
||||||
|
struct bpf_prog *prog,
|
||||||
|
u32 *target_size);
|
||||||
#else
|
#else
|
||||||
static inline bool bpf_tcp_sock_is_valid_access(int off, int size,
|
static inline bool bpf_tcp_sock_is_valid_access(int off, int size,
|
||||||
enum bpf_access_type type,
|
enum bpf_access_type type,
|
||||||
|
@ -1126,6 +1128,21 @@ static inline u32 bpf_tcp_sock_convert_ctx_access(enum bpf_access_type type,
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
static inline bool bpf_xdp_sock_is_valid_access(int off, int size,
|
||||||
|
enum bpf_access_type type,
|
||||||
|
struct bpf_insn_access_aux *info)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline u32 bpf_xdp_sock_convert_ctx_access(enum bpf_access_type type,
|
||||||
|
const struct bpf_insn *si,
|
||||||
|
struct bpf_insn *insn_buf,
|
||||||
|
struct bpf_prog *prog,
|
||||||
|
u32 *target_size)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
#endif /* CONFIG_INET */
|
#endif /* CONFIG_INET */
|
||||||
|
|
||||||
#endif /* _LINUX_BPF_H */
|
#endif /* _LINUX_BPF_H */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue