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-Tag: v5.15~10811 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e06fdaf40a5c021dd4a2ec797e8b724f07360070;p=platform%2Fkernel%2Flinux-starfive.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 1869459,07b1631..aa2b890 --- 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 7b5d681,8f28143..6e1fd5d --- 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 5591f055,ea0eb0b..fadd579 --- 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 be5cf2e,23bcbdf..de2deb8 --- 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