lkml.org 
[lkml]   [2020]   [Jun]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectGCC_PLUGIN_RANDSTRUCT being set breaks 5.8-rc2 build
Hi everyone,

I was trying to test out the 5.8-rc2 kernel using my standard
machine-specific config, but my build kept failing. I ended up
comparing against the x86_64_defconfig configuration (which worked)
using the config-bisect.pl script, and discovered that if
GCC_PLUGIN_RANDSTRUCT is set, I get this error:

--------------------
In file included from ./arch/x86/include/asm/atomic.h:5,
from ./include/linux/atomic.h:7,
from ./include/linux/llist.h:51,
from ./include/linux/irq_work.h:5,
from kernel/smp.c:10:
kernel/smp.c: In function ‘smp_init’:
./include/linux/compiler.h:392:38: error: call to
‘__compiletime_assert_157’ declared with attribute error: BUILD_BUG_ON
failed: offsetof(struct task_struct, wake_entry_type) -
offsetof(struct task_struct, wake_entry) != offsetof(struct
__call_single_data, flags) - offsetof(struct __call_single_data,
llist)
392 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
| ^
./include/linux/compiler.h:373:4: note: in definition of macro
‘__compiletime_assert’
373 | prefix ## suffix(); \
| ^~~~~~
./include/linux/compiler.h:392:2: note: in expansion of macro
‘_compiletime_assert’
392 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
| ^~~~~~~~~~~~~~~~~~~
./include/linux/build_bug.h:39:37: note: in expansion of macro
‘compiletime_assert’
39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
| ^~~~~~~~~~~~~~~~~~
./include/linux/build_bug.h:50:2: note: in expansion of macro ‘BUILD_BUG_ON_MSG’
50 | BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
| ^~~~~~~~~~~~~~~~
kernel/smp.c:687:2: note: in expansion of macro ‘BUILD_BUG_ON’
687 | BUILD_BUG_ON(offsetof(struct task_struct, wake_entry_type) -
offsetof(struct task_struct, wake_entry) !=
| ^~~~~~~~~~~~
CC fs/fs_context.o
make[1]: *** [scripts/Makefile.build:281: kernel/smp.o] Error 1
--------------------

I am able to reproduce this error now if I use the x86_64_defconfig,
and simply set GCC_PLUGIN_RANDSTRUCT from the configuration tree in:
- General architecture-dependent options
- GCC plugins
[x] Randomize layout of sensitive kernel structures

It appears the cause is this commit:
---------------------
commit a148866489fbe243c936fe43e4525d8dbfa0318f
Author: Peter Zijlstra <peterz@infradead.org>
Date: Tue May 26 18:11:04 2020 +0200

sched: Replace rq::wake_list
---------------------

I am observing these build failures on GCC 9.3.0 (Gentoo) and GCC
10.1.0 (Manjaro) using the 5.8-rc2 kernel from git
(48778464bb7d346b47157d21ffde2af6b2d39110).

I am not on the kernel mailing list, if there is anything I can do to
assist with fixing this, please copy me directly.

Thanks!

Caleb Jorden
cjorden@gmail.com

\
 
 \ /
  Last update: 2020-06-24 09:20    [W:0.029 / U:0.304 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site