summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorKees Cook <keescook@chromium.org>2016-10-28 04:22:25 -0400
committerKees Cook <keescook@chromium.org>2017-06-30 15:00:51 -0400
commit3859a271a003aba01e45b85c9d8b355eb7bf25f9 (patch)
tree850c019e6a6449857e864b6a545b053ffe2f99a9 /include
parentffa47aa678cfaa9b88e8a26cfb115b4768325121 (diff)
randstruct: Mark various structs for randomization
This marks many critical kernel structures for randomization. These are structures that have been targeted in the past in security exploits, or contain functions pointers, pointers to function pointer tables, lists, workqueues, ref-counters, credentials, permissions, or are otherwise sensitive. This initial list was extracted from Brad Spengler/PaX Team's code in the last public patch of grsecurity/PaX based on my understanding of the code. Changes or omissions from the original code are mine and don't reflect the original grsecurity/PaX code. Left out of this list is task_struct, which requires special handling and will be covered in a subsequent patch. Signed-off-by: Kees Cook <keescook@chromium.org>
Diffstat (limited to 'include')
-rw-r--r--include/linux/binfmts.h4
-rw-r--r--include/linux/cdev.h2
-rw-r--r--include/linux/cred.h4
-rw-r--r--include/linux/dcache.h2
-rw-r--r--include/linux/fs.h17
-rw-r--r--include/linux/fs_struct.h2
-rw-r--r--include/linux/ipc.h2
-rw-r--r--include/linux/ipc_namespace.h2
-rw-r--r--include/linux/key-type.h4
-rw-r--r--include/linux/kmod.h2
-rw-r--r--include/linux/kobject.h2
-rw-r--r--include/linux/lsm_hooks.h4
-rw-r--r--include/linux/mm_types.h4
-rw-r--r--include/linux/module.h4
-rw-r--r--include/linux/mount.h2
-rw-r--r--include/linux/msg.h2
-rw-r--r--include/linux/path.h2
-rw-r--r--include/linux/pid_namespace.h2
-rw-r--r--include/linux/proc_ns.h2
-rw-r--r--include/linux/sched.h2
-rw-r--r--include/linux/sched/signal.h2
-rw-r--r--include/linux/sem.h2
-rw-r--r--include/linux/shm.h2
-rw-r--r--include/linux/sysctl.h2
-rw-r--r--include/linux/tty.h2
-rw-r--r--include/linux/tty_driver.h4
-rw-r--r--include/linux/user_namespace.h2
-rw-r--r--include/linux/utsname.h2
-rw-r--r--include/net/af_unix.h2
-rw-r--r--include/net/neighbour.h2
-rw-r--r--include/net/net_namespace.h2
-rw-r--r--include/net/sock.h2
32 files changed, 47 insertions, 46 deletions
diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h
index 05488da3aee9..3ae9013eeaaa 100644
--- a/include/linux/binfmts.h
+++ b/include/linux/binfmts.h
@@ -46,7 +46,7 @@ struct linux_binprm {
46 unsigned interp_flags; 46 unsigned interp_flags;
47 unsigned interp_data; 47 unsigned interp_data;
48 unsigned long loader, exec; 48 unsigned long loader, exec;
49}; 49} __randomize_layout;
50 50
51#define BINPRM_FLAGS_ENFORCE_NONDUMP_BIT 0 51#define BINPRM_FLAGS_ENFORCE_NONDUMP_BIT 0
52#define BINPRM_FLAGS_ENFORCE_NONDUMP (1 << BINPRM_FLAGS_ENFORCE_NONDUMP_BIT) 52#define BINPRM_FLAGS_ENFORCE_NONDUMP (1 << BINPRM_FLAGS_ENFORCE_NONDUMP_BIT)
@@ -81,7 +81,7 @@ struct linux_binfmt {
81 int (*load_shlib)(struct file *); 81 int (*load_shlib)(struct file *);
82 int (*core_dump)(struct coredump_params *cprm); 82 int (*core_dump)(struct coredump_params *cprm);
83 unsigned long min_coredump; /* minimal dump size */ 83 unsigned long min_coredump; /* minimal dump size */
84}; 84} __randomize_layout;
85 85
86extern void __register_binfmt(struct linux_binfmt *fmt, int insert); 86extern void __register_binfmt(struct linux_binfmt *fmt, int insert);
87 87
diff --git a/include/linux/cdev.h b/include/linux/cdev.h
index 408bc09ce497..cb28eb21e3ca 100644
--- a/include/linux/cdev.h
+++ b/include/linux/cdev.h
@@ -17,7 +17,7 @@ struct cdev {
17 struct list_head list; 17 struct list_head list;
18 dev_t dev; 18 dev_t dev;
19 unsigned int count; 19 unsigned int count;
20}; 20} __randomize_layout;
21 21
22void cdev_init(struct cdev *, const struct file_operations *); 22void cdev_init(struct cdev *, const struct file_operations *);
23 23
diff --git a/include/linux/cred.h b/include/linux/cred.h
index b03e7d049a64..82c8a9e1aabb 100644
--- a/include/linux/cred.h
+++ b/include/linux/cred.h
@@ -31,7 +31,7 @@ struct group_info {
31 atomic_t usage; 31 atomic_t usage;
32 int ngroups; 32 int ngroups;
33 kgid_t gid[0]; 33 kgid_t gid[0];
34}; 34} __randomize_layout;
35 35
36/** 36/**
37 * get_group_info - Get a reference to a group info structure 37 * get_group_info - Get a reference to a group info structure
@@ -145,7 +145,7 @@ struct cred {
145 struct user_namespace *user_ns; /* user_ns the caps and keyrings are relative to. */ 145 struct user_namespace *user_ns; /* user_ns the caps and keyrings are relative to. */
146 struct group_info *group_info; /* supplementary groups for euid/fsgid */ 146 struct group_info *group_info; /* supplementary groups for euid/fsgid */
147 struct rcu_head rcu; /* RCU deletion hook */ 147 struct rcu_head rcu; /* RCU deletion hook */
148}; 148} __randomize_layout;
149 149
150extern void __put_cred(struct cred *); 150extern void __put_cred(struct cred *);
151extern void exit_creds(struct task_struct *); 151extern void exit_creds(struct task_struct *);
diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index d2e38dc6172c..7eb262e13d3c 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -113,7 +113,7 @@ struct dentry {
113 struct hlist_bl_node d_in_lookup_hash; /* only for in-lookup ones */ 113 struct hlist_bl_node d_in_lookup_hash; /* only for in-lookup ones */
114 struct rcu_head d_rcu; 114 struct rcu_head d_rcu;
115 } d_u; 115 } d_u;
116}; 116} __randomize_layout;
117 117
118/* 118/*
119 * dentry->d_lock spinlock nesting subclasses: 119 * dentry->d_lock spinlock nesting subclasses:
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 803e5a9b2654..8f28143486c4 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -275,7 +275,7 @@ struct kiocb {
275 void (*ki_complete)(struct kiocb *iocb, long ret, long ret2); 275 void (*ki_complete)(struct kiocb *iocb, long ret, long ret2);
276 void *private; 276 void *private;
277 int ki_flags; 277 int ki_flags;
278}; 278} __randomize_layout;
279 279
280static inline bool is_sync_kiocb(struct kiocb *kiocb) 280static inline bool is_sync_kiocb(struct kiocb *kiocb)
281{ 281{
@@ -392,7 +392,7 @@ struct address_space {
392 gfp_t gfp_mask; /* implicit gfp mask for allocations */ 392 gfp_t gfp_mask; /* implicit gfp mask for allocations */
393 struct list_head private_list; /* ditto */ 393 struct list_head private_list; /* ditto */
394 void *private_data; /* ditto */ 394 void *private_data; /* ditto */
395} __attribute__((aligned(sizeof(long)))); 395} __attribute__((aligned(sizeof(long)))) __randomize_layout;
396 /* 396 /*
397 * On most architectures that alignment is already the case; but 397 * On most architectures that alignment is already the case; but
398 * must be enforced here for CRIS, to let the least significant bit 398 * must be enforced here for CRIS, to let the least significant bit
@@ -435,7 +435,7 @@ struct block_device {
435 int bd_fsfreeze_count; 435 int bd_fsfreeze_count;
436 /* Mutex for freeze */ 436 /* Mutex for freeze */
437 struct mutex bd_fsfreeze_mutex; 437 struct mutex bd_fsfreeze_mutex;
438}; 438} __randomize_layout;
439 439
440/* 440/*
441 * Radix-tree tags, for tagging dirty and writeback pages within the pagecache 441 * Radix-tree tags, for tagging dirty and writeback pages within the pagecache
@@ -653,7 +653,7 @@ struct inode {
653#endif 653#endif
654 654
655 void *i_private; /* fs or device private pointer */ 655 void *i_private; /* fs or device private pointer */
656}; 656} __randomize_layout;
657 657
658static inline unsigned int i_blocksize(const struct inode *node) 658static inline unsigned int i_blocksize(const struct inode *node)
659{ 659{
@@ -868,7 +868,8 @@ struct file {
868 struct list_head f_tfile_llink; 868 struct list_head f_tfile_llink;
869#endif /* #ifdef CONFIG_EPOLL */ 869#endif /* #ifdef CONFIG_EPOLL */
870 struct address_space *f_mapping; 870 struct address_space *f_mapping;
871} __attribute__((aligned(4))); /* lest something weird decides that 2 is OK */ 871} __randomize_layout
872 __attribute__((aligned(4))); /* lest something weird decides that 2 is OK */
872 873
873struct file_handle { 874struct file_handle {
874 __u32 handle_bytes; 875 __u32 handle_bytes;
@@ -1005,7 +1006,7 @@ struct file_lock {
1005 int state; /* state of grant or error if -ve */ 1006 int state; /* state of grant or error if -ve */
1006 } afs; 1007 } afs;
1007 } fl_u; 1008 } fl_u;
1008}; 1009} __randomize_layout;
1009 1010
1010struct file_lock_context { 1011struct file_lock_context {
1011 spinlock_t flc_lock; 1012 spinlock_t flc_lock;
@@ -1404,7 +1405,7 @@ struct super_block {
1404 1405
1405 spinlock_t s_inode_wblist_lock; 1406 spinlock_t s_inode_wblist_lock;
1406 struct list_head s_inodes_wb; /* writeback inodes */ 1407 struct list_head s_inodes_wb; /* writeback inodes */
1407}; 1408} __randomize_layout;
1408 1409
1409/* Helper functions so that in most cases filesystems will 1410/* Helper functions so that in most cases filesystems will
1410 * not need to deal directly with kuid_t and kgid_t and can 1411 * not need to deal directly with kuid_t and kgid_t and can
@@ -1690,7 +1691,7 @@ struct file_operations {
1690 u64); 1691 u64);
1691 ssize_t (*dedupe_file_range)(struct file *, u64, u64, struct file *, 1692 ssize_t (*dedupe_file_range)(struct file *, u64, u64, struct file *,
1692 u64); 1693 u64);
1693}; 1694} __randomize_layout;
1694 1695
1695struct inode_operations { 1696struct inode_operations {
1696 struct dentry * (*lookup) (struct inode *,struct dentry *, unsigned int); 1697 struct dentry * (*lookup) (struct inode *,struct dentry *, unsigned int);
diff --git a/include/linux/fs_struct.h b/include/linux/fs_struct.h
index 0efc3e62843a..7a026240cbb1 100644
--- a/include/linux/fs_struct.h
+++ b/include/linux/fs_struct.h
@@ -12,7 +12,7 @@ struct fs_struct {
12 int umask; 12 int umask;
13 int in_exec; 13 int in_exec;
14 struct path root, pwd; 14 struct path root, pwd;
15}; 15} __randomize_layout;
16 16
17extern struct kmem_cache *fs_cachep; 17extern struct kmem_cache *fs_cachep;
18 18
diff --git a/include/linux/ipc.h b/include/linux/ipc.h
index 71fd92d81b26..ea0eb0b5f98c 100644
--- a/include/linux/ipc.h
+++ b/include/linux/ipc.h
@@ -20,6 +20,6 @@ struct kern_ipc_perm {
20 umode_t mode; 20 umode_t mode;
21 unsigned long seq; 21 unsigned long seq;
22 void *security; 22 void *security;
23} ____cacheline_aligned_in_smp; 23} ____cacheline_aligned_in_smp __randomize_layout;
24 24
25#endif /* _LINUX_IPC_H */ 25#endif /* _LINUX_IPC_H */
diff --git a/include/linux/ipc_namespace.h b/include/linux/ipc_namespace.h
index 848e5796400e..65327ee0936b 100644
--- a/include/linux/ipc_namespace.h
+++ b/include/linux/ipc_namespace.h
@@ -61,7 +61,7 @@ struct ipc_namespace {
61 struct ucounts *ucounts; 61 struct ucounts *ucounts;
62 62
63 struct ns_common ns; 63 struct ns_common ns;
64}; 64} __randomize_layout;
65 65
66extern struct ipc_namespace init_ipc_ns; 66extern struct ipc_namespace init_ipc_ns;
67extern spinlock_t mq_lock; 67extern spinlock_t mq_lock;
diff --git a/include/linux/key-type.h b/include/linux/key-type.h
index 8496cf64575c..9520fc3c3b9a 100644
--- a/include/linux/key-type.h
+++ b/include/linux/key-type.h
@@ -45,7 +45,7 @@ struct key_preparsed_payload {
45 size_t datalen; /* Raw datalen */ 45 size_t datalen; /* Raw datalen */
46 size_t quotalen; /* Quota length for proposed payload */ 46 size_t quotalen; /* Quota length for proposed payload */
47 time_t expiry; /* Expiry time of key */ 47 time_t expiry; /* Expiry time of key */
48}; 48} __randomize_layout;
49 49
50typedef int (*request_key_actor_t)(struct key_construction *key, 50typedef int (*request_key_actor_t)(struct key_construction *key,
51 const char *op, void *aux); 51 const char *op, void *aux);
@@ -158,7 +158,7 @@ struct key_type {
158 /* internal fields */ 158 /* internal fields */
159 struct list_head link; /* link in types list */ 159 struct list_head link; /* link in types list */
160 struct lock_class_key lock_class; /* key->sem lock class */ 160 struct lock_class_key lock_class; /* key->sem lock class */
161}; 161} __randomize_layout;
162 162
163extern struct key_type key_type_keyring; 163extern struct key_type key_type_keyring;
164 164
diff --git a/include/linux/kmod.h b/include/linux/kmod.h
index c4e441e00db5..655082c88fd9 100644
--- a/include/linux/kmod.h
+++ b/include/linux/kmod.h
@@ -64,7 +64,7 @@ struct subprocess_info {
64 int (*init)(struct subprocess_info *info, struct cred *new); 64 int (*init)(struct subprocess_info *info, struct cred *new);
65 void (*cleanup)(struct subprocess_info *info); 65 void (*cleanup)(struct subprocess_info *info);
66 void *data; 66 void *data;
67}; 67} __randomize_layout;
68 68
69extern int 69extern int
70call_usermodehelper(const char *path, char **argv, char **envp, int wait); 70call_usermodehelper(const char *path, char **argv, char **envp, int wait);
diff --git a/include/linux/kobject.h b/include/linux/kobject.h
index ca85cb80e99a..084513350317 100644
--- a/include/linux/kobject.h
+++ b/include/linux/kobject.h
@@ -172,7 +172,7 @@ struct kset {
172 spinlock_t list_lock; 172 spinlock_t list_lock;
173 struct kobject kobj; 173 struct kobject kobj;
174 const struct kset_uevent_ops *uevent_ops; 174 const struct kset_uevent_ops *uevent_ops;
175}; 175} __randomize_layout;
176 176
177extern void kset_init(struct kset *kset); 177extern void kset_init(struct kset *kset);
178extern int __must_check kset_register(struct kset *kset); 178extern int __must_check kset_register(struct kset *kset);
diff --git a/include/linux/lsm_hooks.h b/include/linux/lsm_hooks.h
index 080f34e66017..565163fc9ad4 100644
--- a/include/linux/lsm_hooks.h
+++ b/include/linux/lsm_hooks.h
@@ -1876,7 +1876,7 @@ struct security_hook_heads {
1876 struct list_head audit_rule_match; 1876 struct list_head audit_rule_match;
1877 struct list_head audit_rule_free; 1877 struct list_head audit_rule_free;
1878#endif /* CONFIG_AUDIT */ 1878#endif /* CONFIG_AUDIT */
1879}; 1879} __randomize_layout;
1880 1880
1881/* 1881/*
1882 * Security module hook list structure. 1882 * Security module hook list structure.
@@ -1887,7 +1887,7 @@ struct security_hook_list {
1887 struct list_head *head; 1887 struct list_head *head;
1888 union security_list_options hook; 1888 union security_list_options hook;
1889 char *lsm; 1889 char *lsm;
1890}; 1890} __randomize_layout;
1891 1891
1892/* 1892/*
1893 * Initializing a security_hook_list structure takes 1893 * Initializing a security_hook_list structure takes
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
index 45cdb27791a3..ff151814a02d 100644
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -342,7 +342,7 @@ struct vm_area_struct {
342 struct mempolicy *vm_policy; /* NUMA policy for the VMA */ 342 struct mempolicy *vm_policy; /* NUMA policy for the VMA */
343#endif 343#endif
344 struct vm_userfaultfd_ctx vm_userfaultfd_ctx; 344 struct vm_userfaultfd_ctx vm_userfaultfd_ctx;
345}; 345} __randomize_layout;
346 346
347struct core_thread { 347struct core_thread {
348 struct task_struct *task; 348 struct task_struct *task;
@@ -500,7 +500,7 @@ struct mm_struct {
500 atomic_long_t hugetlb_usage; 500 atomic_long_t hugetlb_usage;
501#endif 501#endif
502 struct work_struct async_put_work; 502 struct work_struct async_put_work;
503}; 503} __randomize_layout;
504 504
505extern struct mm_struct init_mm; 505extern struct mm_struct init_mm;
506 506
diff --git a/include/linux/module.h b/include/linux/module.h
index 21f56393602f..d93111d7def6 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -45,7 +45,7 @@ struct module_kobject {
45 struct kobject *drivers_dir; 45 struct kobject *drivers_dir;
46 struct module_param_attrs *mp; 46 struct module_param_attrs *mp;
47 struct completion *kobj_completion; 47 struct completion *kobj_completion;
48}; 48} __randomize_layout;
49 49
50struct module_attribute { 50struct module_attribute {
51 struct attribute attr; 51 struct attribute attr;
@@ -475,7 +475,7 @@ struct module {
475 ctor_fn_t *ctors; 475 ctor_fn_t *ctors;
476 unsigned int num_ctors; 476 unsigned int num_ctors;
477#endif 477#endif
478} ____cacheline_aligned; 478} ____cacheline_aligned __randomize_layout;
479#ifndef MODULE_ARCH_INIT 479#ifndef MODULE_ARCH_INIT
480#define MODULE_ARCH_INIT {} 480#define MODULE_ARCH_INIT {}
481#endif 481#endif
diff --git a/include/linux/mount.h b/include/linux/mount.h
index 8e0352af06b7..1ce85e6fd95f 100644
--- a/include/linux/mount.h
+++ b/include/linux/mount.h
@@ -67,7 +67,7 @@ struct vfsmount {
67 struct dentry *mnt_root; /* root of the mounted tree */ 67 struct dentry *mnt_root; /* root of the mounted tree */
68 struct super_block *mnt_sb; /* pointer to superblock */ 68 struct super_block *mnt_sb; /* pointer to superblock */
69 int mnt_flags; 69 int mnt_flags;
70}; 70} __randomize_layout;
71 71
72struct file; /* forward dec */ 72struct file; /* forward dec */
73struct path; 73struct path;
diff --git a/include/linux/msg.h b/include/linux/msg.h
index f3f302f9c197..a001305f5a79 100644
--- a/include/linux/msg.h
+++ b/include/linux/msg.h
@@ -29,7 +29,7 @@ struct msg_queue {
29 struct list_head q_messages; 29 struct list_head q_messages;
30 struct list_head q_receivers; 30 struct list_head q_receivers;
31 struct list_head q_senders; 31 struct list_head q_senders;
32}; 32} __randomize_layout;
33 33
34/* Helper routines for sys_msgsnd and sys_msgrcv */ 34/* Helper routines for sys_msgsnd and sys_msgrcv */
35extern long do_msgsnd(int msqid, long mtype, void __user *mtext, 35extern long do_msgsnd(int msqid, long mtype, void __user *mtext,
diff --git a/include/linux/path.h b/include/linux/path.h
index d1372186f431..cde895cc4af4 100644
--- a/include/linux/path.h
+++ b/include/linux/path.h
@@ -7,7 +7,7 @@ struct vfsmount;
7struct path { 7struct path {
8 struct vfsmount *mnt; 8 struct vfsmount *mnt;
9 struct dentry *dentry; 9 struct dentry *dentry;
10}; 10} __randomize_layout;
11 11
12extern void path_get(const struct path *); 12extern void path_get(const struct path *);
13extern void path_put(const struct path *); 13extern void path_put(const struct path *);
diff --git a/include/linux/pid_namespace.h b/include/linux/pid_namespace.h
index c2a989dee876..b09136f88cf4 100644
--- a/include/linux/pid_namespace.h
+++ b/include/linux/pid_namespace.h
@@ -52,7 +52,7 @@ struct pid_namespace {
52 int hide_pid; 52 int hide_pid;
53 int reboot; /* group exit code if this pidns was rebooted */ 53 int reboot; /* group exit code if this pidns was rebooted */
54 struct ns_common ns; 54 struct ns_common ns;
55}; 55} __randomize_layout;
56 56
57extern struct pid_namespace init_pid_ns; 57extern struct pid_namespace init_pid_ns;
58 58
diff --git a/include/linux/proc_ns.h b/include/linux/proc_ns.h
index 58ab28d81fc2..06844b54dfc1 100644
--- a/include/linux/proc_ns.h
+++ b/include/linux/proc_ns.h
@@ -21,7 +21,7 @@ struct proc_ns_operations {
21 int (*install)(struct nsproxy *nsproxy, struct ns_common *ns); 21 int (*install)(struct nsproxy *nsproxy, struct ns_common *ns);
22 struct user_namespace *(*owner)(struct ns_common *ns); 22 struct user_namespace *(*owner)(struct ns_common *ns);
23 struct ns_common *(*get_parent)(struct ns_common *ns); 23 struct ns_common *(*get_parent)(struct ns_common *ns);
24}; 24} __randomize_layout;
25 25
26extern const struct proc_ns_operations netns_operations; 26extern const struct proc_ns_operations netns_operations;
27extern const struct proc_ns_operations utsns_operations; 27extern const struct proc_ns_operations utsns_operations;
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 2b69fc650201..f833254fce00 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -408,7 +408,7 @@ struct sched_rt_entity {
408 /* rq "owned" by this entity/group: */ 408 /* rq "owned" by this entity/group: */
409 struct rt_rq *my_q; 409 struct rt_rq *my_q;
410#endif 410#endif
411}; 411} __randomize_layout;
412 412
413struct sched_dl_entity { 413struct sched_dl_entity {
414 struct rb_node rb_node; 414 struct rb_node rb_node;
diff --git a/include/linux/sched/signal.h b/include/linux/sched/signal.h
index c06d63b3a583..2a0dd40b15db 100644
--- a/include/linux/sched/signal.h
+++ b/include/linux/sched/signal.h
@@ -222,7 +222,7 @@ struct signal_struct {
222 struct mutex cred_guard_mutex; /* guard against foreign influences on 222 struct mutex cred_guard_mutex; /* guard against foreign influences on
223 * credential calculations 223 * credential calculations
224 * (notably. ptrace) */ 224 * (notably. ptrace) */
225}; 225} __randomize_layout;
226 226
227/* 227/*
228 * Bits in flags field of signal_struct. 228 * Bits in flags field of signal_struct.
diff --git a/include/linux/sem.h b/include/linux/sem.h
index 9edec926e9d9..23bcbdfad4a6 100644
--- a/include/linux/sem.h
+++ b/include/linux/sem.h
@@ -21,7 +21,7 @@ struct sem_array {
21 int sem_nsems; /* no. of semaphores in array */ 21 int sem_nsems; /* no. of semaphores in array */
22 int complex_count; /* pending complex operations */ 22 int complex_count; /* pending complex operations */
23 unsigned int use_global_lock;/* >0: global lock required */ 23 unsigned int use_global_lock;/* >0: global lock required */
24}; 24} __randomize_layout;
25 25
26#ifdef CONFIG_SYSVIPC 26#ifdef CONFIG_SYSVIPC
27 27
diff --git a/include/linux/shm.h b/include/linux/shm.h
index 04e881829625..0fb7061ec54c 100644
--- a/include/linux/shm.h
+++ b/include/linux/shm.h
@@ -22,7 +22,7 @@ struct shmid_kernel /* private to the kernel */
22 /* The task created the shm object. NULL if the task is dead. */ 22 /* The task created the shm object. NULL if the task is dead. */
23 struct task_struct *shm_creator; 23 struct task_struct *shm_creator;
24 struct list_head shm_clist; /* list by creator */ 24 struct list_head shm_clist; /* list by creator */
25}; 25} __randomize_layout;
26 26
27/* shm_mode upper byte flags */ 27/* shm_mode upper byte flags */
28#define SHM_DEST 01000 /* segment will be destroyed on last detach */ 28#define SHM_DEST 01000 /* segment will be destroyed on last detach */
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index 80d07816def0..9ddeef2c03e2 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -117,7 +117,7 @@ struct ctl_table
117 struct ctl_table_poll *poll; 117 struct ctl_table_poll *poll;
118 void *extra1; 118 void *extra1;
119 void *extra2; 119 void *extra2;
120}; 120} __randomize_layout;
121 121
122struct ctl_node { 122struct ctl_node {
123 struct rb_node node; 123 struct rb_node node;
diff --git a/include/linux/tty.h b/include/linux/tty.h
index d07cd2105a6c..73f8d0977bb0 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -333,7 +333,7 @@ struct tty_struct {
333 /* If the tty has a pending do_SAK, queue it here - akpm */ 333 /* If the tty has a pending do_SAK, queue it here - akpm */
334 struct work_struct SAK_work; 334 struct work_struct SAK_work;
335 struct tty_port *port; 335 struct tty_port *port;
336}; 336} __randomize_layout;
337 337
338/* Each of a tty's open files has private_data pointing to tty_file_private */ 338/* Each of a tty's open files has private_data pointing to tty_file_private */
339struct tty_file_private { 339struct tty_file_private {
diff --git a/include/linux/tty_driver.h b/include/linux/tty_driver.h
index b742b5e47cc2..00b2213f6a35 100644
--- a/include/linux/tty_driver.h
+++ b/include/linux/tty_driver.h
@@ -291,7 +291,7 @@ struct tty_operations {
291 void (*poll_put_char)(struct tty_driver *driver, int line, char ch); 291 void (*poll_put_char)(struct tty_driver *driver, int line, char ch);
292#endif 292#endif
293 const struct file_operations *proc_fops; 293 const struct file_operations *proc_fops;
294}; 294} __randomize_layout;
295 295
296struct tty_driver { 296struct tty_driver {
297 int magic; /* magic number for this structure */ 297 int magic; /* magic number for this structure */
@@ -325,7 +325,7 @@ struct tty_driver {
325 325
326 const struct tty_operations *ops; 326 const struct tty_operations *ops;
327 struct list_head tty_drivers; 327 struct list_head tty_drivers;
328}; 328} __randomize_layout;
329 329
330extern struct list_head tty_drivers; 330extern struct list_head tty_drivers;
331 331
diff --git a/include/linux/user_namespace.h b/include/linux/user_namespace.h
index 32354b4b4b2b..b3575ce29148 100644
--- a/include/linux/user_namespace.h
+++ b/include/linux/user_namespace.h
@@ -66,7 +66,7 @@ struct user_namespace {
66#endif 66#endif
67 struct ucounts *ucounts; 67 struct ucounts *ucounts;
68 int ucount_max[UCOUNT_COUNTS]; 68 int ucount_max[UCOUNT_COUNTS];
69}; 69} __randomize_layout;
70 70
71struct ucounts { 71struct ucounts {
72 struct hlist_node node; 72 struct hlist_node node;
diff --git a/include/linux/utsname.h b/include/linux/utsname.h
index 60f0bb83b313..da826ed059cf 100644
--- a/include/linux/utsname.h
+++ b/include/linux/utsname.h
@@ -26,7 +26,7 @@ struct uts_namespace {
26 struct user_namespace *user_ns; 26 struct user_namespace *user_ns;
27 struct ucounts *ucounts; 27 struct ucounts *ucounts;
28 struct ns_common ns; 28 struct ns_common ns;
29}; 29} __randomize_layout;
30extern struct uts_namespace init_uts_ns; 30extern struct uts_namespace init_uts_ns;
31 31
32#ifdef CONFIG_UTS_NS 32#ifdef CONFIG_UTS_NS
diff --git a/include/net/af_unix.h b/include/net/af_unix.h
index fd60eccb59a6..64e2a1e24a2c 100644
--- a/include/net/af_unix.h
+++ b/include/net/af_unix.h
@@ -36,7 +36,7 @@ struct unix_skb_parms {
36 u32 secid; /* Security ID */ 36 u32 secid; /* Security ID */
37#endif 37#endif
38 u32 consumed; 38 u32 consumed;
39}; 39} __randomize_layout;
40 40
41#define UNIXCB(skb) (*(struct unix_skb_parms *)&((skb)->cb)) 41#define UNIXCB(skb) (*(struct unix_skb_parms *)&((skb)->cb))
42 42
diff --git a/include/net/neighbour.h b/include/net/neighbour.h
index e4dd3a214034..a62959d2b3f7 100644
--- a/include/net/neighbour.h
+++ b/include/net/neighbour.h
@@ -155,7 +155,7 @@ struct neighbour {
155 struct rcu_head rcu; 155 struct rcu_head rcu;
156 struct net_device *dev; 156 struct net_device *dev;
157 u8 primary_key[0]; 157 u8 primary_key[0];
158}; 158} __randomize_layout;
159 159
160struct neigh_ops { 160struct neigh_ops {
161 int family; 161 int family;
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h
index fe80bb48ab1f..a224196d16ac 100644
--- a/include/net/net_namespace.h
+++ b/include/net/net_namespace.h
@@ -147,7 +147,7 @@ struct net {
147#endif 147#endif
148 struct sock *diag_nlsk; 148 struct sock *diag_nlsk;
149 atomic_t fnhe_genid; 149 atomic_t fnhe_genid;
150}; 150} __randomize_layout;
151 151
152#include <linux/seq_file_net.h> 152#include <linux/seq_file_net.h>
153 153
diff --git a/include/net/sock.h b/include/net/sock.h
index f33e3d134e0b..d349297db9e9 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -1113,7 +1113,7 @@ struct proto {
1113 atomic_t socks; 1113 atomic_t socks;
1114#endif 1114#endif
1115 int (*diag_destroy)(struct sock *sk, int err); 1115 int (*diag_destroy)(struct sock *sk, int err);
1116}; 1116} __randomize_layout;
1117 1117
1118int proto_register(struct proto *prot, int alloc_slab); 1118int proto_register(struct proto *prot, int alloc_slab);
1119void proto_unregister(struct proto *prot); 1119void proto_unregister(struct proto *prot);