From: Linus Torvalds Date: Wed, 19 Jul 2017 15:55:18 +0000 (-0700) Subject: Merge tag 'gcc-plugins-v4.13-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git... X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=e06fdaf40a5c021dd4a2ec797e8b724f07360070;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git Merge tag 'gcc-plugins-v4.13-rc2' of git://git./linux/kernel/git/kees/linux Pull structure randomization updates from Kees Cook: "Now that IPC and other changes have landed, enable manual markings for randstruct plugin, including the task_struct. This is the rest of what was staged in -next for the gcc-plugins, and comes in three patches, largest first: - mark "easy" structs with __randomize_layout - mark task_struct with an optional anonymous struct to isolate the __randomize_layout section - mark structs to opt _out_ of automated marking (which will come later) And, FWIW, this continues to pass allmodconfig (normal and patched to enable gcc-plugins) builds of x86_64, i386, arm64, arm, powerpc, and s390 for me" * tag 'gcc-plugins-v4.13-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux: randstruct: opt-out externally exposed function pointer structs task_struct: Allow randomized layout randstruct: Mark various structs for randomization --- e06fdaf40a5c021dd4a2ec797e8b724f07360070 diff --cc fs/proc/internal.h index 18694598bebf,07b16318223f..aa2b89071630 --- a/fs/proc/internal.h +++ b/fs/proc/internal.h @@@ -67,10 -67,10 +67,10 @@@ struct proc_inode struct proc_dir_entry *pde; struct ctl_table_header *sysctl; struct ctl_table *sysctl_entry; - struct list_head sysctl_inodes; + struct hlist_node sysctl_inodes; const struct proc_ns_operations *ns_ops; struct inode vfs_inode; - }; + } __randomize_layout; /* * General functions diff --cc include/linux/fs.h index 7b5d6816542b,8f28143486c4..6e1fd5d21248 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@@ -295,8 -275,7 +295,8 @@@ struct kiocb void (*ki_complete)(struct kiocb *iocb, long ret, long ret2); void *private; int ki_flags; + enum rw_hint ki_hint; - }; + } __randomize_layout; static inline bool is_sync_kiocb(struct kiocb *kiocb) { @@@ -403,8 -392,7 +403,8 @@@ struct address_space gfp_t gfp_mask; /* implicit gfp mask for allocations */ struct list_head private_list; /* ditto */ void *private_data; /* ditto */ + errseq_t wb_err; - } __attribute__((aligned(sizeof(long)))); + } __attribute__((aligned(sizeof(long)))) __randomize_layout; /* * On most architectures that alignment is already the case; but * must be enforced here for CRIS, to let the least significant bit @@@ -882,8 -868,8 +882,9 @@@ struct file struct list_head f_tfile_llink; #endif /* #ifdef CONFIG_EPOLL */ struct address_space *f_mapping; + errseq_t f_wb_err; - } __attribute__((aligned(4))); /* lest something weird decides that 2 is OK */ + } __randomize_layout + __attribute__((aligned(4))); /* lest something weird decides that 2 is OK */ struct file_handle { __u32 handle_bytes; diff --cc include/linux/ipc.h index 5591f055e13f,ea0eb0b5f98c..fadd579d577d --- a/include/linux/ipc.h +++ b/include/linux/ipc.h @@@ -20,9 -20,6 +20,9 @@@ struct kern_ipc_perm umode_t mode; unsigned long seq; void *security; + + struct rcu_head rcu; + atomic_t refcount; - } ____cacheline_aligned_in_smp; + } ____cacheline_aligned_in_smp __randomize_layout; #endif /* _LINUX_IPC_H */ diff --cc include/linux/sem.h index be5cf2ea14ad,23bcbdfad4a6..de2deb8676bd --- a/include/linux/sem.h +++ b/include/linux/sem.h @@@ -39,9 -21,7 +39,9 @@@ struct sem_array int sem_nsems; /* no. of semaphores in array */ int complex_count; /* pending complex operations */ unsigned int use_global_lock;/* >0: global lock required */ + + struct sem sems[]; - }; + } __randomize_layout; #ifdef CONFIG_SYSVIPC