]> git.baikalelectronics.ru Git - kernel.git/commit
x86/ftrace: Make sure that ftrace trampolines are not RWX
authorThomas Gleixner <tglx@linutronix.de>
Thu, 25 May 2017 08:57:51 +0000 (10:57 +0200)
committerSteven Rostedt (VMware) <rostedt@goodmis.org>
Sat, 27 May 2017 02:37:02 +0000 (22:37 -0400)
commit4653ff9db1395cdf517acd6a1da37f0869b7a3e2
treed1fdc5c65a3006941edc142b86935d6cffe55ce8
parent2571673b9b5055bd7df7b7ea97ca3a6264de185f
x86/ftrace: Make sure that ftrace trampolines are not RWX

ftrace use module_alloc() to allocate trampoline pages. The mapping of
module_alloc() is RWX, which makes sense as the memory is written to right
after allocation. But nothing makes these pages RO after writing to them.

Add proper set_memory_rw/ro() calls to protect the trampolines after
modification.

Link: http://lkml.kernel.org/r/alpine.DEB.2.20.1705251056410.1862@nanos
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
arch/x86/kernel/ftrace.c