• Ingo Molnar's avatar
    [PATCH] enable SMP Opterons boot an NX-enabled x86 kernel · d3cc42fb
    Ingo Molnar authored
    This fixes a corner-case NX bug: the x86 SMP kernel doesnt boot on SMP
    Opterons if NX is enabled [and mem=nopentium is specified], due to
    kernel-space NX protection preventing the SMP trampoline from being
    executable. 
    
    Since the SMP trampoline is a rare case of 'dynamic code' executed by
    the kernel (it has to be below 640K so it cannot be part of the kernel
    text itself), i've added the necessary infrastructure to enable/disable
    executability of specific kernel pages. 
    
    We cannot simply disable NX via the MSR because we've got the NX bits in
    the kernel pagetables, which are set up before we do the SMP bootup. 
    The NX bit in the pagetables is undefined if EFER.NXE is 0, so we cannot
    count on NX-capable CPUs not faulting when they encounter them. 
    
    I've tested the x86 kernel on a non-NX SMP x86 box and on an NX UP box,
    on which i've also tested a simulated SMP trampoline, it all works fine. 
    
    - add infrastructure to enable/disable executability of kernel pages
    
    - make the SMP trampoline page executable.
    Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
    Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
    d3cc42fb
init.c 17.1 KB