提交 f13098db 编写于 作者: W Wang Hai 提交者: Zheng Zengkai

kabi: net: reserve space for net base subsystem related structure

hulk inclusion
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I4HE7P?from=project-issue
CVE: NA

--------

Reserve some fields beforehand for net base framework related structures prone
to change.

---------
Signed-off-by: NWang Hai <wanghai38@huawei.com>
Reviewed-by: NWei Yongjun <weiyongjun1@huawei.com>
Reviewed-by: NYue Haibing <yuehaibing@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 75711e28
......@@ -30,6 +30,7 @@
#include <linux/device/bus.h>
#include <linux/device/class.h>
#include <linux/device/driver.h>
#include <linux/kabi.h>
#include <asm/device.h>
struct device;
......@@ -558,6 +559,15 @@ struct device {
#ifdef CONFIG_DMA_OPS_BYPASS
bool dma_ops_bypass : 1;
#endif
KABI_RESERVE(1)
KABI_RESERVE(2)
KABI_RESERVE(3)
KABI_RESERVE(4)
KABI_RESERVE(5)
KABI_RESERVE(6)
KABI_RESERVE(7)
KABI_RESERVE(8)
};
/**
......
......@@ -18,6 +18,7 @@
#include <linux/klist.h>
#include <linux/pm.h>
#include <linux/device/bus.h>
#include <linux/kabi.h>
struct device;
struct fwnode_handle;
......@@ -75,6 +76,11 @@ struct class {
const struct dev_pm_ops *pm;
struct subsys_private *p;
KABI_RESERVE(1)
KABI_RESERVE(2)
KABI_RESERVE(3)
KABI_RESERVE(4)
};
struct class_dev_iter {
......
......@@ -17,6 +17,7 @@
#include <linux/compat.h>
#include <linux/netlink.h>
#include <uapi/linux/ethtool.h>
#include <linux/kabi.h>
struct compat_ethtool_rx_flow_spec {
u32 flow_type;
......@@ -544,6 +545,11 @@ struct ethtool_ops {
const struct ethtool_tunable *, void *);
int (*set_phy_tunable)(struct net_device *,
const struct ethtool_tunable *, const void *);
KABI_RESERVE(1)
KABI_RESERVE(2)
KABI_RESERVE(3)
KABI_RESERVE(4)
};
int ethtool_check_ops(const struct ethtool_ops *ops);
......
......@@ -3,6 +3,7 @@
#define _IPV6_H
#include <uapi/linux/ipv6.h>
#include <linux/kabi.h>
#define ipv6_optlen(p) (((p)->hdrlen+1) << 3)
#define ipv6_authlen(p) (((p)->hdrlen+2) << 2)
......@@ -77,6 +78,11 @@ struct ipv6_devconf {
__s32 rpl_seg_enabled;
struct ctl_table_header *sysctl_header;
KABI_RESERVE(1)
KABI_RESERVE(2)
KABI_RESERVE(3)
KABI_RESERVE(4)
};
struct ipv6_params {
......
......@@ -25,6 +25,7 @@
#include <linux/sockptr.h>
#include <uapi/linux/net.h>
#include <linux/kabi.h>
struct poll_table_struct;
struct pipe_inode_info;
......@@ -203,6 +204,11 @@ struct proto_ops {
int (*sendmsg_locked)(struct sock *sk, struct msghdr *msg,
size_t size);
int (*set_rcvlowat)(struct sock *sk, int val);
KABI_RESERVE(1)
KABI_RESERVE(2)
KABI_RESERVE(3)
KABI_RESERVE(4)
};
#define DECLARE_SOCKADDR(type, dst, src) \
......
......@@ -48,6 +48,7 @@
#include <uapi/linux/if_bonding.h>
#include <uapi/linux/pkt_cls.h>
#include <linux/hashtable.h>
#include <linux/kabi.h>
struct netpoll_info;
struct device;
......@@ -278,6 +279,9 @@ struct header_ops {
const unsigned char *haddr);
bool (*validate)(const char *ll_header, unsigned int len);
__be16 (*parse_protocol)(const struct sk_buff *skb);
KABI_RESERVE(1)
KABI_RESERVE(2)
};
/* These flag bits are private to the generic network queueing
......@@ -347,6 +351,11 @@ struct napi_struct {
struct list_head dev_list;
struct hlist_node napi_hash_node;
unsigned int napi_id;
KABI_RESERVE(1)
KABI_RESERVE(2)
KABI_RESERVE(3)
KABI_RESERVE(4)
};
enum {
......@@ -621,6 +630,11 @@ struct netdev_queue {
#ifdef CONFIG_BQL
struct dql dql;
#endif
KABI_RESERVE(1)
KABI_RESERVE(2)
KABI_RESERVE(3)
KABI_RESERVE(4)
} ____cacheline_aligned_in_smp;
extern int sysctl_fb_tunnels_only_for_init_net;
......@@ -744,6 +758,11 @@ struct netdev_rx_queue {
#ifdef CONFIG_XDP_SOCKETS
struct xsk_buff_pool *pool;
#endif
KABI_RESERVE(1)
KABI_RESERVE(2)
KABI_RESERVE(3)
KABI_RESERVE(4)
} ____cacheline_aligned_in_smp;
/*
......@@ -924,6 +943,11 @@ struct xfrmdev_ops {
bool (*xdo_dev_offload_ok) (struct sk_buff *skb,
struct xfrm_state *x);
void (*xdo_dev_state_advance_esn) (struct xfrm_state *x);
KABI_RESERVE(1)
KABI_RESERVE(2)
KABI_RESERVE(3)
KABI_RESERVE(4)
};
#endif
......@@ -1487,6 +1511,15 @@ struct net_device_ops {
int (*ndo_tunnel_ctl)(struct net_device *dev,
struct ip_tunnel_parm *p, int cmd);
struct net_device * (*ndo_get_peer_dev)(struct net_device *dev);
KABI_RESERVE(1)
KABI_RESERVE(2)
KABI_RESERVE(3)
KABI_RESERVE(4)
KABI_RESERVE(5)
KABI_RESERVE(6)
KABI_RESERVE(7)
KABI_RESERVE(8)
};
/**
......@@ -2173,6 +2206,15 @@ struct net_device {
/* protected by rtnl_lock */
struct bpf_xdp_entity xdp_state[__MAX_XDP_MODE];
KABI_RESERVE(1)
KABI_RESERVE(2)
KABI_RESERVE(3)
KABI_RESERVE(4)
KABI_RESERVE(5)
KABI_RESERVE(6)
KABI_RESERVE(7)
KABI_RESERVE(8)
};
#define to_net_dev(d) container_of(d, struct net_device, dev)
......@@ -2545,6 +2587,11 @@ struct packet_type {
struct sock *sk);
void *af_packet_priv;
struct list_head list;
KABI_RESERVE(1)
KABI_RESERVE(2)
KABI_RESERVE(3)
KABI_RESERVE(4)
};
struct offload_callbacks {
......
......@@ -38,6 +38,7 @@
#include <linux/if_packet.h>
#include <net/flow.h>
#include <net/page_pool.h>
#include <linux/kabi.h>
#if IS_ENABLED(CONFIG_NF_CONNTRACK)
#include <linux/netfilter/nf_conntrack_common.h>
#endif
......@@ -913,6 +914,11 @@ struct sk_buff {
__u32 headers_end[0];
/* public: */
KABI_RESERVE(1)
KABI_RESERVE(2)
KABI_RESERVE(3)
KABI_RESERVE(4)
/* These elements must be at the end, see alloc_skb() for details. */
sk_buff_data_t tail;
sk_buff_data_t end;
......
......@@ -107,6 +107,15 @@ struct dcbnl_rtnl_ops {
/* buffer settings */
int (*dcbnl_getbuffer)(struct net_device *, struct dcbnl_buffer *);
int (*dcbnl_setbuffer)(struct net_device *, struct dcbnl_buffer *);
KABI_RESERVE(1)
KABI_RESERVE(2)
KABI_RESERVE(3)
KABI_RESERVE(4)
KABI_RESERVE(5)
KABI_RESERVE(6)
KABI_RESERVE(7)
KABI_RESERVE(8)
};
#endif /* __NET_DCBNL_H__ */
......@@ -18,6 +18,7 @@
#include <linux/refcount.h>
#include <net/neighbour.h>
#include <asm/processor.h>
#include <linux/kabi.h>
struct sk_buff;
......@@ -76,6 +77,15 @@ struct dst_entry {
#ifndef CONFIG_64BIT
atomic_t __refcnt; /* 32-bit offset 64 */
#endif
KABI_RESERVE(1)
KABI_RESERVE(2)
KABI_RESERVE(3)
KABI_RESERVE(4)
KABI_RESERVE(5)
KABI_RESERVE(6)
KABI_RESERVE(7)
KABI_RESERVE(8)
};
struct dst_metrics {
......
......@@ -4,6 +4,7 @@
#include <linux/types.h>
#include <linux/percpu_counter.h>
#include <linux/cache.h>
#include <linux/kabi.h>
struct dst_entry;
struct kmem_cachep;
......@@ -41,6 +42,15 @@ struct dst_ops {
struct kmem_cache *kmem_cachep;
struct percpu_counter pcpuc_entries ____cacheline_aligned_in_smp;
KABI_RESERVE(1)
KABI_RESERVE(2)
KABI_RESERVE(3)
KABI_RESERVE(4)
KABI_RESERVE(5)
KABI_RESERVE(6)
KABI_RESERVE(7)
KABI_RESERVE(8)
};
static inline int dst_entries_get_fast(struct dst_ops *dst)
......
......@@ -11,6 +11,7 @@
#include <net/rtnetlink.h>
#include <net/fib_notifier.h>
#include <linux/indirect_call_wrapper.h>
#include <linux/kabi.h>
struct fib_kuid_range {
kuid_t start;
......@@ -44,6 +45,15 @@ struct fib_rule {
struct fib_rule_port_range sport_range;
struct fib_rule_port_range dport_range;
struct rcu_head rcu;
KABI_RESERVE(1)
KABI_RESERVE(2)
KABI_RESERVE(3)
KABI_RESERVE(4)
KABI_RESERVE(5)
KABI_RESERVE(6)
KABI_RESERVE(7)
KABI_RESERVE(8)
};
struct fib_lookup_arg {
......
......@@ -13,6 +13,7 @@
#include <linux/atomic.h>
#include <net/flow_dissector.h>
#include <linux/uidgid.h>
#include <linux/kabi.h>
/*
* ifindex generation is per-net namespace, and loopback is
......@@ -41,6 +42,9 @@ struct flowi_common {
kuid_t flowic_uid;
struct flowi_tunnel flowic_tun_key;
__u32 flowic_multipath_hash;
KABI_RESERVE(1)
KABI_RESERVE(2)
};
union flowi_uli {
......@@ -93,6 +97,9 @@ struct flowi4 {
#define fl4_ipsec_spi uli.spi
#define fl4_mh_type uli.mht.type
#define fl4_gre_key uli.gre_key
KABI_RESERVE(1)
KABI_RESERVE(2)
} __attribute__((__aligned__(BITS_PER_LONG/8)));
static inline void flowi4_init_output(struct flowi4 *fl4, int oif,
......@@ -169,6 +176,9 @@ struct flowidn {
union flowi_uli uli;
#define fld_sport uli.ports.sport
#define fld_dport uli.ports.dport
KABI_RESERVE(1)
KABI_RESERVE(2)
} __attribute__((__aligned__(BITS_PER_LONG/8)));
struct flowi {
......
......@@ -5,6 +5,7 @@
#include <linux/genetlink.h>
#include <net/netlink.h>
#include <net/net_namespace.h>
#include <linux/kabi.h>
#define GENLMSG_DEFAULT_SIZE (NLMSG_DEFAULT_SIZE - GENL_HDRLEN)
......@@ -67,6 +68,8 @@ struct genl_family {
const struct genl_small_ops *small_ops;
const struct genl_multicast_group *mcgrps;
struct module *module;
KABI_RESERVE(1)
};
/**
......@@ -91,6 +94,8 @@ struct genl_info {
possible_net_t _net;
void * user_ptr[2];
struct netlink_ext_ack *extack;
KABI_RESERVE(1)
};
static inline struct net *genl_info_net(struct genl_info *info)
......@@ -158,6 +163,11 @@ struct genl_ops {
u8 internal_flags;
u8 flags;
u8 validate;
KABI_RESERVE(1)
KABI_RESERVE(2)
KABI_RESERVE(3)
KABI_RESERVE(4)
};
/**
......
......@@ -20,6 +20,7 @@
#include <net/inet_sock.h>
#include <net/request_sock.h>
#include <linux/kabi.h>
/* Cancel timers, when they are not required. */
#undef INET_CSK_CLEAR_TIMERS
......@@ -51,6 +52,8 @@ struct inet_connection_sock_af_ops {
char __user *optval, int __user *optlen);
void (*addr2sockaddr)(struct sock *sk, struct sockaddr *);
void (*mtu_reduced)(struct sock *sk);
KABI_RESERVE(1)
};
/** inet_connection_sock - INET connection oriented sock
......@@ -134,6 +137,8 @@ struct inet_connection_sock {
u32 icsk_probes_tstamp;
u32 icsk_user_timeout;
KABI_RESERVE(1)
u64 icsk_ca_priv[104 / sizeof(u64)];
#define ICSK_CA_PRIV_SIZE (13 * sizeof(u64))
};
......
......@@ -67,6 +67,8 @@ struct fib6_config {
struct nlattr *fc_encap;
u16 fc_encap_type;
bool fc_is_fdb;
KABI_RESERVE(1)
};
struct fib6_node {
......@@ -83,6 +85,8 @@ struct fib6_node {
int fn_sernum;
struct fib6_info __rcu *rr_ptr;
struct rcu_head rcu;
KABI_RESERVE(1)
};
struct fib6_gc_args {
......@@ -199,6 +203,9 @@ struct fib6_info {
struct rcu_head rcu;
struct nexthop *nh;
KABI_RESERVE(1)
struct fib6_nh fib6_nh[];
};
......@@ -218,6 +225,8 @@ struct rt6_info {
/* more non-fragment space at head required */
unsigned short rt6i_nfheader_len;
KABI_RESERVE(1)
};
struct fib6_result {
......
......@@ -9,6 +9,7 @@
#include <net/dst.h>
#include <net/fib_rules.h>
#include <linux/kabi.h>
enum l3mdev_type {
L3MDEV_TYPE_UNSPEC,
......@@ -43,6 +44,11 @@ struct l3mdev_ops {
/* IPv6 ops */
struct dst_entry * (*l3mdev_link_scope_lookup)(const struct net_device *dev,
struct flowi6 *fl6);
KABI_RESERVE(1)
KABI_RESERVE(2)
KABI_RESERVE(3)
KABI_RESERVE(4)
};
#ifdef CONFIG_NET_L3_MASTER_DEV
......
......@@ -7,6 +7,7 @@
#include <linux/skbuff.h>
#include <linux/types.h>
#include <net/route.h>
#include <linux/kabi.h>
#define LWTUNNEL_HASH_BITS 7
#define LWTUNNEL_HASH_SIZE (1 << LWTUNNEL_HASH_BITS)
......@@ -30,6 +31,12 @@ struct lwtunnel_state {
int (*orig_output)(struct net *net, struct sock *sk, struct sk_buff *skb);
int (*orig_input)(struct sk_buff *);
struct rcu_head rcu;
KABI_RESERVE(1)
KABI_RESERVE(2)
KABI_RESERVE(3)
KABI_RESERVE(4)
__u8 data[];
};
......
......@@ -29,6 +29,7 @@
#include <linux/sysctl.h>
#include <linux/workqueue.h>
#include <net/rtnetlink.h>
#include <linux/kabi.h>
/*
* NUD stands for "neighbor unreachability detection"
......@@ -83,6 +84,8 @@ struct neigh_parms {
int reachable_time;
int data[NEIGH_VAR_DATA_MAX];
DECLARE_BITMAP(data_state, NEIGH_VAR_DATA_MAX);
KABI_RESERVE(1)
};
static inline void neigh_var_set(struct neigh_parms *p, int index, int val)
......@@ -157,6 +160,9 @@ struct neighbour {
struct list_head gc_list;
struct rcu_head rcu;
struct net_device *dev;
KABI_RESERVE(1)
u8 primary_key[0];
} __randomize_layout;
......@@ -226,6 +232,8 @@ struct neigh_table {
struct neigh_statistics __percpu *stats;
struct neigh_hash_table __rcu *nht;
struct pneigh_entry **phash_buckets;
KABI_RESERVE(1)
};
enum {
......
......@@ -6,6 +6,7 @@
#include <linux/netlink.h>
#include <linux/jiffies.h>
#include <linux/in6.h>
#include <linux/kabi.h>
/* ========================================================================
* Netlink Messages and Attributes Interface (As Seen On TV)
......@@ -348,6 +349,10 @@ struct nla_policy {
*/
u16 strict_start_type;
};
KABI_RESERVE(1)
KABI_RESERVE(2)
KABI_RESERVE(3)
};
#define NLA_POLICY_ETH_ADDR NLA_POLICY_EXACT_LEN(ETH_ALEN)
......
......@@ -10,6 +10,7 @@
#include <net/inet_frag.h>
#include <linux/rcupdate.h>
#include <linux/siphash.h>
#include <linux/kabi.h>
struct tcpm_hash_bucket;
struct ctl_table_header;
......@@ -227,5 +228,12 @@ struct netns_ipv4 {
atomic_t rt_genid;
siphash_key_t ip_id_key;
KABI_RESERVE(1)
KABI_RESERVE(2)
KABI_RESERVE(3)
KABI_RESERVE(4)
KABI_RESERVE(5)
KABI_RESERVE(6)
};
#endif
......@@ -9,6 +9,7 @@
#define __NETNS_IPV6_H__
#include <net/dst_ops.h>
#include <uapi/linux/icmpv6.h>
#include <linux/kabi.h>
struct ctl_table_header;
......@@ -115,6 +116,8 @@ struct netns_ipv6 {
spinlock_t lock;
u32 seq;
} ip6addrlbl_table;
KABI_RESERVE(1)
};
#if IS_ENABLED(CONFIG_NF_DEFRAG_IPV6)
......
......@@ -3,6 +3,7 @@
#define _NETNS_NFTABLES_H_
#include <linux/list.h>
#include <linux/kabi.h>
struct netns_nftables {
struct list_head tables;
......@@ -13,6 +14,8 @@ struct netns_nftables {
unsigned int base_seq;
u8 gencursor;
u8 validate_state;
KABI_RESERVE(1)
};
#endif
......@@ -8,6 +8,7 @@
#include <linux/rhashtable-types.h>
#include <linux/xfrm.h>
#include <net/dst_ops.h>
#include <linux/kabi.h>
struct ctl_table_header;
......@@ -78,6 +79,8 @@ struct netns_xfrm {
spinlock_t xfrm_policy_lock;
struct mutex xfrm_cfg_mutex;
KABI_RESERVE(1)
};
#endif
......@@ -33,6 +33,7 @@
#include <linux/mm.h> /* Needed by ptr_ring */
#include <linux/ptr_ring.h>
#include <linux/dma-direction.h>
#include <linux/kabi.h>
#define PP_FLAG_DMA_MAP BIT(0) /* Should page_pool do the DMA
* map/unmap
......@@ -132,6 +133,8 @@ struct page_pool {
refcount_t user_cnt;
u64 destroy_cnt;
KABI_RESERVE(1)
};
struct page *page_pool_alloc_pages(struct page_pool *pool, gfp_t gfp);
......
......@@ -4,6 +4,7 @@
#include <linux/rtnetlink.h>
#include <net/netlink.h>
#include <linux/kabi.h>
typedef int (*rtnl_doit_func)(struct sk_buff *, struct nlmsghdr *,
struct netlink_ext_ack *);
......@@ -112,6 +113,15 @@ struct rtnl_link_ops {
int (*fill_linkxstats)(struct sk_buff *skb,
const struct net_device *dev,
int *prividx, int attr);
KABI_RESERVE(1)
KABI_RESERVE(2)
KABI_RESERVE(3)
KABI_RESERVE(4)
KABI_RESERVE(5)
KABI_RESERVE(6)
KABI_RESERVE(7)
KABI_RESERVE(8)
};
int __rtnl_link_register(struct rtnl_link_ops *ops);
......
......@@ -19,6 +19,7 @@
#include <net/gen_stats.h>
#include <net/rtnetlink.h>
#include <net/flow_offload.h>
#include <linux/kabi.h>
struct Qdisc_ops;
struct qdisc_walker;
......@@ -114,6 +115,8 @@ struct Qdisc {
bool empty;
struct rcu_head rcu;
KABI_RESERVE(1)
/* private data */
long privdata[] ____cacheline_aligned;
};
......@@ -271,6 +274,8 @@ struct Qdisc_class_ops {
struct sk_buff *skb, struct tcmsg*);
int (*dump_stats)(struct Qdisc *, unsigned long,
struct gnet_dump *);
KABI_RESERVE(1)
};
/* Qdisc_class_ops flag values */
......@@ -316,6 +321,8 @@ struct Qdisc_ops {
u32 (*egress_block_get)(struct Qdisc *sch);
struct module *owner;
KABI_RESERVE(1)
};
......
......@@ -68,6 +68,7 @@
#include <net/tcp_states.h>
#include <linux/net_tstamp.h>
#include <net/l3mdev.h>
#include <linux/kabi.h>
/*
* This structure really needs to be cleaned up.
......@@ -522,6 +523,15 @@ struct sock {
struct bpf_local_storage __rcu *sk_bpf_storage;
#endif
struct rcu_head sk_rcu;
KABI_RESERVE(1)
KABI_RESERVE(2)
KABI_RESERVE(3)
KABI_RESERVE(4)
KABI_RESERVE(5)
KABI_RESERVE(6)
KABI_RESERVE(7)
KABI_RESERVE(8)
};
enum sk_pacing {
......@@ -1235,6 +1245,15 @@ struct proto {
atomic_t socks;
#endif
int (*diag_destroy)(struct sock *sk, int err);
KABI_RESERVE(1)
KABI_RESERVE(2)
KABI_RESERVE(3)
KABI_RESERVE(4)
KABI_RESERVE(5)
KABI_RESERVE(6)
KABI_RESERVE(7)
KABI_RESERVE(8)
} __randomize_layout;
int proto_register(struct proto *prot, int alloc_slab);
......
......@@ -11,6 +11,7 @@
#include <linux/notifier.h>
#include <linux/list.h>
#include <net/ip_fib.h>
#include <linux/kabi.h>
#define SWITCHDEV_F_NO_RECURSE BIT(0)
#define SWITCHDEV_F_SKIP_EOPNOTSUPP BIT(1)
......@@ -87,6 +88,11 @@ struct switchdev_obj {
u32 flags;
void *complete_priv;
void (*complete)(struct net_device *dev, int err, void *priv);
KABI_RESERVE(1)
KABI_RESERVE(2)
KABI_RESERVE(3)
KABI_RESERVE(4)
};
/* SWITCHDEV_OBJ_ID_PORT_VLAN */
......
......@@ -214,6 +214,11 @@ enum tls_context_flags {
struct cipher_context {
char *iv;
char *rec_seq;
KABI_RESERVE(1)
KABI_RESERVE(2)
KABI_RESERVE(3)
KABI_RESERVE(4)
};
union tls_crypto_context {
......
......@@ -27,6 +27,7 @@
#include <net/gro_cells.h>
#include <linux/interrupt.h>
#include <linux/kabi.h>
#ifdef CONFIG_XFRM_STATISTICS
#include <net/snmp.h>
......@@ -132,6 +133,11 @@ struct xfrm_state_offload {
unsigned long offload_handle;
unsigned int num_exthdrs;
u8 flags;
KABI_RESERVE(1)
KABI_RESERVE(2)
KABI_RESERVE(3)
KABI_RESERVE(4)
};
struct xfrm_mode {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册