On Mon, Mar 5, 2018 at 1:27 AM, Masahiro Yamada <yamada.masah...@socionext.com> wrote: > Sorry for chiming in late. > > I noticed this thread today, > honestly, the commit made me upset. > > > Can I suggest another way to make it less fragile? > __attribute((...)) can be placed after 'struct'. > > > So, we can write: > > > struct __randomize_layout path { > struct vfsmount *mnt; > struct dentry *dentry; > }; > > > instead of > > > struct path { > struct vfsmount *mnt; > struct dentry *dentry; > } __randomize_layout;
Ugh. I had tried this after the struct _name_, not after "struct" itself. This does fix it, though it remains fragile, as you mention. > If we force the former notation, > the undefined __randomize_layout results in a build error > instead of silent broken code generation. > > > It is true somebody can still place > __randomize_layout after the closing brace, > but can we check this by coccicheck or checkpatch.pl? > (we can describe it in coding style documentation, of course) > > > IMHO, we should not (ab)use include/linux/kconfig.h > to bring in misc things. I'm happy to send a patch that reverts the other changes and relocates all the markings... Linus, how would you like this to go? -Kees -- Kees Cook Pixel Security