Skip to content

Commit 883242d

Browse files
Steven Rostedtrostedt
authored andcommitted
tracing: allow to change permissions for text with dynamic ftrace enabled
The commit 74e0817 x86-64: align RODATA kernel section to 2MB with CONFIG_DEBUG_RODATA prevents text sections from becoming read/write using set_memory_rw. The dynamic ftrace changes all text pages to read/write just before converting the calls to tracing to nops, and vice versa. I orginally just added a flag to allow this transaction when ftrace did the change, but I also found that when the CPA testing was running it would remove the read/write as well, and ftrace does not do the text conversion on boot up, and the CPA changes caused the dynamic tracer to fail on self tests. The current solution I have is to simply not to prevent change_page_attr from setting the RW bit for kernel text pages. Reported-by: Ingo Molnar <[email protected]> Cc: Suresh Siddha <[email protected]> Cc: H. Peter Anvin <[email protected]> Signed-off-by: Steven Rostedt <[email protected]>
1 parent 4868402 commit 883242d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

arch/x86/mm/pageattr.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,8 @@ static inline pgprot_t static_protections(pgprot_t prot, unsigned long address,
279279
__pa((unsigned long)__end_rodata) >> PAGE_SHIFT))
280280
pgprot_val(forbidden) |= _PAGE_RW;
281281

282-
#if defined(CONFIG_X86_64) && defined(CONFIG_DEBUG_RODATA)
282+
#if defined(CONFIG_X86_64) && defined(CONFIG_DEBUG_RODATA) && \
283+
!defined(CONFIG_DYNAMIC_FTRACE)
283284
/*
284285
* Kernel text mappings for the large page aligned .rodata section
285286
* will be read-only. For the kernel identity mappings covering

0 commit comments

Comments
 (0)