• Yinghai Lu's avatar
    x86, 64bit, mm: Mark data/bss/brk to nx · 72212675
    Yinghai Lu authored
    HPA said, we should not have RW and +x set at the time.
    
    for kernel layout:
    [    0.000000] Kernel Layout:
    [    0.000000]   .text: [0x01000000-0x021434f8]
    [    0.000000] .rodata: [0x02200000-0x02a13fff]
    [    0.000000]   .data: [0x02c00000-0x02dc763f]
    [    0.000000]   .init: [0x02dc9000-0x0312cfff]
    [    0.000000]    .bss: [0x0313b000-0x03dd6fff]
    [    0.000000]    .brk: [0x03dd7000-0x03dfffff]
    
    before the patch, we have
    ---[ High Kernel Mapping ]---
    0xffffffff80000000-0xffffffff81000000          16M                           pmd
    0xffffffff81000000-0xffffffff82200000          18M     ro         PSE GLB x  pmd
    0xffffffff82200000-0xffffffff82c00000          10M     ro         PSE GLB NX pmd
    0xffffffff82c00000-0xffffffff82dc9000        1828K     RW             GLB x  pte
    0xffffffff82dc9000-0xffffffff82e00000         220K     RW             GLB NX pte
    0xffffffff82e00000-0xffffffff83000000           2M     RW         PSE GLB NX pmd
    0xffffffff83000000-0xffffffff8313a000        1256K     RW             GLB NX pte
    0xffffffff8313a000-0xffffffff83200000         792K     RW             GLB x  pte
    0xffffffff83200000-0xffffffff83e00000          12M     RW         PSE GLB x  pmd
    0xffffffff83e00000-0xffffffffa0000000         450M                           pmd
    
    after patch,, we get
    ---[ High Kernel Mapping ]---
    0xffffffff80000000-0xffffffff81000000          16M                           pmd
    0xffffffff81000000-0xffffffff82200000          18M     ro         PSE GLB x  pmd
    0xffffffff82200000-0xffffffff82c00000          10M     ro         PSE GLB NX pmd
    0xffffffff82c00000-0xffffffff82e00000           2M     RW             GLB NX pte
    0xffffffff82e00000-0xffffffff83000000           2M     RW         PSE GLB NX pmd
    0xffffffff83000000-0xffffffff83200000           2M     RW             GLB NX pte
    0xffffffff83200000-0xffffffff83e00000          12M     RW         PSE GLB NX pmd
    0xffffffff83e00000-0xffffffffa0000000         450M                           pmd
    
    so data, bss, brk get NX ...
    Signed-off-by: default avatarYinghai Lu <yinghai@kernel.org>
    Link: http://lkml.kernel.org/r/1359058816-7615-33-git-send-email-yinghai@kernel.orgSigned-off-by: default avatarH. Peter Anvin <hpa@linux.intel.com>
    72212675
init_64.c 25 KB