• K
    task_struct: Allow randomized layout · 29e48ce8
    Kees Cook 提交于
    This marks most of the layout of task_struct as randomizable, but leaves
    thread_info and scheduler state untouched at the start, and thread_struct
    untouched at the end.
    
    Other parts of the kernel use unnamed structures, but the 0-day builder
    using gcc-4.4 blows up on static initializers. Officially, it's documented
    as only working on gcc 4.6 and later, which further confuses me:
    	https://gcc.gnu.org/wiki/C11Status
    The structure layout randomization already requires gcc 4.7, but instead
    of depending on the plugin being enabled, just check the gcc versions
    for wider build testing. At Linus's suggestion, the marking is hidden
    in a macro to reduce how ugly it looks. Additionally, indenting is left
    unchanged since it would make things harder to read.
    
    Randomization of task_struct is modified from Brad Spengler/PaX Team's
    code in the last public patch of grsecurity/PaX based on my understanding
    of the code. Changes or omissions from the original code are mine and
    don't reflect the original grsecurity/PaX code.
    
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: NKees Cook <keescook@chromium.org>
    29e48ce8
sched.h 43.2 KB