aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/linux/binfmts.h4
-rw-r--r--include/linux/bpf-cgroup.h2
-rw-r--r--include/linux/bpf_verifier.h1
-rw-r--r--include/linux/cdev.h2
-rw-r--r--include/linux/ceph/ceph_features.h8
-rw-r--r--include/linux/compiler-gcc.h13
-rw-r--r--include/linux/compiler.h5
-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/ftrace.h6
-rw-r--r--include/linux/ipc.h2
-rw-r--r--include/linux/ipc_namespace.h2
-rw-r--r--include/linux/jhash.h29
-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/llist.h21
-rw-r--r--include/linux/lsm_hooks.h4
-rw-r--r--include/linux/mlx4/device.h10
-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/netfilter.h9
-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.h16
-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/trace_events.h2
-rw-r--r--include/linux/tty.h2
-rw-r--r--include/linux/tty_driver.h4
-rw-r--r--include/linux/usb/cdc_ncm.h1
-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/netlink.h4
-rw-r--r--include/net/sctp/sctp.h4
-rw-r--r--include/net/sock.h2
-rw-r--r--include/rdma/ib_verbs.h18
-rw-r--r--include/rdma/rdma_vt.h5
48 files changed, 151 insertions, 94 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/bpf-cgroup.h b/include/linux/bpf-cgroup.h
index 360c082e885c..d41d40ac3efd 100644
--- a/include/linux/bpf-cgroup.h
+++ b/include/linux/bpf-cgroup.h
@@ -85,7 +85,7 @@ int __cgroup_bpf_run_filter_sock_ops(struct sock *sk,
85 int __ret = 0; \ 85 int __ret = 0; \
86 if (cgroup_bpf_enabled && (sock_ops)->sk) { \ 86 if (cgroup_bpf_enabled && (sock_ops)->sk) { \
87 typeof(sk) __sk = sk_to_full_sk((sock_ops)->sk); \ 87 typeof(sk) __sk = sk_to_full_sk((sock_ops)->sk); \
88 if (sk_fullsock(__sk)) \ 88 if (__sk && sk_fullsock(__sk)) \
89 __ret = __cgroup_bpf_run_filter_sock_ops(__sk, \ 89 __ret = __cgroup_bpf_run_filter_sock_ops(__sk, \
90 sock_ops, \ 90 sock_ops, \
91 BPF_CGROUP_SOCK_OPS); \ 91 BPF_CGROUP_SOCK_OPS); \
diff --git a/include/linux/bpf_verifier.h b/include/linux/bpf_verifier.h
index 621076f56251..8e5d31f6faef 100644
--- a/include/linux/bpf_verifier.h
+++ b/include/linux/bpf_verifier.h
@@ -43,6 +43,7 @@ struct bpf_reg_state {
43 u32 min_align; 43 u32 min_align;
44 u32 aux_off; 44 u32 aux_off;
45 u32 aux_off_align; 45 u32 aux_off_align;
46 bool value_from_signed;
46}; 47};
47 48
48enum bpf_stack_slot_type { 49enum bpf_stack_slot_type {
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/ceph/ceph_features.h b/include/linux/ceph/ceph_features.h
index f0f6c537b64c..040dd105c3e7 100644
--- a/include/linux/ceph/ceph_features.h
+++ b/include/linux/ceph/ceph_features.h
@@ -10,14 +10,14 @@
10#define CEPH_FEATURE_INCARNATION_2 (1ull<<57) // CEPH_FEATURE_SERVER_JEWEL 10#define CEPH_FEATURE_INCARNATION_2 (1ull<<57) // CEPH_FEATURE_SERVER_JEWEL
11 11
12#define DEFINE_CEPH_FEATURE(bit, incarnation, name) \ 12#define DEFINE_CEPH_FEATURE(bit, incarnation, name) \
13 const static uint64_t CEPH_FEATURE_##name = (1ULL<<bit); \ 13 static const uint64_t CEPH_FEATURE_##name = (1ULL<<bit); \
14 const static uint64_t CEPH_FEATUREMASK_##name = \ 14 static const uint64_t CEPH_FEATUREMASK_##name = \
15 (1ULL<<bit | CEPH_FEATURE_INCARNATION_##incarnation); 15 (1ULL<<bit | CEPH_FEATURE_INCARNATION_##incarnation);
16 16
17/* this bit is ignored but still advertised by release *when* */ 17/* this bit is ignored but still advertised by release *when* */
18#define DEFINE_CEPH_FEATURE_DEPRECATED(bit, incarnation, name, when) \ 18#define DEFINE_CEPH_FEATURE_DEPRECATED(bit, incarnation, name, when) \
19 const static uint64_t DEPRECATED_CEPH_FEATURE_##name = (1ULL<<bit); \ 19 static const uint64_t DEPRECATED_CEPH_FEATURE_##name = (1ULL<<bit); \
20 const static uint64_t DEPRECATED_CEPH_FEATUREMASK_##name = \ 20 static const uint64_t DEPRECATED_CEPH_FEATUREMASK_##name = \
21 (1ULL<<bit | CEPH_FEATURE_INCARNATION_##incarnation); 21 (1ULL<<bit | CEPH_FEATURE_INCARNATION_##incarnation);
22 22
23/* 23/*
diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h
index cd4bbe8242bd..bdb80c4aef6e 100644
--- a/include/linux/compiler-gcc.h
+++ b/include/linux/compiler-gcc.h
@@ -235,6 +235,7 @@
235#endif /* GCC_VERSION >= 40500 */ 235#endif /* GCC_VERSION >= 40500 */
236 236
237#if GCC_VERSION >= 40600 237#if GCC_VERSION >= 40600
238
238/* 239/*
239 * When used with Link Time Optimization, gcc can optimize away C functions or 240 * When used with Link Time Optimization, gcc can optimize away C functions or
240 * variables which are referenced only from assembly code. __visible tells the 241 * variables which are referenced only from assembly code. __visible tells the
@@ -242,7 +243,17 @@
242 * this. 243 * this.
243 */ 244 */
244#define __visible __attribute__((externally_visible)) 245#define __visible __attribute__((externally_visible))
245#endif 246
247/*
248 * RANDSTRUCT_PLUGIN wants to use an anonymous struct, but it is only
249 * possible since GCC 4.6. To provide as much build testing coverage
250 * as possible, this is used for all GCC 4.6+ builds, and not just on
251 * RANDSTRUCT_PLUGIN builds.
252 */
253#define randomized_struct_fields_start struct {
254#define randomized_struct_fields_end } __randomize_layout;
255
256#endif /* GCC_VERSION >= 40600 */
246 257
247 258
248#if GCC_VERSION >= 40900 && !defined(__CHECKER__) 259#if GCC_VERSION >= 40900 && !defined(__CHECKER__)
diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index 219f82f3ec1a..eca8ad75e28b 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -452,6 +452,11 @@ static __always_inline void __write_once_size(volatile void *p, void *res, int s
452# define __no_randomize_layout 452# define __no_randomize_layout
453#endif 453#endif
454 454
455#ifndef randomized_struct_fields_start
456# define randomized_struct_fields_start
457# define randomized_struct_fields_end
458#endif
459
455/* 460/*
456 * Tell gcc if a function is cold. The compiler will assume any path 461 * Tell gcc if a function is cold. The compiler will assume any path
457 * directly leading to the call is unlikely. 462 * directly leading to the call is unlikely.
diff --git a/include/linux/cred.h b/include/linux/cred.h
index c728d515e5e2..099058e1178b 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 3f3ff4ccdc3f..aae1cdb76851 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -118,7 +118,7 @@ struct dentry {
118 struct hlist_bl_node d_in_lookup_hash; /* only for in-lookup ones */ 118 struct hlist_bl_node d_in_lookup_hash; /* only for in-lookup ones */
119 struct rcu_head d_rcu; 119 struct rcu_head d_rcu;
120 } d_u; 120 } d_u;
121}; 121} __randomize_layout;
122 122
123/* 123/*
124 * dentry->d_lock spinlock nesting subclasses: 124 * dentry->d_lock spinlock nesting subclasses:
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 7b5d6816542b..6e1fd5d21248 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -296,7 +296,7 @@ struct kiocb {
296 void *private; 296 void *private;
297 int ki_flags; 297 int ki_flags;
298 enum rw_hint ki_hint; 298 enum rw_hint ki_hint;
299}; 299} __randomize_layout;
300 300
301static inline bool is_sync_kiocb(struct kiocb *kiocb) 301static inline bool is_sync_kiocb(struct kiocb *kiocb)
302{ 302{
@@ -404,7 +404,7 @@ struct address_space {
404 struct list_head private_list; /* ditto */ 404 struct list_head private_list; /* ditto */
405 void *private_data; /* ditto */ 405 void *private_data; /* ditto */
406 errseq_t wb_err; 406 errseq_t wb_err;
407} __attribute__((aligned(sizeof(long)))); 407} __attribute__((aligned(sizeof(long)))) __randomize_layout;
408 /* 408 /*
409 * On most architectures that alignment is already the case; but 409 * On most architectures that alignment is already the case; but
410 * must be enforced here for CRIS, to let the least significant bit 410 * must be enforced here for CRIS, to let the least significant bit
@@ -447,7 +447,7 @@ struct block_device {
447 int bd_fsfreeze_count; 447 int bd_fsfreeze_count;
448 /* Mutex for freeze */ 448 /* Mutex for freeze */
449 struct mutex bd_fsfreeze_mutex; 449 struct mutex bd_fsfreeze_mutex;
450}; 450} __randomize_layout;
451 451
452/* 452/*
453 * Radix-tree tags, for tagging dirty and writeback pages within the pagecache 453 * Radix-tree tags, for tagging dirty and writeback pages within the pagecache
@@ -666,7 +666,7 @@ struct inode {
666#endif 666#endif
667 667
668 void *i_private; /* fs or device private pointer */ 668 void *i_private; /* fs or device private pointer */
669}; 669} __randomize_layout;
670 670
671static inline unsigned int i_blocksize(const struct inode *node) 671static inline unsigned int i_blocksize(const struct inode *node)
672{ 672{
@@ -883,7 +883,8 @@ struct file {
883#endif /* #ifdef CONFIG_EPOLL */ 883#endif /* #ifdef CONFIG_EPOLL */
884 struct address_space *f_mapping; 884 struct address_space *f_mapping;
885 errseq_t f_wb_err; 885 errseq_t f_wb_err;
886} __attribute__((aligned(4))); /* lest something weird decides that 2 is OK */ 886} __randomize_layout
887 __attribute__((aligned(4))); /* lest something weird decides that 2 is OK */
887 888
888struct file_handle { 889struct file_handle {
889 __u32 handle_bytes; 890 __u32 handle_bytes;
@@ -1020,7 +1021,7 @@ struct file_lock {
1020 int state; /* state of grant or error if -ve */ 1021 int state; /* state of grant or error if -ve */
1021 } afs; 1022 } afs;
1022 } fl_u; 1023 } fl_u;
1023}; 1024} __randomize_layout;
1024 1025
1025struct file_lock_context { 1026struct file_lock_context {
1026 spinlock_t flc_lock; 1027 spinlock_t flc_lock;
@@ -1412,7 +1413,7 @@ struct super_block {
1412 1413
1413 spinlock_t s_inode_wblist_lock; 1414 spinlock_t s_inode_wblist_lock;
1414 struct list_head s_inodes_wb; /* writeback inodes */ 1415 struct list_head s_inodes_wb; /* writeback inodes */
1415}; 1416} __randomize_layout;
1416 1417
1417/* Helper functions so that in most cases filesystems will 1418/* Helper functions so that in most cases filesystems will
1418 * not need to deal directly with kuid_t and kgid_t and can 1419 * not need to deal directly with kuid_t and kgid_t and can
@@ -1698,7 +1699,7 @@ struct file_operations {
1698 u64); 1699 u64);
1699 ssize_t (*dedupe_file_range)(struct file *, u64, u64, struct file *, 1700 ssize_t (*dedupe_file_range)(struct file *, u64, u64, struct file *,
1700 u64); 1701 u64);
1701}; 1702} __randomize_layout;
1702 1703
1703struct inode_operations { 1704struct inode_operations {
1704 struct dentry * (*lookup) (struct inode *,struct dentry *, unsigned int); 1705 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/ftrace.h b/include/linux/ftrace.h
index 5857390ac35a..6383115e9d2c 100644
--- a/include/linux/ftrace.h
+++ b/include/linux/ftrace.h
@@ -145,8 +145,8 @@ enum {
145#ifdef CONFIG_DYNAMIC_FTRACE 145#ifdef CONFIG_DYNAMIC_FTRACE
146/* The hash used to know what functions callbacks trace */ 146/* The hash used to know what functions callbacks trace */
147struct ftrace_ops_hash { 147struct ftrace_ops_hash {
148 struct ftrace_hash *notrace_hash; 148 struct ftrace_hash __rcu *notrace_hash;
149 struct ftrace_hash *filter_hash; 149 struct ftrace_hash __rcu *filter_hash;
150 struct mutex regex_lock; 150 struct mutex regex_lock;
151}; 151};
152 152
@@ -168,7 +168,7 @@ static inline void ftrace_free_init_mem(void) { }
168 */ 168 */
169struct ftrace_ops { 169struct ftrace_ops {
170 ftrace_func_t func; 170 ftrace_func_t func;
171 struct ftrace_ops *next; 171 struct ftrace_ops __rcu *next;
172 unsigned long flags; 172 unsigned long flags;
173 void *private; 173 void *private;
174 ftrace_func_t saved_func; 174 ftrace_func_t saved_func;
diff --git a/include/linux/ipc.h b/include/linux/ipc.h
index 5591f055e13f..fadd579d577d 100644
--- a/include/linux/ipc.h
+++ b/include/linux/ipc.h
@@ -23,6 +23,6 @@ struct kern_ipc_perm {
23 23
24 struct rcu_head rcu; 24 struct rcu_head rcu;
25 atomic_t refcount; 25 atomic_t refcount;
26} ____cacheline_aligned_in_smp; 26} ____cacheline_aligned_in_smp __randomize_layout;
27 27
28#endif /* _LINUX_IPC_H */ 28#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/jhash.h b/include/linux/jhash.h
index 348c6f47e4cc..8037850f3104 100644
--- a/include/linux/jhash.h
+++ b/include/linux/jhash.h
@@ -85,19 +85,18 @@ static inline u32 jhash(const void *key, u32 length, u32 initval)
85 k += 12; 85 k += 12;
86 } 86 }
87 /* Last block: affect all 32 bits of (c) */ 87 /* Last block: affect all 32 bits of (c) */
88 /* All the case statements fall through */
89 switch (length) { 88 switch (length) {
90 case 12: c += (u32)k[11]<<24; 89 case 12: c += (u32)k[11]<<24; /* fall through */
91 case 11: c += (u32)k[10]<<16; 90 case 11: c += (u32)k[10]<<16; /* fall through */
92 case 10: c += (u32)k[9]<<8; 91 case 10: c += (u32)k[9]<<8; /* fall through */
93 case 9: c += k[8]; 92 case 9: c += k[8]; /* fall through */
94 case 8: b += (u32)k[7]<<24; 93 case 8: b += (u32)k[7]<<24; /* fall through */
95 case 7: b += (u32)k[6]<<16; 94 case 7: b += (u32)k[6]<<16; /* fall through */
96 case 6: b += (u32)k[5]<<8; 95 case 6: b += (u32)k[5]<<8; /* fall through */
97 case 5: b += k[4]; 96 case 5: b += k[4]; /* fall through */
98 case 4: a += (u32)k[3]<<24; 97 case 4: a += (u32)k[3]<<24; /* fall through */
99 case 3: a += (u32)k[2]<<16; 98 case 3: a += (u32)k[2]<<16; /* fall through */
100 case 2: a += (u32)k[1]<<8; 99 case 2: a += (u32)k[1]<<8; /* fall through */
101 case 1: a += k[0]; 100 case 1: a += k[0];
102 __jhash_final(a, b, c); 101 __jhash_final(a, b, c);
103 case 0: /* Nothing left to add */ 102 case 0: /* Nothing left to add */
@@ -131,10 +130,10 @@ static inline u32 jhash2(const u32 *k, u32 length, u32 initval)
131 k += 3; 130 k += 3;
132 } 131 }
133 132
134 /* Handle the last 3 u32's: all the case statements fall through */ 133 /* Handle the last 3 u32's */
135 switch (length) { 134 switch (length) {
136 case 3: c += k[2]; 135 case 3: c += k[2]; /* fall through */
137 case 2: b += k[1]; 136 case 2: b += k[1]; /* fall through */
138 case 1: a += k[0]; 137 case 1: a += k[0];
139 __jhash_final(a, b, c); 138 __jhash_final(a, b, c);
140 case 0: /* Nothing left to add */ 139 case 0: /* Nothing left to add */
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 eeab34b0f589..4d800c79475a 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/llist.h b/include/linux/llist.h
index d11738110a7a..1957635e6d5f 100644
--- a/include/linux/llist.h
+++ b/include/linux/llist.h
@@ -93,6 +93,23 @@ static inline void init_llist_head(struct llist_head *list)
93 container_of(ptr, type, member) 93 container_of(ptr, type, member)
94 94
95/** 95/**
96 * member_address_is_nonnull - check whether the member address is not NULL
97 * @ptr: the object pointer (struct type * that contains the llist_node)
98 * @member: the name of the llist_node within the struct.
99 *
100 * This macro is conceptually the same as
101 * &ptr->member != NULL
102 * but it works around the fact that compilers can decide that taking a member
103 * address is never a NULL pointer.
104 *
105 * Real objects that start at a high address and have a member at NULL are
106 * unlikely to exist, but such pointers may be returned e.g. by the
107 * container_of() macro.
108 */
109#define member_address_is_nonnull(ptr, member) \
110 ((uintptr_t)(ptr) + offsetof(typeof(*(ptr)), member) != 0)
111
112/**
96 * llist_for_each - iterate over some deleted entries of a lock-less list 113 * llist_for_each - iterate over some deleted entries of a lock-less list
97 * @pos: the &struct llist_node to use as a loop cursor 114 * @pos: the &struct llist_node to use as a loop cursor
98 * @node: the first entry of deleted list entries 115 * @node: the first entry of deleted list entries
@@ -145,7 +162,7 @@ static inline void init_llist_head(struct llist_head *list)
145 */ 162 */
146#define llist_for_each_entry(pos, node, member) \ 163#define llist_for_each_entry(pos, node, member) \
147 for ((pos) = llist_entry((node), typeof(*(pos)), member); \ 164 for ((pos) = llist_entry((node), typeof(*(pos)), member); \
148 &(pos)->member != NULL; \ 165 member_address_is_nonnull(pos, member); \
149 (pos) = llist_entry((pos)->member.next, typeof(*(pos)), member)) 166 (pos) = llist_entry((pos)->member.next, typeof(*(pos)), member))
150 167
151/** 168/**
@@ -167,7 +184,7 @@ static inline void init_llist_head(struct llist_head *list)
167 */ 184 */
168#define llist_for_each_entry_safe(pos, n, node, member) \ 185#define llist_for_each_entry_safe(pos, n, node, member) \
169 for (pos = llist_entry((node), typeof(*pos), member); \ 186 for (pos = llist_entry((node), typeof(*pos), member); \
170 &pos->member != NULL && \ 187 member_address_is_nonnull(pos, member) && \
171 (n = llist_entry(pos->member.next, typeof(*n), member), true); \ 188 (n = llist_entry(pos->member.next, typeof(*n), member), true); \
172 pos = n) 189 pos = n)
173 190
diff --git a/include/linux/lsm_hooks.h b/include/linux/lsm_hooks.h
index 7a86925ba8f3..3a90febadbe2 100644
--- a/include/linux/lsm_hooks.h
+++ b/include/linux/lsm_hooks.h
@@ -1912,7 +1912,7 @@ struct security_hook_heads {
1912 struct list_head audit_rule_match; 1912 struct list_head audit_rule_match;
1913 struct list_head audit_rule_free; 1913 struct list_head audit_rule_free;
1914#endif /* CONFIG_AUDIT */ 1914#endif /* CONFIG_AUDIT */
1915}; 1915} __randomize_layout;
1916 1916
1917/* 1917/*
1918 * Security module hook list structure. 1918 * Security module hook list structure.
@@ -1923,7 +1923,7 @@ struct security_hook_list {
1923 struct list_head *head; 1923 struct list_head *head;
1924 union security_list_options hook; 1924 union security_list_options hook;
1925 char *lsm; 1925 char *lsm;
1926}; 1926} __randomize_layout;
1927 1927
1928/* 1928/*
1929 * Initializing a security_hook_list structure takes 1929 * Initializing a security_hook_list structure takes
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h
index d5bed0875d30..aad5d81dfb44 100644
--- a/include/linux/mlx4/device.h
+++ b/include/linux/mlx4/device.h
@@ -1068,7 +1068,7 @@ static inline int mlx4_is_eth(struct mlx4_dev *dev, int port)
1068} 1068}
1069 1069
1070int mlx4_buf_alloc(struct mlx4_dev *dev, int size, int max_direct, 1070int mlx4_buf_alloc(struct mlx4_dev *dev, int size, int max_direct,
1071 struct mlx4_buf *buf, gfp_t gfp); 1071 struct mlx4_buf *buf);
1072void mlx4_buf_free(struct mlx4_dev *dev, int size, struct mlx4_buf *buf); 1072void mlx4_buf_free(struct mlx4_dev *dev, int size, struct mlx4_buf *buf);
1073static inline void *mlx4_buf_offset(struct mlx4_buf *buf, int offset) 1073static inline void *mlx4_buf_offset(struct mlx4_buf *buf, int offset)
1074{ 1074{
@@ -1105,10 +1105,9 @@ int mlx4_mw_enable(struct mlx4_dev *dev, struct mlx4_mw *mw);
1105int mlx4_write_mtt(struct mlx4_dev *dev, struct mlx4_mtt *mtt, 1105int mlx4_write_mtt(struct mlx4_dev *dev, struct mlx4_mtt *mtt,
1106 int start_index, int npages, u64 *page_list); 1106 int start_index, int npages, u64 *page_list);
1107int mlx4_buf_write_mtt(struct mlx4_dev *dev, struct mlx4_mtt *mtt, 1107int mlx4_buf_write_mtt(struct mlx4_dev *dev, struct mlx4_mtt *mtt,
1108 struct mlx4_buf *buf, gfp_t gfp); 1108 struct mlx4_buf *buf);
1109 1109
1110int mlx4_db_alloc(struct mlx4_dev *dev, struct mlx4_db *db, int order, 1110int mlx4_db_alloc(struct mlx4_dev *dev, struct mlx4_db *db, int order);
1111 gfp_t gfp);
1112void mlx4_db_free(struct mlx4_dev *dev, struct mlx4_db *db); 1111void mlx4_db_free(struct mlx4_dev *dev, struct mlx4_db *db);
1113 1112
1114int mlx4_alloc_hwq_res(struct mlx4_dev *dev, struct mlx4_hwq_resources *wqres, 1113int mlx4_alloc_hwq_res(struct mlx4_dev *dev, struct mlx4_hwq_resources *wqres,
@@ -1124,8 +1123,7 @@ int mlx4_qp_reserve_range(struct mlx4_dev *dev, int cnt, int align,
1124 int *base, u8 flags); 1123 int *base, u8 flags);
1125void mlx4_qp_release_range(struct mlx4_dev *dev, int base_qpn, int cnt); 1124void mlx4_qp_release_range(struct mlx4_dev *dev, int base_qpn, int cnt);
1126 1125
1127int mlx4_qp_alloc(struct mlx4_dev *dev, int qpn, struct mlx4_qp *qp, 1126int mlx4_qp_alloc(struct mlx4_dev *dev, int qpn, struct mlx4_qp *qp);
1128 gfp_t gfp);
1129void mlx4_qp_free(struct mlx4_dev *dev, struct mlx4_qp *qp); 1127void mlx4_qp_free(struct mlx4_dev *dev, struct mlx4_qp *qp);
1130 1128
1131int mlx4_srq_alloc(struct mlx4_dev *dev, u32 pdn, u32 cqn, u16 xrcdn, 1129int mlx4_srq_alloc(struct mlx4_dev *dev, u32 pdn, u32 cqn, u16 xrcdn,
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 8eb9a1e693e5..e7bdd549e527 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/netfilter.h b/include/linux/netfilter.h
index a4b97be30b28..22f081065d49 100644
--- a/include/linux/netfilter.h
+++ b/include/linux/netfilter.h
@@ -61,8 +61,6 @@ typedef unsigned int nf_hookfn(void *priv,
61 struct sk_buff *skb, 61 struct sk_buff *skb,
62 const struct nf_hook_state *state); 62 const struct nf_hook_state *state);
63struct nf_hook_ops { 63struct nf_hook_ops {
64 struct list_head list;
65
66 /* User fills in from here down. */ 64 /* User fills in from here down. */
67 nf_hookfn *hook; 65 nf_hookfn *hook;
68 struct net_device *dev; 66 struct net_device *dev;
@@ -160,13 +158,6 @@ int nf_register_net_hooks(struct net *net, const struct nf_hook_ops *reg,
160void nf_unregister_net_hooks(struct net *net, const struct nf_hook_ops *reg, 158void nf_unregister_net_hooks(struct net *net, const struct nf_hook_ops *reg,
161 unsigned int n); 159 unsigned int n);
162 160
163int nf_register_hook(struct nf_hook_ops *reg);
164void nf_unregister_hook(struct nf_hook_ops *reg);
165int nf_register_hooks(struct nf_hook_ops *reg, unsigned int n);
166void nf_unregister_hooks(struct nf_hook_ops *reg, unsigned int n);
167int _nf_register_hooks(struct nf_hook_ops *reg, unsigned int n);
168void _nf_unregister_hooks(struct nf_hook_ops *reg, unsigned int n);
169
170/* Functions to register get/setsockopt ranges (non-inclusive). You 161/* Functions to register get/setsockopt ranges (non-inclusive). You
171 need to check permissions yourself! */ 162 need to check permissions yourself! */
172int nf_register_sockopt(struct nf_sockopt_ops *reg); 163int nf_register_sockopt(struct nf_sockopt_ops *reg);
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 2ba9ec93423f..8337e2db0bb2 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -426,7 +426,7 @@ struct sched_rt_entity {
426 /* rq "owned" by this entity/group: */ 426 /* rq "owned" by this entity/group: */
427 struct rt_rq *my_q; 427 struct rt_rq *my_q;
428#endif 428#endif
429}; 429} __randomize_layout;
430 430
431struct sched_dl_entity { 431struct sched_dl_entity {
432 struct rb_node rb_node; 432 struct rb_node rb_node;
@@ -526,6 +526,13 @@ struct task_struct {
526#endif 526#endif
527 /* -1 unrunnable, 0 runnable, >0 stopped: */ 527 /* -1 unrunnable, 0 runnable, >0 stopped: */
528 volatile long state; 528 volatile long state;
529
530 /*
531 * This begins the randomizable portion of task_struct. Only
532 * scheduling-critical items should be added above here.
533 */
534 randomized_struct_fields_start
535
529 void *stack; 536 void *stack;
530 atomic_t usage; 537 atomic_t usage;
531 /* Per task flags (PF_*), defined further below: */ 538 /* Per task flags (PF_*), defined further below: */
@@ -1079,6 +1086,13 @@ struct task_struct {
1079 /* Used by LSM modules for access restriction: */ 1086 /* Used by LSM modules for access restriction: */
1080 void *security; 1087 void *security;
1081#endif 1088#endif
1089
1090 /*
1091 * New fields for task_struct should be added above here, so that
1092 * they are included in the randomized portion of task_struct.
1093 */
1094 randomized_struct_fields_end
1095
1082 /* CPU-specific state of this task: */ 1096 /* CPU-specific state of this task: */
1083 struct thread_struct thread; 1097 struct thread_struct thread;
1084 1098
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 be5cf2ea14ad..de2deb8676bd 100644
--- a/include/linux/sem.h
+++ b/include/linux/sem.h
@@ -41,7 +41,7 @@ struct sem_array {
41 unsigned int use_global_lock;/* >0: global lock required */ 41 unsigned int use_global_lock;/* >0: global lock required */
42 42
43 struct sem sems[]; 43 struct sem sems[];
44}; 44} __randomize_layout;
45 45
46#ifdef CONFIG_SYSVIPC 46#ifdef CONFIG_SYSVIPC
47 47
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 3a89b9ff4cdc..1d4dba490fb6 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -120,7 +120,7 @@ struct ctl_table
120 struct ctl_table_poll *poll; 120 struct ctl_table_poll *poll;
121 void *extra1; 121 void *extra1;
122 void *extra2; 122 void *extra2;
123}; 123} __randomize_layout;
124 124
125struct ctl_node { 125struct ctl_node {
126 struct rb_node node; 126 struct rb_node node;
diff --git a/include/linux/trace_events.h b/include/linux/trace_events.h
index f73cedfa2e0b..536c80ff7ad9 100644
--- a/include/linux/trace_events.h
+++ b/include/linux/trace_events.h
@@ -338,7 +338,7 @@ enum {
338struct trace_event_file { 338struct trace_event_file {
339 struct list_head list; 339 struct list_head list;
340 struct trace_event_call *event_call; 340 struct trace_event_call *event_call;
341 struct event_filter *filter; 341 struct event_filter __rcu *filter;
342 struct dentry *dir; 342 struct dentry *dir;
343 struct trace_array *tr; 343 struct trace_array *tr;
344 struct trace_subsystem_dir *system; 344 struct trace_subsystem_dir *system;
diff --git a/include/linux/tty.h b/include/linux/tty.h
index 69464c0d8068..79c30daf46a9 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -332,7 +332,7 @@ struct tty_struct {
332 /* If the tty has a pending do_SAK, queue it here - akpm */ 332 /* If the tty has a pending do_SAK, queue it here - akpm */
333 struct work_struct SAK_work; 333 struct work_struct SAK_work;
334 struct tty_port *port; 334 struct tty_port *port;
335}; 335} __randomize_layout;
336 336
337/* Each of a tty's open files has private_data pointing to tty_file_private */ 337/* Each of a tty's open files has private_data pointing to tty_file_private */
338struct tty_file_private { 338struct 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/usb/cdc_ncm.h b/include/linux/usb/cdc_ncm.h
index 021f7a88f52c..1a59699cf82a 100644
--- a/include/linux/usb/cdc_ncm.h
+++ b/include/linux/usb/cdc_ncm.h
@@ -83,6 +83,7 @@
83/* Driver flags */ 83/* Driver flags */
84#define CDC_NCM_FLAG_NDP_TO_END 0x02 /* NDP is placed at end of frame */ 84#define CDC_NCM_FLAG_NDP_TO_END 0x02 /* NDP is placed at end of frame */
85#define CDC_MBIM_FLAG_AVOID_ALTSETTING_TOGGLE 0x04 /* Avoid altsetting toggle during init */ 85#define CDC_MBIM_FLAG_AVOID_ALTSETTING_TOGGLE 0x04 /* Avoid altsetting toggle during init */
86#define CDC_NCM_FLAG_RESET_NTB16 0x08 /* set NDP16 one more time after altsetting switch */
86 87
87#define cdc_ncm_comm_intf_is_mbim(x) ((x)->desc.bInterfaceSubClass == USB_CDC_SUBCLASS_MBIM && \ 88#define cdc_ncm_comm_intf_is_mbim(x) ((x)->desc.bInterfaceSubClass == USB_CDC_SUBCLASS_MBIM && \
88 (x)->desc.bInterfaceProtocol == USB_CDC_PROTO_NONE) 89 (x)->desc.bInterfaceProtocol == USB_CDC_PROTO_NONE)
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 678e4d6fa317..53b1a2cca421 100644
--- a/include/net/af_unix.h
+++ b/include/net/af_unix.h
@@ -37,7 +37,7 @@ struct unix_skb_parms {
37 u32 secid; /* Security ID */ 37 u32 secid; /* Security ID */
38#endif 38#endif
39 u32 consumed; 39 u32 consumed;
40}; 40} __randomize_layout;
41 41
42#define UNIXCB(skb) (*(struct unix_skb_parms *)&((skb)->cb)) 42#define UNIXCB(skb) (*(struct unix_skb_parms *)&((skb)->cb))
43 43
diff --git a/include/net/neighbour.h b/include/net/neighbour.h
index afc39e3a3f7c..9816df225af3 100644
--- a/include/net/neighbour.h
+++ b/include/net/neighbour.h
@@ -156,7 +156,7 @@ struct neighbour {
156 struct rcu_head rcu; 156 struct rcu_head rcu;
157 struct net_device *dev; 157 struct net_device *dev;
158 u8 primary_key[0]; 158 u8 primary_key[0];
159}; 159} __randomize_layout;
160 160
161struct neigh_ops { 161struct neigh_ops {
162 int family; 162 int family;
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h
index 31a2b51bef2c..1c401bd4c2e0 100644
--- a/include/net/net_namespace.h
+++ b/include/net/net_namespace.h
@@ -148,7 +148,7 @@ struct net {
148#endif 148#endif
149 struct sock *diag_nlsk; 149 struct sock *diag_nlsk;
150 atomic_t fnhe_genid; 150 atomic_t fnhe_genid;
151}; 151} __randomize_layout;
152 152
153#include <linux/seq_file_net.h> 153#include <linux/seq_file_net.h>
154 154
diff --git a/include/net/netlink.h b/include/net/netlink.h
index 01709172b3d3..ef8e6c3a80a6 100644
--- a/include/net/netlink.h
+++ b/include/net/netlink.h
@@ -98,8 +98,8 @@
98 * nla_put_u8(skb, type, value) add u8 attribute to skb 98 * nla_put_u8(skb, type, value) add u8 attribute to skb
99 * nla_put_u16(skb, type, value) add u16 attribute to skb 99 * nla_put_u16(skb, type, value) add u16 attribute to skb
100 * nla_put_u32(skb, type, value) add u32 attribute to skb 100 * nla_put_u32(skb, type, value) add u32 attribute to skb
101 * nla_put_u64_64bits(skb, type, 101 * nla_put_u64_64bit(skb, type,
102 * value, padattr) add u64 attribute to skb 102 * value, padattr) add u64 attribute to skb
103 * nla_put_s8(skb, type, value) add s8 attribute to skb 103 * nla_put_s8(skb, type, value) add s8 attribute to skb
104 * nla_put_s16(skb, type, value) add s16 attribute to skb 104 * nla_put_s16(skb, type, value) add s16 attribute to skb
105 * nla_put_s32(skb, type, value) add s32 attribute to skb 105 * nla_put_s32(skb, type, value) add s32 attribute to skb
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h
index a9519a06a23b..980807d7506f 100644
--- a/include/net/sctp/sctp.h
+++ b/include/net/sctp/sctp.h
@@ -469,6 +469,8 @@ _sctp_walk_params((pos), (chunk), ntohs((chunk)->chunk_hdr.length), member)
469 469
470#define _sctp_walk_params(pos, chunk, end, member)\ 470#define _sctp_walk_params(pos, chunk, end, member)\
471for (pos.v = chunk->member;\ 471for (pos.v = chunk->member;\
472 (pos.v + offsetof(struct sctp_paramhdr, length) + sizeof(pos.p->length) <\
473 (void *)chunk + end) &&\
472 pos.v <= (void *)chunk + end - ntohs(pos.p->length) &&\ 474 pos.v <= (void *)chunk + end - ntohs(pos.p->length) &&\
473 ntohs(pos.p->length) >= sizeof(struct sctp_paramhdr);\ 475 ntohs(pos.p->length) >= sizeof(struct sctp_paramhdr);\
474 pos.v += SCTP_PAD4(ntohs(pos.p->length))) 476 pos.v += SCTP_PAD4(ntohs(pos.p->length)))
@@ -479,6 +481,8 @@ _sctp_walk_errors((err), (chunk_hdr), ntohs((chunk_hdr)->length))
479#define _sctp_walk_errors(err, chunk_hdr, end)\ 481#define _sctp_walk_errors(err, chunk_hdr, end)\
480for (err = (sctp_errhdr_t *)((void *)chunk_hdr + \ 482for (err = (sctp_errhdr_t *)((void *)chunk_hdr + \
481 sizeof(struct sctp_chunkhdr));\ 483 sizeof(struct sctp_chunkhdr));\
484 ((void *)err + offsetof(sctp_errhdr_t, length) + sizeof(err->length) <\
485 (void *)chunk_hdr + end) &&\
482 (void *)err <= (void *)chunk_hdr + end - ntohs(err->length) &&\ 486 (void *)err <= (void *)chunk_hdr + end - ntohs(err->length) &&\
483 ntohs(err->length) >= sizeof(sctp_errhdr_t); \ 487 ntohs(err->length) >= sizeof(sctp_errhdr_t); \
484 err = (sctp_errhdr_t *)((void *)err + SCTP_PAD4(ntohs(err->length)))) 488 err = (sctp_errhdr_t *)((void *)err + SCTP_PAD4(ntohs(err->length))))
diff --git a/include/net/sock.h b/include/net/sock.h
index f69c8c2782df..7c0632c7e870 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -1128,7 +1128,7 @@ struct proto {
1128 atomic_t socks; 1128 atomic_t socks;
1129#endif 1129#endif
1130 int (*diag_destroy)(struct sock *sk, int err); 1130 int (*diag_destroy)(struct sock *sk, int err);
1131}; 1131} __randomize_layout;
1132 1132
1133int proto_register(struct proto *prot, int alloc_slab); 1133int proto_register(struct proto *prot, int alloc_slab);
1134void proto_unregister(struct proto *prot); 1134void proto_unregister(struct proto *prot);
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index 356953d3dbd1..b5732432bb29 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -1056,7 +1056,7 @@ enum ib_qp_create_flags {
1056 IB_QP_CREATE_MANAGED_RECV = 1 << 4, 1056 IB_QP_CREATE_MANAGED_RECV = 1 << 4,
1057 IB_QP_CREATE_NETIF_QP = 1 << 5, 1057 IB_QP_CREATE_NETIF_QP = 1 << 5,
1058 IB_QP_CREATE_SIGNATURE_EN = 1 << 6, 1058 IB_QP_CREATE_SIGNATURE_EN = 1 << 6,
1059 IB_QP_CREATE_USE_GFP_NOIO = 1 << 7, 1059 /* FREE = 1 << 7, */
1060 IB_QP_CREATE_SCATTER_FCS = 1 << 8, 1060 IB_QP_CREATE_SCATTER_FCS = 1 << 8,
1061 IB_QP_CREATE_CVLAN_STRIPPING = 1 << 9, 1061 IB_QP_CREATE_CVLAN_STRIPPING = 1 << 9,
1062 /* reserve bits 26-31 for low level drivers' internal use */ 1062 /* reserve bits 26-31 for low level drivers' internal use */
@@ -2948,6 +2948,22 @@ struct ib_qp *ib_create_qp(struct ib_pd *pd,
2948 struct ib_qp_init_attr *qp_init_attr); 2948 struct ib_qp_init_attr *qp_init_attr);
2949 2949
2950/** 2950/**
2951 * ib_modify_qp_with_udata - Modifies the attributes for the specified QP.
2952 * @qp: The QP to modify.
2953 * @attr: On input, specifies the QP attributes to modify. On output,
2954 * the current values of selected QP attributes are returned.
2955 * @attr_mask: A bit-mask used to specify which attributes of the QP
2956 * are being modified.
2957 * @udata: pointer to user's input output buffer information
2958 * are being modified.
2959 * It returns 0 on success and returns appropriate error code on error.
2960 */
2961int ib_modify_qp_with_udata(struct ib_qp *qp,
2962 struct ib_qp_attr *attr,
2963 int attr_mask,
2964 struct ib_udata *udata);
2965
2966/**
2951 * ib_modify_qp - Modifies the attributes for the specified QP and then 2967 * ib_modify_qp - Modifies the attributes for the specified QP and then
2952 * transitions the QP to the given state. 2968 * transitions the QP to the given state.
2953 * @qp: The QP to modify. 2969 * @qp: The QP to modify.
diff --git a/include/rdma/rdma_vt.h b/include/rdma/rdma_vt.h
index 4878aaf7bdff..55af69271053 100644
--- a/include/rdma/rdma_vt.h
+++ b/include/rdma/rdma_vt.h
@@ -229,8 +229,7 @@ struct rvt_driver_provided {
229 * ERR_PTR(err). The driver is free to return NULL or a valid 229 * ERR_PTR(err). The driver is free to return NULL or a valid
230 * pointer. 230 * pointer.
231 */ 231 */
232 void * (*qp_priv_alloc)(struct rvt_dev_info *rdi, struct rvt_qp *qp, 232 void * (*qp_priv_alloc)(struct rvt_dev_info *rdi, struct rvt_qp *qp);
233 gfp_t gfp);
234 233
235 /* 234 /*
236 * Free the driver's private qp structure. 235 * Free the driver's private qp structure.
@@ -319,7 +318,7 @@ struct rvt_driver_provided {
319 318
320 /* Let the driver pick the next queue pair number*/ 319 /* Let the driver pick the next queue pair number*/
321 int (*alloc_qpn)(struct rvt_dev_info *rdi, struct rvt_qpn_table *qpt, 320 int (*alloc_qpn)(struct rvt_dev_info *rdi, struct rvt_qpn_table *qpt,
322 enum ib_qp_type type, u8 port_num, gfp_t gfp); 321 enum ib_qp_type type, u8 port_num);
323 322
324 /* Determine if its safe or allowed to modify the qp */ 323 /* Determine if its safe or allowed to modify the qp */
325 int (*check_modify_qp)(struct rvt_qp *qp, struct ib_qp_attr *attr, 324 int (*check_modify_qp)(struct rvt_qp *qp, struct ib_qp_attr *attr,