Bug 679270

Summary: [RFE] kernel: RO/NX protections [rhel-5.8]
Product: Red Hat Enterprise Linux 5 Reporter: Eugene Teo (Security Response) <eteo>
Component: kernelAssignee: Larry Woodman <lwoodman>
Status: CLOSED WONTFIX QA Contact: Red Hat Kernel QE team <kernel-qe>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 5.8CC: dhoward, jarod, jpirko, jwest, lwang, plyons, qcai
Target Milestone: rcKeywords: FutureFeature
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of:
: 679271 679272 (view as bug list) Environment:
Last Closed: 2012-10-30 14:32:40 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On:    
Bug Blocks: 679271, 679272    

Description Eugene Teo (Security Response) 2011-02-22 05:29:40 UTC
Description of problem:
1) x86: Add NX protection for kernel data

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.

http://git.kernel.org/linus/5bd5a452662bc37c54fb6828db1a3faf87e6511c

2) x86: Add RO/NX protection for loadable kernel modules

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.

http://git.kernel.org/linus/84e1c6bb38eb318e456558b610396d9f1afaabf0

3) x86: Fix jump label with RO/NX module protection crash
    
If we use jump table in module init, there are marked as removed in __jump_table section after init is done.
    
But we already applied ro permissions on the module, so we can't modify a read only section (crash in remove_jump_label_module_init).
    
Make the __jump_table section rw.

http://git.kernel.org/linus/8969691343354bdd80eff5405a0f879edbf013d6

Comment 3 RHEL Program Management 2011-06-20 22:34:29 UTC
This request was evaluated by Red Hat Product Management for inclusion in Red Hat Enterprise Linux 5.7 and Red Hat does not plan to fix this issue the currently developed update.

Contact your manager or support representative in case you need to escalate this bug.

Comment 4 RHEL Program Management 2012-01-09 14:20:12 UTC
This request was evaluated by Red Hat Product Management for inclusion in Red Hat Enterprise Linux 5.8 and Red Hat does not plan to fix this issue the currently developed update.

Contact your manager or support representative in case you need to escalate this bug.

Comment 6 Libor Miksik 2012-10-25 12:30:25 UTC
Thank you for submitting this issue for consideration. Red Hat Enterprise Linux 5 has reached the end of Production 1 Phase of its Life Cycle.  Red Hat does not plan to incorporate the suggested capability in a future Red Hat Enterprise Linux 5 minor release. If you would like Red  Hat to re-consider this feature request and the requested functionality is not currently in Red Hat Enterprise Linux 6, please re-open the request via appropriate support channels and provide additional supporting details about the importance of this issue.

Comment 7 RHEL Program Management 2012-10-30 06:12:15 UTC
This request was not resolved in time for the current release.
Red Hat invites you to ask your support representative to
propose this request, if still desired, for consideration in
the next release of Red Hat Enterprise Linux.

Comment 8 Libor Miksik 2012-10-30 14:32:40 UTC
please disregard the previous comment.