From 0a7866f7a1ce1d79870952d4bd384f0bbf4dd791 Mon Sep 17 00:00:00 2001 From: Tan Xiaojun Date: Wed, 10 Apr 2019 18:34:52 +0800 Subject: [PATCH] kabi: reserve space for misc structure hulk inclusion category: feature bugzilla: 13276 CVE: NA ------------------------------- Reserve space for the structure in other subsystems. Signed-off-by: Tan Xiaojun Reviewed-by: Xie XiuQi Signed-off-by: Yang Yingliang --- include/linux/backing-dev-defs.h | 10 +++++++ include/linux/bio.h | 8 ++++++ include/linux/bsg-lib.h | 3 +++ include/linux/bsg.h | 6 +++++ include/linux/dcache.h | 9 +++++++ include/linux/device.h | 28 ++++++++++++++++++++ include/linux/elevator.h | 14 ++++++++++ include/linux/fs.h | 45 ++++++++++++++++++++++++++++++++ include/linux/genhd.h | 13 +++++++++ include/linux/iomap.h | 6 +++++ include/linux/ioport.h | 6 +++++ include/linux/irqdomain.h | 6 +++++ include/linux/kernfs.h | 9 +++++++ include/linux/kobject.h | 16 ++++++++++++ include/linux/module.h | 6 +++++ include/linux/quota.h | 12 +++++++++ include/linux/stacktrace.h | 4 +++ include/linux/swap.h | 5 ++++ include/linux/timer.h | 6 +++++ include/linux/user_namespace.h | 6 +++++ include/linux/workqueue.h | 11 ++++++++ include/linux/writeback.h | 4 +++ 22 files changed, 233 insertions(+) diff --git a/include/linux/backing-dev-defs.h b/include/linux/backing-dev-defs.h index 07e02d6df5ad..3cfe7de12403 100644 --- a/include/linux/backing-dev-defs.h +++ b/include/linux/backing-dev-defs.h @@ -162,6 +162,11 @@ struct bdi_writeback { struct rcu_head rcu; }; #endif + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) }; struct backing_dev_info { @@ -205,6 +210,11 @@ struct backing_dev_info { struct dentry *debug_dir; struct dentry *debug_stats; #endif + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) }; enum { diff --git a/include/linux/bio.h b/include/linux/bio.h index 51371740d2a8..a474cec6744c 100644 --- a/include/linux/bio.h +++ b/include/linux/bio.h @@ -357,6 +357,9 @@ struct bio_integrity_payload { struct bio_vec *bip_vec; struct bio_vec bip_inline_vecs[0];/* embedded bvec array */ + + KABI_RESERVE(1) + KABI_RESERVE(2) }; #if defined(CONFIG_BLK_DEV_INTEGRITY) @@ -761,6 +764,11 @@ struct bio_set { struct bio_list rescue_list; struct work_struct rescue_work; struct workqueue_struct *rescue_workqueue; + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) }; struct biovec_slab { diff --git a/include/linux/bsg-lib.h b/include/linux/bsg-lib.h index 6aeaf6472665..9e30fe7e8537 100644 --- a/include/linux/bsg-lib.h +++ b/include/linux/bsg-lib.h @@ -67,6 +67,9 @@ struct bsg_job { unsigned int reply_payload_rcv_len; void *dd_data; /* Used for driver-specific storage */ + + KABI_RESERVE(1) + KABI_RESERVE(2) }; void bsg_job_done(struct bsg_job *job, int result, diff --git a/include/linux/bsg.h b/include/linux/bsg.h index dac37b6e00ec..50c8c53db519 100644 --- a/include/linux/bsg.h +++ b/include/linux/bsg.h @@ -13,6 +13,9 @@ struct bsg_ops { fmode_t mode); int (*complete_rq)(struct request *rq, struct sg_io_v4 *hdr); void (*free_rq)(struct request *rq); + + KABI_RESERVE(1) + KABI_RESERVE(2) }; struct bsg_class_device { @@ -20,6 +23,9 @@ struct bsg_class_device { int minor; struct request_queue *queue; const struct bsg_ops *ops; + + KABI_RESERVE(1) + KABI_RESERVE(2) }; int bsg_register_queue(struct request_queue *q, struct device *parent, diff --git a/include/linux/dcache.h b/include/linux/dcache.h index ef4b70f64f33..da7741bc959e 100644 --- a/include/linux/dcache.h +++ b/include/linux/dcache.h @@ -2,6 +2,7 @@ #ifndef __LINUX_DCACHE_H #define __LINUX_DCACHE_H +#include #include #include #include @@ -117,6 +118,9 @@ struct dentry { struct hlist_bl_node d_in_lookup_hash; /* only for in-lookup ones */ struct rcu_head d_rcu; } d_u; + + KABI_RESERVE(1) + KABI_RESERVE(2) } __randomize_layout; /* @@ -146,6 +150,11 @@ struct dentry_operations { struct vfsmount *(*d_automount)(struct path *); int (*d_manage)(const struct path *, bool); struct dentry *(*d_real)(struct dentry *, const struct inode *); + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) } ____cacheline_aligned; /* diff --git a/include/linux/device.h b/include/linux/device.h index 3f1066a9e1c3..f3d9ceed1660 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -12,6 +12,7 @@ #ifndef _DEVICE_H_ #define _DEVICE_H_ +#include #include #include #include @@ -298,6 +299,11 @@ struct device_driver { void (*coredump) (struct device *dev); struct driver_private *p; + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) }; @@ -423,6 +429,11 @@ struct class { const struct dev_pm_ops *pm; struct subsys_private *p; + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) }; struct class_dev_iter { @@ -1040,6 +1051,23 @@ struct device { bool offline_disabled:1; bool offline:1; bool of_node_reused:1; + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) + KABI_RESERVE(5) + KABI_RESERVE(6) + KABI_RESERVE(7) + KABI_RESERVE(8) + KABI_RESERVE(9) + KABI_RESERVE(10) + KABI_RESERVE(11) + KABI_RESERVE(12) + KABI_RESERVE(13) + KABI_RESERVE(14) + KABI_RESERVE(15) + KABI_RESERVE(16) }; static inline struct device *kobj_to_dev(struct kobject *kobj) diff --git a/include/linux/elevator.h b/include/linux/elevator.h index a02deea30185..73c4319d599b 100644 --- a/include/linux/elevator.h +++ b/include/linux/elevator.h @@ -118,6 +118,15 @@ struct elevator_mq_ops { struct request *(*next_request)(struct request_queue *, struct request *); void (*init_icq)(struct io_cq *); void (*exit_icq)(struct io_cq *); + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) + KABI_RESERVE(5) + KABI_RESERVE(6) + KABI_RESERVE(7) + KABI_RESERVE(8) }; #define ELV_NAME_MAX (16) @@ -156,6 +165,11 @@ struct elevator_type /* managed by elevator core */ char icq_cache_name[ELV_NAME_MAX + 6]; /* elvname + "_io_cq" */ struct list_head list; + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) }; #define ELV_HASH_BITS 6 diff --git a/include/linux/fs.h b/include/linux/fs.h index 111c94c4baa1..b794b2448941 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -2,6 +2,7 @@ #ifndef _LINUX_FS_H #define _LINUX_FS_H +#include #include #include #include @@ -393,6 +394,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); + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) }; extern const struct address_space_operations empty_aops; @@ -427,6 +433,11 @@ struct address_space { struct list_head private_list; /* for use by the address_space */ void *private_data; /* ditto */ errseq_t wb_err; + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) } __attribute__((aligned(sizeof(long)))) __randomize_layout; /* * On most architectures that alignment is already the case; but @@ -471,6 +482,11 @@ struct block_device { int bd_fsfreeze_count; /* Mutex for freeze */ struct mutex bd_fsfreeze_mutex; + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) } __randomize_layout; /* @@ -690,6 +706,9 @@ struct inode { #endif void *i_private; /* fs or device private pointer */ + + KABI_RESERVE(1) + KABI_RESERVE(2) } __randomize_layout; static inline unsigned int i_blocksize(const struct inode *node) @@ -981,6 +1000,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 *); + + KABI_RESERVE(1) + KABI_RESERVE(2) }; struct lock_manager_operations { @@ -993,6 +1015,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 **); + + KABI_RESERVE(1) + KABI_RESERVE(2) }; struct lock_manager { @@ -1773,6 +1798,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); + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) } __randomize_layout; struct inode_operations { @@ -1803,6 +1833,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); + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) } ____cacheline_aligned; static inline ssize_t call_read_iter(struct file *file, struct kiocb *kio, @@ -1883,6 +1918,11 @@ struct super_operations { struct shrink_control *); long (*free_cached_objects)(struct super_block *, struct shrink_control *); + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) }; /* @@ -2142,6 +2182,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; + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) }; #define MODULE_ALIAS_FS(NAME) MODULE_ALIAS("fs-" NAME) diff --git a/include/linux/genhd.h b/include/linux/genhd.h index f13272d84332..325ef33d6481 100644 --- a/include/linux/genhd.h +++ b/include/linux/genhd.h @@ -130,6 +130,11 @@ struct hd_struct { #endif struct percpu_ref ref; struct rcu_work rcu_work; + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) }; #define GENHD_FL_REMOVABLE 1 @@ -167,6 +172,9 @@ struct blk_integrity { unsigned char tuple_size; unsigned char interval_exp; unsigned char tag_size; + + KABI_RESERVE(1) + KABI_RESERVE(2) }; #endif /* CONFIG_BLK_DEV_INTEGRITY */ @@ -211,6 +219,11 @@ struct gendisk { int node_id; struct badblocks *bb; struct lockdep_map lockdep_map; + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) }; static inline struct gendisk *part_to_disk(struct hd_struct *part) diff --git a/include/linux/iomap.h b/include/linux/iomap.h index 3555d54bf79a..672743eba1c6 100644 --- a/include/linux/iomap.h +++ b/include/linux/iomap.h @@ -2,6 +2,7 @@ #ifndef LINUX_IOMAP_H #define LINUX_IOMAP_H 1 +#include #include #include #include @@ -99,6 +100,11 @@ struct iomap_ops { */ int (*iomap_end)(struct inode *inode, loff_t pos, loff_t length, ssize_t written, unsigned flags, struct iomap *iomap); + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) }; /* diff --git a/include/linux/ioport.h b/include/linux/ioport.h index da0ebaec25f0..5330288da8db 100644 --- a/include/linux/ioport.h +++ b/include/linux/ioport.h @@ -10,6 +10,7 @@ #define _LINUX_IOPORT_H #ifndef __ASSEMBLY__ +#include #include #include /* @@ -23,6 +24,11 @@ struct resource { unsigned long flags; unsigned long desc; struct resource *parent, *sibling, *child; + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) }; /* diff --git a/include/linux/irqdomain.h b/include/linux/irqdomain.h index dccfa65aee96..086e101e1385 100644 --- a/include/linux/irqdomain.h +++ b/include/linux/irqdomain.h @@ -30,6 +30,7 @@ #ifndef _LINUX_IRQDOMAIN_H #define _LINUX_IRQDOMAIN_H +#include #include #include #include @@ -173,6 +174,11 @@ struct irq_domain { struct dentry *debugfs_file; #endif + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) + /* reverse map data. The linear map gets appended to the irq_domain */ irq_hw_number_t hwirq_max; unsigned int revmap_direct_max_irq; diff --git a/include/linux/kernfs.h b/include/linux/kernfs.h index 5b36b1287a5a..136ba4fba0b6 100644 --- a/include/linux/kernfs.h +++ b/include/linux/kernfs.h @@ -7,6 +7,7 @@ #ifndef __LINUX_KERNFS_H #define __LINUX_KERNFS_H +#include #include #include #include @@ -177,6 +178,11 @@ struct kernfs_syscall_ops { const char *new_name); int (*show_path)(struct seq_file *sf, struct kernfs_node *kn, struct kernfs_root *root); + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) }; struct kernfs_root { @@ -266,6 +272,9 @@ struct kernfs_ops { #ifdef CONFIG_DEBUG_LOCK_ALLOC struct lock_class_key lockdep_key; #endif + + KABI_RESERVE(1) + KABI_RESERVE(2) }; #ifdef CONFIG_KERNFS diff --git a/include/linux/kobject.h b/include/linux/kobject.h index 1ab0d624fb36..304dff989b13 100644 --- a/include/linux/kobject.h +++ b/include/linux/kobject.h @@ -15,6 +15,7 @@ #ifndef _KOBJECT_H_ #define _KOBJECT_H_ +#include #include #include #include @@ -78,6 +79,11 @@ struct kobject { unsigned int state_add_uevent_sent:1; unsigned int state_remove_uevent_sent:1; unsigned int uevent_suppress:1; + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) }; extern __printf(2, 3) @@ -143,6 +149,11 @@ struct kobj_type { const struct kobj_ns_type_operations *(*child_ns_type)(struct kobject *kobj); const void *(*namespace)(struct kobject *kobj); void (*get_ownership)(struct kobject *kobj, kuid_t *uid, kgid_t *gid); + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) }; struct kobj_uevent_env { @@ -194,6 +205,11 @@ struct kset { spinlock_t list_lock; struct kobject kobj; const struct kset_uevent_ops *uevent_ops; + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) } __randomize_layout; extern void kset_init(struct kset *kset); diff --git a/include/linux/module.h b/include/linux/module.h index 2fb8dc9e94d1..2fb5393d0a68 100644 --- a/include/linux/module.h +++ b/include/linux/module.h @@ -6,6 +6,7 @@ * Rewritten by Richard Henderson Dec 1996 * Rewritten again by Rusty Russell, 2002 */ +#include #include #include #include @@ -486,6 +487,11 @@ struct module { struct error_injection_entry *ei_funcs; unsigned int num_ei_funcs; #endif + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) } ____cacheline_aligned __randomize_layout; #ifndef MODULE_ARCH_INIT #define MODULE_ARCH_INIT {} diff --git a/include/linux/quota.h b/include/linux/quota.h index f32dd270b8e3..22b25f7c3821 100644 --- a/include/linux/quota.h +++ b/include/linux/quota.h @@ -32,6 +32,7 @@ #ifndef _LINUX_QUOTA_ #define _LINUX_QUOTA_ +#include #include #include #include @@ -316,6 +317,9 @@ struct quota_format_ops { int (*commit_dqblk)(struct dquot *dquot); /* Write structure for one user */ int (*release_dqblk)(struct dquot *dquot); /* Called when last reference to dquot is being dropped */ int (*get_next_id)(struct super_block *sb, struct kqid *qid); /* Get next ID with existing structure in the quota file */ + + KABI_RESERVE(1) + KABI_RESERVE(2) }; /* Operations working with dquots */ @@ -335,6 +339,9 @@ struct dquot_operations { int (*get_inode_usage) (struct inode *, qsize_t *); /* Get next ID with active quota structure */ int (*get_next_id) (struct super_block *sb, struct kqid *qid); + + KABI_RESERVE(1) + KABI_RESERVE(2) }; struct path; @@ -438,6 +445,11 @@ struct quotactl_ops { int (*set_dqblk)(struct super_block *, struct kqid, struct qc_dqblk *); int (*get_state)(struct super_block *, struct qc_state *); int (*rm_xquota)(struct super_block *, unsigned int); + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) }; struct quota_format_type { diff --git a/include/linux/stacktrace.h b/include/linux/stacktrace.h index ba29a0613e66..eb00d3dff39f 100644 --- a/include/linux/stacktrace.h +++ b/include/linux/stacktrace.h @@ -2,6 +2,7 @@ #ifndef __LINUX_STACKTRACE_H #define __LINUX_STACKTRACE_H +#include #include struct task_struct; @@ -12,6 +13,9 @@ struct stack_trace { unsigned int nr_entries, max_entries; unsigned long *entries; int skip; /* input argument: How many entries to skip */ + + KABI_RESERVE(1) + KABI_RESERVE(2) }; extern void save_stack_trace(struct stack_trace *trace); diff --git a/include/linux/swap.h b/include/linux/swap.h index 8f1fcc75e7b3..ee49f7447d74 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h @@ -2,6 +2,7 @@ #ifndef _LINUX_SWAP_H #define _LINUX_SWAP_H +#include #include #include #include @@ -272,6 +273,10 @@ struct swap_info_struct { */ struct work_struct discard_work; /* discard worker */ struct swap_cluster_list discard_clusters; /* discard clusters list */ + + KABI_RESERVE(1) + KABI_RESERVE(2) + struct plist_node avail_lists[0]; /* * entries in swap_avail_heads, one * entry per node. diff --git a/include/linux/timer.h b/include/linux/timer.h index 7b066fd38248..b1e4b2e9335b 100644 --- a/include/linux/timer.h +++ b/include/linux/timer.h @@ -2,6 +2,7 @@ #ifndef _LINUX_TIMER_H #define _LINUX_TIMER_H +#include #include #include #include @@ -21,6 +22,11 @@ struct timer_list { #ifdef CONFIG_LOCKDEP struct lockdep_map lockdep_map; #endif + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) }; #ifdef CONFIG_LOCKDEP diff --git a/include/linux/user_namespace.h b/include/linux/user_namespace.h index d6b74b91096b..ccd5c3813afa 100644 --- a/include/linux/user_namespace.h +++ b/include/linux/user_namespace.h @@ -2,6 +2,7 @@ #ifndef _LINUX_USER_NAMESPACE_H #define _LINUX_USER_NAMESPACE_H +#include #include #include #include @@ -76,6 +77,11 @@ struct user_namespace { #endif struct ucounts *ucounts; int ucount_max[UCOUNT_COUNTS]; + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) } __randomize_layout; struct ucounts { diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h index 60d673e15632..cd9ae7672203 100644 --- a/include/linux/workqueue.h +++ b/include/linux/workqueue.h @@ -6,6 +6,7 @@ #ifndef _LINUX_WORKQUEUE_H #define _LINUX_WORKQUEUE_H +#include #include #include #include @@ -106,6 +107,11 @@ struct work_struct { #ifdef CONFIG_LOCKDEP struct lockdep_map lockdep_map; #endif + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) }; #define WORK_DATA_INIT() ATOMIC_LONG_INIT((unsigned long)WORK_STRUCT_NO_POOL) @@ -119,6 +125,11 @@ struct delayed_work { /* target workqueue and CPU ->timer uses to queue ->work */ struct workqueue_struct *wq; int cpu; + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) }; struct rcu_work { diff --git a/include/linux/writeback.h b/include/linux/writeback.h index fdfd04e348f6..1b5feef03462 100644 --- a/include/linux/writeback.h +++ b/include/linux/writeback.h @@ -5,6 +5,7 @@ #ifndef WRITEBACK_H #define WRITEBACK_H +#include #include #include #include @@ -80,6 +81,9 @@ struct writeback_control { size_t wb_lcand_bytes; /* bytes written by last candidate */ size_t wb_tcand_bytes; /* bytes written by this candidate */ #endif + + KABI_RESERVE(1) + KABI_RESERVE(2) }; static inline int wbc_to_write_flags(struct writeback_control *wbc) -- GitLab