lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <4CE2F82E.60601@free.fr>
Date:	Tue, 16 Nov 2010 22:31:26 +0100
From:	matthieu castet <castet.matthieu@...e.fr>
To:	linux-kernel@...r.kernel.org,
	linux-security-module@...r.kernel.org, linux-next@...r.kernel.org
CC:	Arjan van de Ven <arjan@...radead.org>,
	James Morris <jmorris@...ei.org>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Andi Kleen <ak@....de>, Thomas Gleixner <tglx@...utronix.de>,
	"H. Peter Anvin" <hpa@...or.com>, Ingo Molnar <mingo@...e.hu>,
	Rusty Russell <rusty@...tcorp.com.au>,
	Stephen Rothwell <sfr@...b.auug.org.au>,
	Dave Jones <davej@...hat.com>,
	Siarhei Liakh <sliakh.lkml@...il.com>,
	Kees Cook <kees.cook@...onical.com>
Subject: [PATCH 2/3 V8] NX protection for kernel data

    Note: this patch depends on "Correct improper large page preservation" patch
    
    This patch expands functionality of CONFIG_DEBUG_RODATA to set main
    (static) kernel data area as NX.
    The following steps are taken to achieve this:
    1. Linker script is adjusted so .text always starts and ends on a page bound
    2. Linker script is adjusted so .rodata always start and
    end on a page boundary
    3. NX is set for all pages from _etext through _end in mark_rodata_ro.
    4. free_init_pages() sets released memory NX in arch/x86/mm/init.c
    5. bios rom is set to x when pcibios is used.
    
    The results of patch application may be observed in the diff of kernel page
    table dumps.
    pcibios :
    --- data_nx_pt_before.txt       2009-10-13 07:48:59.000000000 -0400
    +++ data_nx_pt_after.txt        2009-10-13 07:26:46.000000000 -0400
    @@ -2,8 +2,9 @@
     0x00000000-0xc0000000           3G                           pmd
     ---[ Kernel Mapping ]---
    -0xc0000000-0xc0100000           1M     RW             GLB x  pte
    +0xc0000000-0xc00a0000         640K     RW             GLB NX pte
    +0xc00a0000-0xc0100000         384K     RW             GLB x  pte
    -0xc0100000-0xc03d7000        2908K     ro             GLB x  pte
    +0xc0100000-0xc0318000        2144K     ro             GLB x  pte
    +0xc0318000-0xc03d7000         764K     ro             GLB NX pte
    -0xc03d7000-0xc0600000        2212K     RW             GLB x  pte
    +0xc03d7000-0xc0600000        2212K     RW             GLB NX pte
     0xc0600000-0xf7a00000         884M     RW         PSE GLB NX pmd
     0xf7a00000-0xf7bfe000        2040K     RW             GLB NX pte
     0xf7bfe000-0xf7c00000           8K                           pte
    
    no pcibios :
    --- data_nx_pt_before.txt       2009-10-13 07:48:59.000000000 -0400
    +++ data_nx_pt_after.txt        2009-10-13 07:26:46.000000000 -0400
    @@ -2,8 +2,9 @@
     0x00000000-0xc0000000           3G                           pmd
     ---[ Kernel Mapping ]---
    -0xc0000000-0xc0100000           1M     RW             GLB x  pte
    +0xc0000000-0xc0100000           1M     RW             GLB NX pte
    -0xc0100000-0xc03d7000        2908K     ro             GLB x  pte
    +0xc0100000-0xc0318000        2144K     ro             GLB x  pte
    +0xc0318000-0xc03d7000         764K     ro             GLB NX pte
    -0xc03d7000-0xc0600000        2212K     RW             GLB x  pte
    +0xc03d7000-0xc0600000        2212K     RW             GLB NX pte
     0xc0600000-0xf7a00000         884M     RW         PSE GLB NX pmd
     0xf7a00000-0xf7bfe000        2040K     RW             GLB NX pte
     0xf7bfe000-0xf7c00000           8K                           pte
    
    The patch have been developed for Linux 2.6.34-rc2 x86 by Siarhei Liakh
    <sliakh.lkml@...il.com> and Xuxian Jiang <jiang@...ncsu.edu>.
    
    V1:  initial patch for 2.6.30
    V2:  patch for 2.6.31-rc7
    V3:  moved all code into arch/x86, adjusted credits
    V4:  fixed ifdef, removed credits from CREDITS
    V5:  fixed an address calculation bug in mark_nxdata_nx()
    V6:  added acked-by and PT dump diff to commit log
    V7:  minor adjustments for -tip
    V8:  rework with the merge of "Set first MB as RW+NX"
    
    Signed-off-by: Siarhei Liakh <sliakh.lkml@...il.com>
    Signed-off-by: Xuxian Jiang <jiang@...ncsu.edu>
    Signed-off-by: Matthieu CASTET <castet.matthieu@...e.fr>


View attachment "x86_nx_kernel_data.diff" of type "text/x-diff" (6786 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ