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 8ffe686f83
commit e2e99104b3
5 changed files with 69 additions and 0 deletions

View File

@@ -3,6 +3,7 @@
#define _IPV6_H
#include <uapi/linux/ipv6.h>
#include <linux/android_kabi.h>
#define ipv6_optlen(p) (((p)->hdrlen+1) << 3)
#define ipv6_authlen(p) (((p)->hdrlen+2) << 2)
@@ -82,6 +83,11 @@ struct ipv6_devconf {
__u8 ioam6_enabled;
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 {

View File

@@ -23,6 +23,7 @@
#include <linux/fs.h>
#include <linux/mm.h>
#include <linux/sockptr.h>
#include <linux/android_kabi.h>
#include <uapi/linux/net.h>
@@ -200,6 +201,11 @@ struct proto_ops {
int (*sendmsg_locked)(struct sock *sk, struct msghdr *msg,
size_t size);
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) \

View File

@@ -48,6 +48,7 @@
#include <uapi/linux/pkt_cls.h>
#include <linux/hashtable.h>
#include <linux/rbtree.h>
#include <linux/android_kabi.h>
struct netpoll_info;
struct device;
@@ -283,6 +284,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);
ANDROID_KABI_RESERVE(1);
ANDROID_KABI_RESERVE(2);
};
/* These flag bits are private to the generic network queueing
@@ -341,6 +345,11 @@ struct napi_struct {
struct hlist_node napi_hash_node;
unsigned int napi_id;
struct task_struct *thread;
ANDROID_KABI_RESERVE(1);
ANDROID_KABI_RESERVE(2);
ANDROID_KABI_RESERVE(3);
ANDROID_KABI_RESERVE(4);
};
enum {
@@ -614,6 +623,11 @@ struct netdev_queue {
#ifdef CONFIG_BQL
struct dql dql;
#endif
ANDROID_KABI_RESERVE(1);
ANDROID_KABI_RESERVE(2);
ANDROID_KABI_RESERVE(3);
ANDROID_KABI_RESERVE(4);
} ____cacheline_aligned_in_smp;
extern int sysctl_fb_tunnels_only_for_init_net;
@@ -737,6 +751,11 @@ struct netdev_rx_queue {
#ifdef CONFIG_XDP_SOCKETS
struct xsk_buff_pool *pool;
#endif
ANDROID_KABI_RESERVE(1);
ANDROID_KABI_RESERVE(2);
ANDROID_KABI_RESERVE(3);
ANDROID_KABI_RESERVE(4);
} ____cacheline_aligned_in_smp;
/*
@@ -988,6 +1007,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);
ANDROID_KABI_RESERVE(1);
ANDROID_KABI_RESERVE(2);
ANDROID_KABI_RESERVE(3);
ANDROID_KABI_RESERVE(4);
};
#endif
@@ -1563,6 +1587,15 @@ struct net_device_ops {
struct net_device * (*ndo_get_peer_dev)(struct net_device *dev);
int (*ndo_fill_forward_path)(struct net_device_path_ctx *ctx,
struct net_device_path *path);
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);
};
/**
@@ -2266,6 +2299,15 @@ struct net_device {
/* protected by rtnl_lock */
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)
@@ -2639,6 +2681,11 @@ struct packet_type {
struct net *af_packet_net;
void *af_packet_priv;
struct list_head list;
ANDROID_KABI_RESERVE(1);
ANDROID_KABI_RESERVE(2);
ANDROID_KABI_RESERVE(3);
ANDROID_KABI_RESERVE(4);
};
struct offload_callbacks {

View File

@@ -933,6 +933,9 @@ struct sk_buff {
__u32 headers_end[0];
/* public: */
ANDROID_KABI_RESERVE(1);
ANDROID_KABI_RESERVE(2);
/* These elements must be at the end, see alloc_skb() for details. */
sk_buff_data_t tail;
sk_buff_data_t end;

View File

@@ -43,6 +43,7 @@
#include <linux/mutex.h>
#include <linux/netdevice.h>
#include <linux/rcupdate.h>
#include <linux/android_kabi.h>
#include <net/net_namespace.h>
#include <net/tcp.h>
@@ -303,6 +304,12 @@ struct tlsdev_ops {
int (*tls_dev_resync)(struct net_device *netdev,
struct sock *sk, u32 seq, u8 *rcd_sn,
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 {