Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 89cded3a authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman
Browse files

ANDROID: GKI: fs.h: add Android ABI padding to some structures



Try to mitigate potential future driver core api changes by adding a
padding to a bunch of filesystem structures.

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

Bug: 151154716
Change-Id: Ida6d98d30f292c980ab07e0250fec5268c4c87ed
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@google.com>
parent ca466128
Loading
Loading
Loading
Loading
+54 −0
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@
#include <linux/uuid.h>
#include <linux/errseq.h>
#include <linux/ioprio.h>
#include <linux/android_kabi.h>

#include <asm/byteorder.h>
#include <uapi/linux/fs.h>
@@ -398,6 +399,11 @@ struct address_space_operations {
	int (*swap_activate)(struct swap_info_struct *sis, struct file *file,
				sector_t *span);
	void (*swap_deactivate)(struct file *file);

	ANDROID_KABI_RESERVE(1);
	ANDROID_KABI_RESERVE(2);
	ANDROID_KABI_RESERVE(3);
	ANDROID_KABI_RESERVE(4);
};

extern const struct address_space_operations empty_aops;
@@ -432,6 +438,11 @@ struct address_space {
	struct list_head	private_list;	/* for use by the address_space */
	void			*private_data;	/* ditto */
	errseq_t		wb_err;

	ANDROID_KABI_RESERVE(1);
	ANDROID_KABI_RESERVE(2);
	ANDROID_KABI_RESERVE(3);
	ANDROID_KABI_RESERVE(4);
} __attribute__((aligned(sizeof(long)))) __randomize_layout;
	/*
	 * On most architectures that alignment is already the case; but
@@ -476,6 +487,11 @@ struct block_device {
	int			bd_fsfreeze_count;
	/* Mutex for freeze */
	struct mutex		bd_fsfreeze_mutex;

	ANDROID_KABI_RESERVE(1);
	ANDROID_KABI_RESERVE(2);
	ANDROID_KABI_RESERVE(3);
	ANDROID_KABI_RESERVE(4);
} __randomize_layout;

/*
@@ -700,6 +716,9 @@ struct inode {
#endif

	void			*i_private; /* fs or device private pointer */

	ANDROID_KABI_RESERVE(1);
	ANDROID_KABI_RESERVE(2);
} __randomize_layout;

static inline unsigned int i_blocksize(const struct inode *node)
@@ -991,6 +1010,9 @@ struct file_lock;
struct file_lock_operations {
	void (*fl_copy_lock)(struct file_lock *, struct file_lock *);
	void (*fl_release_private)(struct file_lock *);

	ANDROID_KABI_RESERVE(1);
	ANDROID_KABI_RESERVE(2);
};

struct lock_manager_operations {
@@ -1003,6 +1025,9 @@ struct lock_manager_operations {
	bool (*lm_break)(struct file_lock *);
	int (*lm_change)(struct file_lock *, int, struct list_head *);
	void (*lm_setup)(struct file_lock *, void **);

	ANDROID_KABI_RESERVE(1);
	ANDROID_KABI_RESERVE(2);
};

struct lock_manager {
@@ -1070,6 +1095,10 @@ struct file_lock {
			int state;		/* state of grant or error if -ve */
		} afs;
	} fl_u;

	struct list_head android_reserved1;	/* not a macro as we might just need it as-is */
	ANDROID_KABI_RESERVE(1);
	ANDROID_KABI_RESERVE(2);
} __randomize_layout;

struct file_lock_context {
@@ -1497,6 +1526,11 @@ struct super_block {

	spinlock_t		s_inode_wblist_lock;
	struct list_head	s_inodes_wb;	/* writeback inodes */

	ANDROID_KABI_RESERVE(1);
	ANDROID_KABI_RESERVE(2);
	ANDROID_KABI_RESERVE(3);
	ANDROID_KABI_RESERVE(4);
} __randomize_layout;

/* Helper functions so that in most cases filesystems will
@@ -1808,6 +1842,11 @@ struct file_operations {
	int (*dedupe_file_range)(struct file *, loff_t, struct file *, loff_t,
			u64);
	int (*fadvise)(struct file *, loff_t, loff_t, int);

	ANDROID_KABI_RESERVE(1);
	ANDROID_KABI_RESERVE(2);
	ANDROID_KABI_RESERVE(3);
	ANDROID_KABI_RESERVE(4);
} __randomize_layout;

struct inode_operations {
@@ -1840,6 +1879,11 @@ struct inode_operations {
			   umode_t create_mode);
	int (*tmpfile) (struct inode *, struct dentry *, umode_t);
	int (*set_acl)(struct inode *, struct posix_acl *, int);

	ANDROID_KABI_RESERVE(1);
	ANDROID_KABI_RESERVE(2);
	ANDROID_KABI_RESERVE(3);
	ANDROID_KABI_RESERVE(4);
} ____cacheline_aligned;

static inline ssize_t call_read_iter(struct file *file, struct kiocb *kio,
@@ -1925,6 +1969,11 @@ struct super_operations {
				  struct shrink_control *);
	long (*free_cached_objects)(struct super_block *,
				    struct shrink_control *);

	ANDROID_KABI_RESERVE(1);
	ANDROID_KABI_RESERVE(2);
	ANDROID_KABI_RESERVE(3);
	ANDROID_KABI_RESERVE(4);
};

/*
@@ -2191,6 +2240,11 @@ struct file_system_type {
	struct lock_class_key i_lock_key;
	struct lock_class_key i_mutex_key;
	struct lock_class_key i_mutex_dir_key;

	ANDROID_KABI_RESERVE(1);
	ANDROID_KABI_RESERVE(2);
	ANDROID_KABI_RESERVE(3);
	ANDROID_KABI_RESERVE(4);
};

#define MODULE_ALIAS_FS(NAME) MODULE_ALIAS("fs-" NAME)