Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 173041
b: refs/heads/master
c: 502f660
h: refs/heads/master
i:
  173039: 2570f09
v: v3
  • Loading branch information
Suresh Siddha authored and Ingo Molnar committed Nov 2, 2009
1 parent 96e9af0 commit 0954575
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 7 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: 883242dd0e5faaba041528a9a99f483f2a656c83
refs/heads/master: 502f660466ba7a66711ffdf414b1f7f1131dcbf7
1 change: 1 addition & 0 deletions trunk/arch/x86/include/asm/cacheflush.h
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ void clflush_cache_range(void *addr, unsigned int size);
#ifdef CONFIG_DEBUG_RODATA
void mark_rodata_ro(void);
extern const int rodata_test_data;
extern int kernel_set_to_readonly;
void set_kernel_text_rw(void);
void set_kernel_text_ro(void);
#else
Expand Down
2 changes: 1 addition & 1 deletion trunk/arch/x86/mm/init_32.c
Original file line number Diff line number Diff line change
Expand Up @@ -997,7 +997,7 @@ static noinline int do_test_wp_bit(void)
const int rodata_test_data = 0xC3;
EXPORT_SYMBOL_GPL(rodata_test_data);

static int kernel_set_to_readonly;
int kernel_set_to_readonly __read_mostly;

void set_kernel_text_rw(void)
{
Expand Down
2 changes: 1 addition & 1 deletion trunk/arch/x86/mm/init_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,7 @@ void __init mem_init(void)
const int rodata_test_data = 0xC3;
EXPORT_SYMBOL_GPL(rodata_test_data);

static int kernel_set_to_readonly;
int kernel_set_to_readonly;

void set_kernel_text_rw(void)
{
Expand Down
10 changes: 6 additions & 4 deletions trunk/arch/x86/mm/pageattr.c
Original file line number Diff line number Diff line change
Expand Up @@ -282,14 +282,16 @@ static inline pgprot_t static_protections(pgprot_t prot, unsigned long address,
#if defined(CONFIG_X86_64) && defined(CONFIG_DEBUG_RODATA) && \
!defined(CONFIG_DYNAMIC_FTRACE)
/*
* Kernel text mappings for the large page aligned .rodata section
* will be read-only. For the kernel identity mappings covering
* the holes caused by this alignment can be anything.
* Once the kernel maps the text as RO (kernel_set_to_readonly is set),
* kernel text mappings for the large page aligned text, rodata sections
* will be always read-only. For the kernel identity mappings covering
* the holes caused by this alignment can be anything that user asks.
*
* This will preserve the large page mappings for kernel text/data
* at no extra cost.
*/
if (within(address, (unsigned long)_text,
if (kernel_set_to_readonly &&
within(address, (unsigned long)_text,
(unsigned long)__end_rodata_hpage_align))
pgprot_val(forbidden) |= _PAGE_RW;
#endif
Expand Down

0 comments on commit 0954575

Please sign in to comment.