Messages in this thread | | | Date | Thu, 25 May 2017 08:25:32 +0200 (CEST) | From | Thomas Gleixner <> | 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
| |