[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <4CE2F914.9070106@free.fr>
Date: Tue, 16 Nov 2010 22:35:16 +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 3/3 V13] RO/NX protection for loadable kernel
This patch is a logical extension of the protection provided by
CONFIG_DEBUG_RODATA to LKMs. The protection is provided by splitting
module_core and module_init into three logical parts each and setting
appropriate page access permissions for each individual section:
1. Code: RO+X
2. RO data: RO+NX
3. RW data: RW+NX
In order to achieve proper protection, layout_sections() have been
modified to align each of the three parts mentioned above onto page
boundary. Next, the corresponding page access permissions are set
right before successful exit from load_module(). Further, free_module()
and sys_init_module have been modified to set module_core and
module_init as RW+NX right before calling module_free().
By default, the original section layout and access flags are preserved.
When compiled with CONFIG_DEBUG_SET_MODULE_RONX=y, the patch
will page-align each group of sections to ensure that each page contains
only one type of content and will enforce RO/NX for each group of pages.
V1: Initial proof-of-concept patch.
V2: The patch have been re-written to reduce the number of #ifdefs and
to make it architecture-agnostic. Code formatting have been corrected also.
V3: Opportunistic RO/NX protectiuon is now unconditional. Section
page-alignment is enabled when CONFIG_DEBUG_RODATA=y.
V4: Removed most macros and improved coding style.
V5: Changed page-alignment and RO/NX section size calculation
V6: Fixed comments. Restricted RO/NX enforcement to x86 only
V7: Introduced CONFIG_DEBUG_SET_MODULE_RONX, added calls to
set_all_modules_text_rw() and set_all_modules_text_ro() in ftrace
V8: updated for compatibility with linux 2.6.33-rc5
V9: coding style fixes
V10: more coding style fixes
V11: minor adjutments for -tip
V12: minor adjutments for v2.6.35-rc2-tip
V13: minor adjutments for v2.6.37-rc1-tip
Signed-off-by: Siarhei Liakh <sliakh.lkml@...il.com>
Signed-off-by: Xuxian Jiang <jiang@...ncsu.edu>
Acked-by: Arjan van de Ven <arjan@...ux.intel.com>
Reviewed-by: James Morris <jmorris@...ei.org>
Signed-off-by: H. Peter Anvin <hpa@...or.com>
View attachment "x86_nx_module_data.diff" of type "text/x-diff" (9839 bytes)
Powered by blists - more mailing lists