From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1426012AbdEZJ2N (ORCPT ); Fri, 26 May 2017 05:28:13 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:55618 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753590AbdEZJ1Y (ORCPT ); Fri, 26 May 2017 05:27:24 -0400 Date: Fri, 26 May 2017 11:27:16 +0200 From: Heiko Carstens To: Thomas Gleixner Cc: Kees Cook , "Luis R. Rodriguez" , Steven Rostedt , LKML , "x86@kernel.org" , Masami Hiramatsu , Peter Zijlstra , Michael Ellerman Subject: Re: [PATCH V2] x86/ftrace: Make sure that ftrace trampolines are not RWX References: <20170524134728.61a896c9@vmware.local.home> <20170524182547.5c085dc7@vmware.local.home> <20170525174604.GY8951@wotan.suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) X-TM-AS-GCONF: 00 x-cbid: 17052609-0040-0000-0000-000003B79843 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17052609-0041-0000-0000-00002046E214 Message-Id: <20170526092716.GA14849@osiris> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-05-26_06:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1703280000 definitions=main-1705260173 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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).