From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7FEA5C433E0 for ; Wed, 27 May 2020 18:50:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6953420707 for ; Wed, 27 May 2020 18:50:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1590605416; bh=yrp8btb31P5JNGINiPGR979o67FKKAt2YeeDUI67h0c=; h=References:In-Reply-To:From:Date:Subject:To:Cc:List-ID:From; b=ubm6zrZOvtkJBUvE1D/wgSrtN97ZYLz4lekERAAiuKreE+dJAs0raj3kANrsG91ZM JYb7xwLPfkGFevxHgN2L8MxUhv2DlGRce6FQKYUxgVa5C5u5P927ED6XYCmoWs6E3m OgYHJLvK8czWpNIX4z4Nby/uZiZDMkpP57qx9q1M= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727925AbgE0SuQ (ORCPT ); Wed, 27 May 2020 14:50:16 -0400 Received: from mail.kernel.org ([198.145.29.99]:38276 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726222AbgE0SuP (ORCPT ); Wed, 27 May 2020 14:50:15 -0400 Received: from mail-il1-f173.google.com (mail-il1-f173.google.com [209.85.166.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4CC412073B; Wed, 27 May 2020 18:30:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1590604235; bh=yrp8btb31P5JNGINiPGR979o67FKKAt2YeeDUI67h0c=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=2UmN9xCpWx7rx2hJ6s4dj97SpOjwhvz/TXReiFd5aUbkZkhb2uhL78c+w1kKKUZoB y5n/EV1O85qUsKgmnZEcoehf0tBGve3E61XfllQYkiIfhjyV0WV57veyexffD8WeY2 7usizsxWw2pgm9D5gqLZgL9eozpSMPHjyYRuA/vE= Received: by mail-il1-f173.google.com with SMTP id l20so25047079ilj.10; Wed, 27 May 2020 11:30:35 -0700 (PDT) X-Gm-Message-State: AOAM530tP1y+8fmTodHKB92bOFSqLLHHFmY6+6m/7wLvHEl7/kMsh8BJ v4E2BJjShFNmSKfwkUfLbkiN3xk6ZJQvhnUg0wU= X-Google-Smtp-Source: ABdhPJxaBgJdts/3rMVrWZXg7f3NCsaI5epY+iw+MqESNkB/2tqDRrOiEl5BHdcHm1cm9EFCAljU4lRJfdBVIlCCm04= X-Received: by 2002:a92:290c:: with SMTP id l12mr6720934ilg.279.1590604234737; Wed, 27 May 2020 11:30:34 -0700 (PDT) MIME-Version: 1.0 References: <20200523120021.34996-1-ardb@kernel.org> <20200523120021.34996-3-ardb@kernel.org> <20200527143650.GA3103408@rani.riverdale.lan> In-Reply-To: From: Ard Biesheuvel Date: Wed, 27 May 2020 20:30:23 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2 2/3] x86/boot/compressed: force hidden visibility for all symbol references To: Brian Gerst Cc: Arvind Sankar , linux-efi , "the arch/x86 maintainers" , Linux Kernel Mailing List , Maarten Lankhorst , Linus Torvalds Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 27 May 2020 at 20:29, Brian Gerst wrote: > > On Wed, May 27, 2020 at 2:08 PM Arvind Sankar wrote: > > > > On Sat, May 23, 2020 at 02:00:20PM +0200, Ard Biesheuvel wrote: > > > Eliminate all GOT entries in the decompressor binary, by forcing hidden > > > visibility for all symbol references, which informs the compiler that > > > such references will be resolved at link time without the need for > > > allocating GOT entries. > > > > > > To ensure that no GOT entries will creep back in, add an assertion to > > > the decompressor linker script that will fire if the .got section has > > > a non-zero size. > > > > > > Signed-off-by: Ard Biesheuvel > > > --- > > > arch/x86/boot/compressed/Makefile | 1 + > > > arch/x86/boot/compressed/hidden.h | 19 +++++++++++++++++++ > > > arch/x86/boot/compressed/vmlinux.lds.S | 1 + > > > 3 files changed, 21 insertions(+) > > > > > > diff --git a/arch/x86/boot/compressed/Makefile b/arch/x86/boot/compressed/Makefile > > > index 5f7c262bcc99..aa9ed814e5fa 100644 > > > --- a/arch/x86/boot/compressed/Makefile > > > +++ b/arch/x86/boot/compressed/Makefile > > > @@ -40,6 +40,7 @@ KBUILD_CFLAGS += $(call cc-disable-warning, gnu) > > > KBUILD_CFLAGS += -Wno-pointer-sign > > > KBUILD_CFLAGS += $(call cc-option,-fmacro-prefix-map=$(srctree)/=) > > > KBUILD_CFLAGS += -fno-asynchronous-unwind-tables > > > +KBUILD_CFLAGS += -include hidden.h > > > > > > > Ard, from the other thread [1] in case you missed it -- the plain > > hidden.h fails to build in-tree. We need something like > > KBUILD_CFLAGS += -include $(srctree)/$(src)/hidden.h > > instead. > > > > [1] https://lore.kernel.org/lkml/20200526153104.GC2190602@rani.riverdale.lan/ > > How about using -fvisibility=hidden instead of including this header? > That only works for definitions, not for extern declarations.