From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S967455AbdEZLkt (ORCPT ); Fri, 26 May 2017 07:40:49 -0400 Received: from ozlabs.org ([103.22.144.67]:47263 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753586AbdEZLkr (ORCPT ); Fri, 26 May 2017 07:40:47 -0400 From: Michael Ellerman To: Heiko Carstens , Thomas Gleixner Cc: Kees Cook , "Luis R. Rodriguez" , Steven Rostedt , LKML , "x86\@kernel.org" , Masami Hiramatsu , Peter Zijlstra Subject: Re: [PATCH V2] x86/ftrace: Make sure that ftrace trampolines are not RWX In-Reply-To: <20170526092716.GA14849@osiris> References: <20170524134728.61a896c9@vmware.local.home> <20170524182547.5c085dc7@vmware.local.home> <20170525174604.GY8951@wotan.suse.de> <20170526092716.GA14849@osiris> User-Agent: Notmuch/0.21 (https://notmuchmail.org) Date: Fri, 26 May 2017 21:40:44 +1000 Message-ID: <87bmqf977n.fsf@concordia.ellerman.id.au> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Heiko Carstens writes: > 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). [hangs head in shame] Thanks, we are working on this stuff (stricter RWX perms) at the moment, so will add this to the list. It's complicated somewhat by the variety of MMUs we support, but still. cheers