ANDROID: GKI: networking: add Android ABI padding to a lot of networking structures

Try to mitigate potential future driver core api changes by adding a
padding to a lot of different networking structures:
	struct ipv6_devconf
	struct proto_ops
	struct header_ops
	struct napi_struct
	struct netdev_queue
	struct netdev_rx_queue
	struct xfrmdev_ops
	struct net_device_ops
	struct net_device
	struct packet_type
	struct sk_buff
	struct tlsdev_ops

Based on a change made to the RHEL/CENTOS 8 kernel.

Bug: 151154716
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I590f004754dbc8beafa40e71cac70a0938c38b4a
This commit is contained in:
Greg Kroah-Hartman
2020-05-02 09:32:22 +02:00
parent f0688df6b5
commit 73ff58b01f
5 changed files with 70 additions and 0 deletions

View File

@@ -3,6 +3,7 @@
#define _IPV6_H #define _IPV6_H
#include <uapi/linux/ipv6.h> #include <uapi/linux/ipv6.h>
#include <linux/android_kabi.h>
#define ipv6_optlen(p) (((p)->hdrlen+1) << 3) #define ipv6_optlen(p) (((p)->hdrlen+1) << 3)
#define ipv6_authlen(p) (((p)->hdrlen+2) << 2) #define ipv6_authlen(p) (((p)->hdrlen+2) << 2)
@@ -78,6 +79,11 @@ struct ipv6_devconf {
__s32 rpl_seg_enabled; __s32 rpl_seg_enabled;
struct ctl_table_header *sysctl_header; struct ctl_table_header *sysctl_header;
ANDROID_KABI_RESERVE(1);
ANDROID_KABI_RESERVE(2);
ANDROID_KABI_RESERVE(3);
ANDROID_KABI_RESERVE(4);
}; };
struct ipv6_params { struct ipv6_params {

View File

@@ -23,6 +23,7 @@
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/sockptr.h> #include <linux/sockptr.h>
#include <linux/android_kabi.h>
#include <uapi/linux/net.h> #include <uapi/linux/net.h>
@@ -203,6 +204,11 @@ struct proto_ops {
int (*sendmsg_locked)(struct sock *sk, struct msghdr *msg, int (*sendmsg_locked)(struct sock *sk, struct msghdr *msg,
size_t size); size_t size);
int (*set_rcvlowat)(struct sock *sk, int val); int (*set_rcvlowat)(struct sock *sk, int val);
ANDROID_KABI_RESERVE(1);
ANDROID_KABI_RESERVE(2);
ANDROID_KABI_RESERVE(3);
ANDROID_KABI_RESERVE(4);
}; };
#define DECLARE_SOCKADDR(type, dst, src) \ #define DECLARE_SOCKADDR(type, dst, src) \

View File

@@ -48,6 +48,7 @@
#include <uapi/linux/if_bonding.h> #include <uapi/linux/if_bonding.h>
#include <uapi/linux/pkt_cls.h> #include <uapi/linux/pkt_cls.h>
#include <linux/hashtable.h> #include <linux/hashtable.h>
#include <linux/android_kabi.h>
struct netpoll_info; struct netpoll_info;
struct device; struct device;
@@ -278,6 +279,9 @@ struct header_ops {
const unsigned char *haddr); const unsigned char *haddr);
bool (*validate)(const char *ll_header, unsigned int len); bool (*validate)(const char *ll_header, unsigned int len);
__be16 (*parse_protocol)(const struct sk_buff *skb); __be16 (*parse_protocol)(const struct sk_buff *skb);
ANDROID_KABI_RESERVE(1);
ANDROID_KABI_RESERVE(2);
}; };
/* These flag bits are private to the generic network queueing /* These flag bits are private to the generic network queueing
@@ -347,6 +351,11 @@ struct napi_struct {
struct list_head dev_list; struct list_head dev_list;
struct hlist_node napi_hash_node; struct hlist_node napi_hash_node;
unsigned int napi_id; unsigned int napi_id;
ANDROID_KABI_RESERVE(1);
ANDROID_KABI_RESERVE(2);
ANDROID_KABI_RESERVE(3);
ANDROID_KABI_RESERVE(4);
}; };
enum { enum {
@@ -621,6 +630,11 @@ struct netdev_queue {
#ifdef CONFIG_BQL #ifdef CONFIG_BQL
struct dql dql; struct dql dql;
#endif #endif
ANDROID_KABI_RESERVE(1);
ANDROID_KABI_RESERVE(2);
ANDROID_KABI_RESERVE(3);
ANDROID_KABI_RESERVE(4);
} ____cacheline_aligned_in_smp; } ____cacheline_aligned_in_smp;
extern int sysctl_fb_tunnels_only_for_init_net; extern int sysctl_fb_tunnels_only_for_init_net;
@@ -744,6 +758,11 @@ struct netdev_rx_queue {
#ifdef CONFIG_XDP_SOCKETS #ifdef CONFIG_XDP_SOCKETS
struct xsk_buff_pool *pool; struct xsk_buff_pool *pool;
#endif #endif
ANDROID_KABI_RESERVE(1);
ANDROID_KABI_RESERVE(2);
ANDROID_KABI_RESERVE(3);
ANDROID_KABI_RESERVE(4);
} ____cacheline_aligned_in_smp; } ____cacheline_aligned_in_smp;
/* /*
@@ -924,6 +943,11 @@ struct xfrmdev_ops {
bool (*xdo_dev_offload_ok) (struct sk_buff *skb, bool (*xdo_dev_offload_ok) (struct sk_buff *skb,
struct xfrm_state *x); struct xfrm_state *x);
void (*xdo_dev_state_advance_esn) (struct xfrm_state *x); void (*xdo_dev_state_advance_esn) (struct xfrm_state *x);
ANDROID_KABI_RESERVE(1);
ANDROID_KABI_RESERVE(2);
ANDROID_KABI_RESERVE(3);
ANDROID_KABI_RESERVE(4);
}; };
#endif #endif
@@ -1487,6 +1511,15 @@ struct net_device_ops {
int (*ndo_tunnel_ctl)(struct net_device *dev, int (*ndo_tunnel_ctl)(struct net_device *dev,
struct ip_tunnel_parm *p, int cmd); struct ip_tunnel_parm *p, int cmd);
struct net_device * (*ndo_get_peer_dev)(struct net_device *dev); struct net_device * (*ndo_get_peer_dev)(struct net_device *dev);
ANDROID_KABI_RESERVE(1);
ANDROID_KABI_RESERVE(2);
ANDROID_KABI_RESERVE(3);
ANDROID_KABI_RESERVE(4);
ANDROID_KABI_RESERVE(5);
ANDROID_KABI_RESERVE(6);
ANDROID_KABI_RESERVE(7);
ANDROID_KABI_RESERVE(8);
}; };
/** /**
@@ -2164,6 +2197,15 @@ struct net_device {
/* protected by rtnl_lock */ /* protected by rtnl_lock */
struct bpf_xdp_entity xdp_state[__MAX_XDP_MODE]; struct bpf_xdp_entity xdp_state[__MAX_XDP_MODE];
ANDROID_KABI_RESERVE(1);
ANDROID_KABI_RESERVE(2);
ANDROID_KABI_RESERVE(3);
ANDROID_KABI_RESERVE(4);
ANDROID_KABI_RESERVE(5);
ANDROID_KABI_RESERVE(6);
ANDROID_KABI_RESERVE(7);
ANDROID_KABI_RESERVE(8);
}; };
#define to_net_dev(d) container_of(d, struct net_device, dev) #define to_net_dev(d) container_of(d, struct net_device, dev)
@@ -2513,6 +2555,11 @@ struct packet_type {
struct sock *sk); struct sock *sk);
void *af_packet_priv; void *af_packet_priv;
struct list_head list; struct list_head list;
ANDROID_KABI_RESERVE(1);
ANDROID_KABI_RESERVE(2);
ANDROID_KABI_RESERVE(3);
ANDROID_KABI_RESERVE(4);
}; };
struct offload_callbacks { struct offload_callbacks {

View File

@@ -40,6 +40,7 @@
#if IS_ENABLED(CONFIG_NF_CONNTRACK) #if IS_ENABLED(CONFIG_NF_CONNTRACK)
#include <linux/netfilter/nf_conntrack_common.h> #include <linux/netfilter/nf_conntrack_common.h>
#endif #endif
#include <linux/android_kabi.h>
/* The interface for checksum offload between the stack and networking drivers /* The interface for checksum offload between the stack and networking drivers
* is as follows... * is as follows...
@@ -908,6 +909,9 @@ struct sk_buff {
__u32 headers_end[0]; __u32 headers_end[0];
/* public: */ /* public: */
ANDROID_KABI_RESERVE(1);
ANDROID_KABI_RESERVE(2);
/* These elements must be at the end, see alloc_skb() for details. */ /* These elements must be at the end, see alloc_skb() for details. */
sk_buff_data_t tail; sk_buff_data_t tail;
sk_buff_data_t end; sk_buff_data_t end;

View File

@@ -43,6 +43,7 @@
#include <linux/mutex.h> #include <linux/mutex.h>
#include <linux/netdevice.h> #include <linux/netdevice.h>
#include <linux/rcupdate.h> #include <linux/rcupdate.h>
#include <linux/android_kabi.h>
#include <net/net_namespace.h> #include <net/net_namespace.h>
#include <net/tcp.h> #include <net/tcp.h>
@@ -292,6 +293,12 @@ struct tlsdev_ops {
int (*tls_dev_resync)(struct net_device *netdev, int (*tls_dev_resync)(struct net_device *netdev,
struct sock *sk, u32 seq, u8 *rcd_sn, struct sock *sk, u32 seq, u8 *rcd_sn,
enum tls_offload_ctx_dir direction); enum tls_offload_ctx_dir direction);
ANDROID_KABI_RESERVE(1);
ANDROID_KABI_RESERVE(2);
ANDROID_KABI_RESERVE(3);
ANDROID_KABI_RESERVE(4);
}; };
enum tls_offload_sync_type { enum tls_offload_sync_type {