Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1651274

Re: [PATCH V2] x86/ftrace: Make sure that ftrace trampolines are not RWX

From Thomas Gleixner <tglx@linutronix.de>
Newsgroups linux.kernel
Subject Re: [PATCH V2] x86/ftrace: Make sure that ftrace trampolines are not RWX
Date 2017-05-26 12:00 +0200
Message-ID <tLkch-4g5-3@gated-at.bofh.it> (permalink)
References (5 earlier) <tKWMG-5YF-15@gated-at.bofh.it> <tL53z-2KJ-7@gated-at.bofh.it> <tL75o-40J-7@gated-at.bofh.it> <tLhxL-2Oy-3@gated-at.bofh.it> <tLjSW-490-15@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Fri, 26 May 2017, Heiko Carstens wrote:

> On Fri, May 26, 2017 at 09:03:13AM +0200, Thomas Gleixner wrote:
> > > It seems like it really should. That would put it in a single place
> > > and avoid this mistake again in the future. Does module_memfree() have
> > > access to the allocation size, or does that need to get plumbed?
> > 
> > No, it doesn't. But the number of instances is pretty limited.
> > 
> > Btw, looking at BPF. It allocates memory via module_alloc() which means
> > it's RWX. There is nothing in that BPF code which changes the permissions
> > afterwards ....
> 
> For BPF you're probably referring to bpf_jit_binary_alloc()? Permissions
> are changed with bpf_jit_binary_lock_ro() within each architecure backend.
> 
> Well, except for powerpc (cc'ed Michael).

The problem starts elsewhere. module_alloc() should not allocate RWX memory
in the first place. It should allocated RW and then the usage sites should
set it to RX when the code is ready to go.

Thanks,

	tglx

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: [PATCH] x86/ftrace: Make sure that ftrace trampolines are not  RWX Thomas Gleixner <tglx@linutronix.de> - 2017-05-25 08:30 +0200
  [PATCH V2] x86/ftrace: Make sure that ftrace trampolines are not  RWX Thomas Gleixner <tglx@linutronix.de> - 2017-05-25 11:00 +0200
    Re: [PATCH V2] x86/ftrace: Make sure that ftrace trampolines are  not RWX Steven Rostedt <rostedt@goodmis.org> - 2017-05-25 17:20 +0200
    Re: [PATCH V2] x86/ftrace: Make sure that ftrace trampolines are not  RWX "Luis R. Rodriguez" <mcgrof@kernel.org> - 2017-05-25 19:50 +0200
      Re: [PATCH V2] x86/ftrace: Make sure that ftrace trampolines are not RWX Kees Cook <keescook@chromium.org> - 2017-05-25 22:00 +0200
        Re: [PATCH V2] x86/ftrace: Make sure that ftrace trampolines are  not RWX Thomas Gleixner <tglx@linutronix.de> - 2017-05-26 09:10 +0200
          Re: [PATCH V2] x86/ftrace: Make sure that ftrace trampolines are not  RWX Heiko Carstens <heiko.carstens@de.ibm.com> - 2017-05-26 11:40 +0200
            Re: [PATCH V2] x86/ftrace: Make sure that ftrace trampolines are  not RWX Thomas Gleixner <tglx@linutronix.de> - 2017-05-26 12:00 +0200
            Re: [PATCH V2] x86/ftrace: Make sure that ftrace trampolines are not RWX Michael Ellerman <mpe@ellerman.id.au> - 2017-05-26 13:50 +0200
        Re: [PATCH V2] x86/ftrace: Make sure that ftrace trampolines are  not RWX Masami Hiramatsu <mhiramat@kernel.org> - 2017-05-26 11:50 +0200
    Re: [PATCH V2] x86/ftrace: Make sure that ftrace trampolines are  not RWX Steven Rostedt <rostedt@goodmis.org> - 2017-05-26 15:40 +0200
      Re: [PATCH V2] x86/ftrace: Make sure that ftrace trampolines are  not RWX Steven Rostedt <rostedt@goodmis.org> - 2017-05-26 16:00 +0200
      Re: [PATCH V2] x86/ftrace: Make sure that ftrace trampolines are  not RWX Thomas Gleixner <tglx@linutronix.de> - 2017-05-26 16:00 +0200

csiph-web