提交 c365b334 编写于 作者: Y Yufen Yu 提交者: Cheng Jian

bpf: fix kabi for struct bpf_prog_aux and struct bpf_raw_event_map

hulk inclusion
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I3U9MR
CVE: NA

-------------------------------------------------

commit 9df1c28b ("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: NYufen Yu <yuyufen@huawei.com>
Reviewed-by: NHou Tao <houtao1@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 4151a3b9
...@@ -213,6 +213,7 @@ enum bpf_reg_type { ...@@ -213,6 +213,7 @@ enum bpf_reg_type {
PTR_TO_PACKET_META, /* skb->data - meta_len */ PTR_TO_PACKET_META, /* skb->data - meta_len */
PTR_TO_PACKET, /* reg points to skb->data */ PTR_TO_PACKET, /* reg points to skb->data */
PTR_TO_PACKET_END, /* skb->data + headlen */ PTR_TO_PACKET_END, /* skb->data + headlen */
#ifndef __GENKSYMS__
PTR_TO_FLOW_KEYS, /* reg points to bpf_flow_keys */ PTR_TO_FLOW_KEYS, /* reg points to bpf_flow_keys */
PTR_TO_SOCKET, /* reg points to struct bpf_sock */ PTR_TO_SOCKET, /* reg points to struct bpf_sock */
PTR_TO_SOCKET_OR_NULL, /* reg points to struct bpf_sock or NULL */ PTR_TO_SOCKET_OR_NULL, /* reg points to struct bpf_sock or NULL */
...@@ -221,6 +222,7 @@ enum bpf_reg_type { ...@@ -221,6 +222,7 @@ enum bpf_reg_type {
PTR_TO_TCP_SOCK, /* reg points to struct tcp_sock */ 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_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 */ PTR_TO_TP_BUFFER, /* reg points to a writable raw tp's buffer */
#endif
}; };
/* The information passed from prog-specific *_is_valid_access /* The information passed from prog-specific *_is_valid_access
...@@ -284,7 +286,10 @@ struct bpf_prog_aux { ...@@ -284,7 +286,10 @@ struct bpf_prog_aux {
atomic_t refcnt; atomic_t refcnt;
u32 used_map_cnt; u32 used_map_cnt;
u32 max_ctx_offset; u32 max_ctx_offset;
/* not protected by KABI, safe to extend in the middle */
#ifndef __GENKSYMS__
u32 max_tp_access; u32 max_tp_access;
#endif
u32 stack_depth; u32 stack_depth;
u32 id; u32 id;
u32 func_cnt; u32 func_cnt;
......
...@@ -45,7 +45,9 @@ struct bpf_raw_event_map { ...@@ -45,7 +45,9 @@ struct bpf_raw_event_map {
struct tracepoint *tp; struct tracepoint *tp;
void *bpf_func; void *bpf_func;
u32 num_args; u32 num_args;
#ifndef __GENKSYMS__
u32 writable_size; u32 writable_size;
#endif
} __aligned(32); } __aligned(32);
#endif #endif
...@@ -153,9 +153,11 @@ enum bpf_prog_type { ...@@ -153,9 +153,11 @@ enum bpf_prog_type {
BPF_PROG_TYPE_LWT_SEG6LOCAL, BPF_PROG_TYPE_LWT_SEG6LOCAL,
BPF_PROG_TYPE_LIRC_MODE2, BPF_PROG_TYPE_LIRC_MODE2,
BPF_PROG_TYPE_SK_REUSEPORT, BPF_PROG_TYPE_SK_REUSEPORT,
#ifndef __GENKSYMS__
BPF_PROG_TYPE_FLOW_DISSECTOR, BPF_PROG_TYPE_FLOW_DISSECTOR,
BPF_PROG_TYPE_CGROUP_SYSCTL, BPF_PROG_TYPE_CGROUP_SYSCTL,
BPF_PROG_TYPE_RAW_TRACEPOINT_WRITABLE, BPF_PROG_TYPE_RAW_TRACEPOINT_WRITABLE,
#endif
}; };
enum bpf_attach_type { enum bpf_attach_type {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册