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
committed by Carlos Llamas
parent 8d09c29ee1
commit 608ed5cfb3
5 changed files with 69 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)
@@ -84,6 +85,11 @@ struct ipv6_devconf {
__u8 ndisc_evict_nocarrier; __u8 ndisc_evict_nocarrier;
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>
@@ -224,6 +225,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

@@ -51,6 +51,7 @@
#include <linux/rbtree.h> #include <linux/rbtree.h>
#include <net/net_trackers.h> #include <net/net_trackers.h>
#include <net/net_debug.h> #include <net/net_debug.h>
#include <linux/android_kabi.h>
struct netpoll_info; struct netpoll_info;
struct device; struct device;
@@ -311,6 +312,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
@@ -368,6 +372,11 @@ struct napi_struct {
struct hlist_node napi_hash_node; struct hlist_node napi_hash_node;
unsigned int napi_id; unsigned int napi_id;
struct task_struct *thread; struct task_struct *thread;
ANDROID_KABI_RESERVE(1);
ANDROID_KABI_RESERVE(2);
ANDROID_KABI_RESERVE(3);
ANDROID_KABI_RESERVE(4);
}; };
enum { enum {
@@ -643,6 +652,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;
@@ -782,6 +796,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;
/* /*
@@ -1042,6 +1061,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
@@ -1618,6 +1642,15 @@ struct net_device_ops {
ktime_t (*ndo_get_tstamp)(struct net_device *dev, ktime_t (*ndo_get_tstamp)(struct net_device *dev,
const struct skb_shared_hwtstamps *hwtstamps, const struct skb_shared_hwtstamps *hwtstamps,
bool cycles); bool cycles);
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);
}; };
/** /**
@@ -2366,6 +2399,15 @@ struct net_device {
netdevice_tracker watchdog_dev_tracker; netdevice_tracker watchdog_dev_tracker;
netdevice_tracker dev_registered_tracker; netdevice_tracker dev_registered_tracker;
struct rtnl_hw_stats64 *offload_xstats_l3; struct rtnl_hw_stats64 *offload_xstats_l3;
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)
@@ -2648,6 +2690,11 @@ struct packet_type {
struct net *af_packet_net; struct net *af_packet_net;
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

@@ -1040,6 +1040,9 @@ struct sk_buff {
u64 kcov_handle; u64 kcov_handle;
#endif #endif
ANDROID_KABI_RESERVE(1);
ANDROID_KABI_RESERVE(2);
); /* end headers group */ ); /* end headers group */
/* These elements must be at the end, see alloc_skb() for details. */ /* These elements must be at the end, see alloc_skb() for details. */

View File

@@ -42,6 +42,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>
@@ -298,6 +299,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 {