Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 83704
b: refs/heads/master
c: 984bb80
h: refs/heads/master
v: v3
  • Loading branch information
Arjan van de Ven authored and Ingo Molnar committed Feb 6, 2008
1 parent 9531333 commit efb5d3b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a57dae3aa4d00a000b5bac4238025438204c78b2
refs/heads/master: 984bb80d94d891592ab16d4d129b988792752c7b
2 changes: 1 addition & 1 deletion trunk/arch/x86/kernel/test_nx.c
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,6 @@ static int test_NX(void)
* Until then, don't run them to avoid too many people getting scared
* by the error message
*/
#if 0

#ifdef CONFIG_DEBUG_RODATA
/* Test 3: Check if the .rodata section is executable */
Expand All @@ -152,6 +151,7 @@ static int test_NX(void)
}
#endif

#if 0
/* Test 4: Check if the .data section of a module is executable */
if (test_address(&test_data)) {
printk(KERN_ERR "test_nx: .data section is executable\n");
Expand Down
9 changes: 8 additions & 1 deletion trunk/arch/x86/mm/init_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -591,10 +591,17 @@ void mark_rodata_ro(void)
if (end <= start)
return;

set_memory_ro(start, (end - start) >> PAGE_SHIFT);

printk(KERN_INFO "Write protecting the kernel read-only data: %luk\n",
(end - start) >> 10);
set_memory_ro(start, (end - start) >> PAGE_SHIFT);

/*
* The rodata section (but not the kernel text!) should also be
* not-executable.
*/
start = ((unsigned long)__start_rodata + PAGE_SIZE - 1) & PAGE_MASK;
set_memory_nx(start, (end - start) >> PAGE_SHIFT);

rodata_test();

Expand Down

0 comments on commit efb5d3b

Please sign in to comment.