[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.20.1705250813190.2329@nanos>
Date: Thu, 25 May 2017 08:25:32 +0200 (CEST)
From: Thomas Gleixner <tglx@...utronix.de>
To: Steven Rostedt <rostedt@...dmis.org>
cc: Kees Cook <keescook@...omium.org>,
LKML <linux-kernel@...r.kernel.org>, x86@...nel.org,
Masami Hiramatsu <mhiramat@...nel.org>,
"Luis R. Rodriguez" <mcgrof@...nel.org>,
Peter Zijlstra <peterz@...radead.org>
Subject: Re: [PATCH] x86/ftrace: Make sure that ftrace trampolines are not
RWX
On Wed, 24 May 2017, Steven Rostedt wrote:
> The trampolines uses the module allocation, and it appears, that needs
> to become rw before freeing again.
Indeed. I realized that when enabling more debug options, which led to a
reliable triple fault.
How intuitive.
> I applied this patch, and it appears to fix the bug for me.
It fixes the bug, but ...
> -static inline void tramp_free(void *tramp)
> +static inline void tramp_free(void *tramp, int size)
> {
> + int npages;
> +
> + npages = PAGE_ALIGN(size) >> PAGE_SHIFT;
For correctness sake this wants
set_memory_nx(...);
as well.
> + set_memory_rw((unsigned long)tramp, npages);
> module_memfree(tramp);
> }
I'll clean that up and post a V2.
Thanks,
tglx
Powered by blists - more mailing lists