From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753101AbaD0Lta (ORCPT ); Sun, 27 Apr 2014 07:49:30 -0400 Received: from mail-ee0-f54.google.com ([74.125.83.54]:55028 "EHLO mail-ee0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752367AbaD0Lt3 (ORCPT ); Sun, 27 Apr 2014 07:49:29 -0400 Date: Sun, 27 Apr 2014 13:49:24 +0200 From: Ingo Molnar To: Jiri Olsa Cc: Mathias Krause , Peter Zijlstra , Paul Mackerras , Ingo Molnar , Arnaldo Carvalho de Melo , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH] perf x86: Fix perf to use non-executable stack, again Message-ID: <20140427114924.GB21935@gmail.com> References: <1398538965-10620-1-git-send-email-minipli@googlemail.com> <20140427092649.GA1111@krava.brq.redhat.com> <20140427103915.GC1111@krava.brq.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20140427103915.GC1111@krava.brq.redhat.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Jiri Olsa wrote: > On Sun, Apr 27, 2014 at 12:03:50PM +0200, Mathias Krause wrote: > > SNIP > > > >> 1.7.10.4 > > >> > > > > > > hum, how about fixing this once and for all.. ;-) > > > please check attached patch, thanks > > > > Yeah, I thought about this option too but declined it for two reasons: > > 1/ The kernel sources should provide good quality examples, even for > > usage outside of the kernel. Imagine somebody taking the memcpy > > implementation for his own project but not copying the LDFLAGS. That > > would make his code have an executable stack while with the .GNU-stack > > marker in the assembler file it won't. > > that 'somebody' should check/know better ;-) but ok, fair enough > > > 2/ What if somebody tries to add/link code to perf that makes use of > > nested functions? That'll make perf fail as the trampoline code > > generated by gcc won't be executable due to the enforced > > non-executable stack by -Wl,-z,noexecstack. > > I guess in that case he would change the Makefile as well? > > anyway I have no objection for leaving that code in assembly > objects, but I suggest we use the global option as well to > prevent any future surprise.. Correct. Regression in this area is 'silent' and can go unnoticed for long, because it has no functional side effects. So being defensive and forcing the secure option we want is important. That way if an executable stack is needed by a patch then perf will break visibly, and the patch that relies on an executable stack can be fixed ... So for the combo solution: Acked-by: Ingo Molnar Thanks, Ingo