From mboxrd@z Thu Jan 1 00:00:00 1970 From: Randy Dunlap Subject: Re: [PATCH v5 15/27] compiler: Option to default to hidden symbols Date: Mon, 25 Jun 2018 16:25:03 -0700 Message-ID: <8486eb8b-e233-4e2f-e976-da7b4cefc673@infradead.org> References: <20180625224014.134829-1-thgarnie@google.com> <20180625224014.134829-16-thgarnie@google.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20180625224014.134829-16-thgarnie@google.com> Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org To: Thomas Garnier , kernel-hardening@lists.openwall.com Cc: Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , x86@kernel.org, Borislav Petkov , "Luis R. Rodriguez" , Greg Kroah-Hartman , Arnd Bergmann , Christopher Li , Steven Rostedt , Jason Baron , "Rafael J. Wysocki" , Kate Stewart , Mika Westerberg , Philippe Ombredanne , Lukas Wunner , Kees Cook , Masahiro Yamada , "Peter Zijlstra (Intel)" , Mathieu List-Id: linux-arch.vger.kernel.org On 06/25/18 15:39, Thomas Garnier wrote: > Provide an option to default visibility to hidden except for key > symbols. This option is disabled by default and will be used by x86_64 > PIE support to remove errors between compilation units. > > The default visibility is also enabled for external symbols that are > compared as they maybe equals (start/end of sections). In this case, > older versions of GCC will remove the comparison if the symbols are > hidden. This issue exists at least on gcc 4.9 and before. > > Signed-off-by: Thomas Garnier > --- > diff --git a/init/Kconfig b/init/Kconfig > index 24b60536e26b..d4f90cc38ede 100644 > --- a/init/Kconfig > +++ b/init/Kconfig > @@ -1718,6 +1718,13 @@ config PROFILING > config TRACEPOINTS > bool > > +# > +# Default to hidden visibility for all symbols. > +# Useful for Position Independent Code to reduce global references. > +# > +config DEFAULT_HIDDEN > + bool > + I certainly would appreciate a better/more descriptive kconfig symbol name here. > source "arch/Kconfig" > > endmenu # General setup thanks, -- ~Randy From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from bombadil.infradead.org ([198.137.202.133]:44080 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754207AbeFYXZM (ORCPT ); Mon, 25 Jun 2018 19:25:12 -0400 Subject: Re: [PATCH v5 15/27] compiler: Option to default to hidden symbols References: <20180625224014.134829-1-thgarnie@google.com> <20180625224014.134829-16-thgarnie@google.com> From: Randy Dunlap Message-ID: <8486eb8b-e233-4e2f-e976-da7b4cefc673@infradead.org> Date: Mon, 25 Jun 2018 16:25:03 -0700 MIME-Version: 1.0 In-Reply-To: <20180625224014.134829-16-thgarnie@google.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-arch-owner@vger.kernel.org List-ID: To: Thomas Garnier , kernel-hardening@lists.openwall.com Cc: Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , x86@kernel.org, Borislav Petkov , "Luis R. Rodriguez" , Greg Kroah-Hartman , Arnd Bergmann , Christopher Li , Steven Rostedt , Jason Baron , "Rafael J. Wysocki" , Kate Stewart , Mika Westerberg , Philippe Ombredanne , Lukas Wunner , Kees Cook , Masahiro Yamada , "Peter Zijlstra (Intel)" , Mathieu Desnoyers , Sergey Senozhatsky , Petr Mladek , linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linux-sparse@vger.kernel.org Message-ID: <20180625232503.Li5X0tUkrJK_GZupmz9xp5sH4upwaCa6XLZoHyJiqb8@z> On 06/25/18 15:39, Thomas Garnier wrote: > Provide an option to default visibility to hidden except for key > symbols. This option is disabled by default and will be used by x86_64 > PIE support to remove errors between compilation units. > > The default visibility is also enabled for external symbols that are > compared as they maybe equals (start/end of sections). In this case, > older versions of GCC will remove the comparison if the symbols are > hidden. This issue exists at least on gcc 4.9 and before. > > Signed-off-by: Thomas Garnier > --- > diff --git a/init/Kconfig b/init/Kconfig > index 24b60536e26b..d4f90cc38ede 100644 > --- a/init/Kconfig > +++ b/init/Kconfig > @@ -1718,6 +1718,13 @@ config PROFILING > config TRACEPOINTS > bool > > +# > +# Default to hidden visibility for all symbols. > +# Useful for Position Independent Code to reduce global references. > +# > +config DEFAULT_HIDDEN > + bool > + I certainly would appreciate a better/more descriptive kconfig symbol name here. > source "arch/Kconfig" > > endmenu # General setup thanks, -- ~Randy