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: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
Greg Kroah-Hartman
2020-03-25 12:16:07 +01:00
committed by Todd Kjos
parent 48cddc7c42
commit f4872b2353
2 changed files with 54 additions and 0 deletions

View File

@@ -48,6 +48,11 @@ struct block_device {
/* Mutex for freeze */ /* Mutex for freeze */
struct mutex bd_fsfreeze_mutex; struct mutex bd_fsfreeze_mutex;
struct super_block *bd_fsfreeze_sb; struct super_block *bd_fsfreeze_sb;
ANDROID_KABI_RESERVE(1);
ANDROID_KABI_RESERVE(2);
ANDROID_KABI_RESERVE(3);
ANDROID_KABI_RESERVE(4);
} __randomize_layout; } __randomize_layout;
/* /*

View File

@@ -39,6 +39,7 @@
#include <linux/fs_types.h> #include <linux/fs_types.h>
#include <linux/build_bug.h> #include <linux/build_bug.h>
#include <linux/stddef.h> #include <linux/stddef.h>
#include <linux/android_kabi.h>
#include <asm/byteorder.h> #include <asm/byteorder.h>
#include <uapi/linux/fs.h> #include <uapi/linux/fs.h>
@@ -413,6 +414,11 @@ struct address_space_operations {
int (*swap_activate)(struct swap_info_struct *sis, struct file *file, int (*swap_activate)(struct swap_info_struct *sis, struct file *file,
sector_t *span); sector_t *span);
void (*swap_deactivate)(struct file *file); 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; extern const struct address_space_operations empty_aops;
@@ -468,6 +474,11 @@ struct address_space {
spinlock_t private_lock; spinlock_t private_lock;
struct list_head private_list; struct list_head private_list;
void *private_data; void *private_data;
ANDROID_KABI_RESERVE(1);
ANDROID_KABI_RESERVE(2);
ANDROID_KABI_RESERVE(3);
ANDROID_KABI_RESERVE(4);
} __attribute__((aligned(sizeof(long)))) __randomize_layout; } __attribute__((aligned(sizeof(long)))) __randomize_layout;
/* /*
* On most architectures that alignment is already the case; but * On most architectures that alignment is already the case; but
@@ -718,6 +729,9 @@ struct inode {
#endif #endif
void *i_private; /* fs or device private pointer */ void *i_private; /* fs or device private pointer */
ANDROID_KABI_RESERVE(1);
ANDROID_KABI_RESERVE(2);
} __randomize_layout; } __randomize_layout;
struct timespec64 timestamp_truncate(struct timespec64 t, struct inode *inode); struct timespec64 timestamp_truncate(struct timespec64 t, struct inode *inode);
@@ -1011,6 +1025,9 @@ struct file_lock;
struct file_lock_operations { struct file_lock_operations {
void (*fl_copy_lock)(struct file_lock *, struct file_lock *); void (*fl_copy_lock)(struct file_lock *, struct file_lock *);
void (*fl_release_private)(struct file_lock *); void (*fl_release_private)(struct file_lock *);
ANDROID_KABI_RESERVE(1);
ANDROID_KABI_RESERVE(2);
}; };
struct lock_manager_operations { struct lock_manager_operations {
@@ -1022,6 +1039,9 @@ struct lock_manager_operations {
int (*lm_change)(struct file_lock *, int, struct list_head *); int (*lm_change)(struct file_lock *, int, struct list_head *);
void (*lm_setup)(struct file_lock *, void **); void (*lm_setup)(struct file_lock *, void **);
bool (*lm_breaker_owns_lease)(struct file_lock *); bool (*lm_breaker_owns_lease)(struct file_lock *);
ANDROID_KABI_RESERVE(1);
ANDROID_KABI_RESERVE(2);
}; };
struct lock_manager { struct lock_manager {
@@ -1095,6 +1115,10 @@ struct file_lock {
unsigned int debug_id; unsigned int debug_id;
} afs; } afs;
} fl_u; } 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; } __randomize_layout;
struct file_lock_context { struct file_lock_context {
@@ -1547,6 +1571,11 @@ struct super_block {
spinlock_t s_inode_wblist_lock; spinlock_t s_inode_wblist_lock;
struct list_head s_inodes_wb; /* writeback inodes */ 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; } __randomize_layout;
/* Helper functions so that in most cases filesystems will /* Helper functions so that in most cases filesystems will
@@ -1859,6 +1888,11 @@ struct file_operations {
struct file *file_out, loff_t pos_out, struct file *file_out, loff_t pos_out,
loff_t len, unsigned int remap_flags); loff_t len, unsigned int remap_flags);
int (*fadvise)(struct file *, loff_t, loff_t, int); 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; } __randomize_layout;
struct inode_operations { struct inode_operations {
@@ -1889,6 +1923,11 @@ struct inode_operations {
umode_t create_mode); umode_t create_mode);
int (*tmpfile) (struct inode *, struct dentry *, umode_t); int (*tmpfile) (struct inode *, struct dentry *, umode_t);
int (*set_acl)(struct inode *, struct posix_acl *, int); 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; } ____cacheline_aligned;
static inline ssize_t call_read_iter(struct file *file, struct kiocb *kio, static inline ssize_t call_read_iter(struct file *file, struct kiocb *kio,
@@ -1965,6 +2004,11 @@ struct super_operations {
struct shrink_control *); struct shrink_control *);
long (*free_cached_objects)(struct super_block *, long (*free_cached_objects)(struct super_block *,
struct shrink_control *); struct shrink_control *);
ANDROID_KABI_RESERVE(1);
ANDROID_KABI_RESERVE(2);
ANDROID_KABI_RESERVE(3);
ANDROID_KABI_RESERVE(4);
}; };
/* /*
@@ -2252,6 +2296,11 @@ struct file_system_type {
struct lock_class_key i_lock_key; struct lock_class_key i_lock_key;
struct lock_class_key i_mutex_key; struct lock_class_key i_mutex_key;
struct lock_class_key i_mutex_dir_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) #define MODULE_ALIAS_FS(NAME) MODULE_ALIAS("fs-" NAME)