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 5d2208b641f99..9c44bc89011ad 100644 --- a/include/linux/bpf.h +++ b/include/linux/bpf.h @@ -213,6 +213,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 */ @@ -221,6 +222,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 @@ -284,7 +286,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 261dafff64271..b11a42eb56e97 100644 --- a/include/uapi/linux/bpf.h +++ b/include/uapi/linux/bpf.h @@ -153,9 +153,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 {