On Fri, Nov 15, 2019 at 09:43:10AM -0000, tip-bot2 for Peter Zijlstra wrote: > The following commit has been merged into the core/kprobes branch of tip: > > Commit-ID: 9706f7c3531fee00505ebd03bf3aa0af76510877 > Gitweb: https://git.kernel.org/tip/9706f7c3531fee00505ebd03bf3aa0af76510877 > Author: Peter Zijlstra > AuthorDate: Mon, 26 Aug 2019 14:48:23 +02:00 > Committer: Ingo Molnar > CommitterDate: Fri, 15 Nov 2019 09:07:42 +01:00 > > x86/ftrace: Use text_poke() > > Move ftrace over to using the generic x86 text_poke functions; this > avoids having a second/different copy of that code around. > > This also avoids ftrace violating the (new) W^X rule and avoids > fragmenting the kernel text page-tables, due to no longer having to > toggle them RW. > > Tested-by: Alexei Starovoitov > Tested-by: Steven Rostedt (VMware) > Signed-off-by: Peter Zijlstra (Intel) > Reviewed-by: Steven Rostedt (VMware) > Acked-by: Alexei Starovoitov > Cc: Andy Lutomirski > Cc: Borislav Petkov > Cc: Daniel Bristot de Oliveira > Cc: H. Peter Anvin > Cc: Josh Poimboeuf > Cc: Linus Torvalds > Cc: Thomas Gleixner > Link: https://lkml.kernel.org/r/20191111132457.761255803@infradead.org > Signed-off-by: Ingo Molnar > --- > arch/x86/include/asm/ftrace.h | 2 +- > arch/x86/kernel/alternative.c | 18 +- > arch/x86/kernel/ftrace.c | 663 +++++---------------------------- > arch/x86/kernel/traps.c | 9 +- > 4 files changed, 134 insertions(+), 558 deletions(-) ... > +static int > +ftrace_modify_code_direct(unsigned long ip, const char *old_code, > + const char *new_code) > +{ > + int ret = ftrace_verify_code(ip, old_code); > + if (ret) > + return ret; > > + /* replace the text with the new text */ > + if (ftrace_poke_late) > + text_poke_queue((void *)ip, new_code, MCOUNT_INSN_SIZE, NULL); > + else > + text_poke_early((void *)ip, new_code, MCOUNT_INSN_SIZE); Btw: WARNING: vmlinux.o(.text+0x8c0b1): Section mismatch in reference from the function ftrace_modify_code_direct() to the function .init.text:text_poke_early() The function ftrace_modify_code_direct() references the function __init text_poke_early(). This is often because ftrace_modify_code_direct lacks a __init annotation or the annotation of text_poke_early is wrong. FATAL: modpost: Section mismatches detected. Set CONFIG_SECTION_MISMATCH_WARN_ONLY=y to allow them. make[1]: *** [scripts/Makefile.modpost:66: __modpost] Error 1 make: *** [Makefile:1077: vmlinux] Error 2 random .config attached. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette