From: Yufen Yu yuyufen@huawei.com
hulk inclusion category: feature bugzilla: NA CVE: NA
-------------------------------------------------
commit 9df1c28bb752 ("bpf: add writable context for raw tracepoints") add new member into struct bpf_prog_aux and struct bpf_raw_event_map, which will break KABI. This patch try to fix it.
Signed-off-by: Yufen Yu yuyufen@huawei.com Reviewed-by: Hou Tao houtao1@huawei.com Signed-off-by: Yang Yingliang yangyingliang@huawei.com --- include/linux/bpf.h | 5 +++++ include/linux/tracepoint-defs.h | 2 ++ include/uapi/linux/bpf.h | 2 ++ 3 files changed, 9 insertions(+)
diff --git a/include/linux/bpf.h b/include/linux/bpf.h index 2eed5ecdcdc75..4d5243bb385bd 100644 --- a/include/linux/bpf.h +++ b/include/linux/bpf.h @@ -214,6 +214,7 @@ enum bpf_reg_type { PTR_TO_PACKET_META, /* skb->data - meta_len */ PTR_TO_PACKET, /* reg points to skb->data */ PTR_TO_PACKET_END, /* skb->data + headlen */ +#ifndef __GENKSYMS__ PTR_TO_FLOW_KEYS, /* reg points to bpf_flow_keys */ PTR_TO_SOCKET, /* reg points to struct bpf_sock */ PTR_TO_SOCKET_OR_NULL, /* reg points to struct bpf_sock or NULL */ @@ -222,6 +223,7 @@ enum bpf_reg_type { PTR_TO_TCP_SOCK, /* reg points to struct tcp_sock */ PTR_TO_TCP_SOCK_OR_NULL, /* reg points to struct tcp_sock or NULL */ PTR_TO_TP_BUFFER, /* reg points to a writable raw tp's buffer */ +#endif };
/* The information passed from prog-specific *_is_valid_access @@ -293,7 +295,10 @@ struct bpf_prog_aux { atomic_t refcnt; u32 used_map_cnt; u32 max_ctx_offset; + /* not protected by KABI, safe to extend in the middle */ +#ifndef __GENKSYMS__ u32 max_tp_access; +#endif u32 stack_depth; u32 id; u32 func_cnt; diff --git a/include/linux/tracepoint-defs.h b/include/linux/tracepoint-defs.h index b29950a19205e..fb17ab8934575 100644 --- a/include/linux/tracepoint-defs.h +++ b/include/linux/tracepoint-defs.h @@ -45,7 +45,9 @@ struct bpf_raw_event_map { struct tracepoint *tp; void *bpf_func; u32 num_args; +#ifndef __GENKSYMS__ u32 writable_size; +#endif } __aligned(32);
#endif diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h index b6ff566503d11..8b66fe767183b 100644 --- a/include/uapi/linux/bpf.h +++ b/include/uapi/linux/bpf.h @@ -154,9 +154,11 @@ enum bpf_prog_type { BPF_PROG_TYPE_LWT_SEG6LOCAL, BPF_PROG_TYPE_LIRC_MODE2, BPF_PROG_TYPE_SK_REUSEPORT, +#ifndef __GENKSYMS__ BPF_PROG_TYPE_FLOW_DISSECTOR, BPF_PROG_TYPE_CGROUP_SYSCTL, BPF_PROG_TYPE_RAW_TRACEPOINT_WRITABLE, +#endif };
enum bpf_attach_type {