Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1027580ybl; Wed, 8 Jan 2020 09:44:39 -0800 (PST) X-Google-Smtp-Source: APXvYqxdkpp/EUmahmdPocLpkoRfXKwqwOoneDAldncGIPMZp5sZg3eI8m7ITKFzpc+OlBw5gnsZ X-Received: by 2002:aca:f242:: with SMTP id q63mr4173801oih.72.1578505479772; Wed, 08 Jan 2020 09:44:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578505479; cv=none; d=google.com; s=arc-20160816; b=SLi0k0QTfVzNfx9zy1i8BXGKr8wqH4yL1b2BksE7PrLpKu2p5X+K2jutWy3GhHIpUn RKdzUlTasCuHXADNNMLf1LYWG6FWI5vixrky11LJxrwkdalX0Tiv2XCfdeY14ZslFevn Ysx5d8IS+bZFVIu7lF3qf1f2wTpckFfEYPTK6udjYXrJcI8JhG7kX9JEXD62iBqTe1Kd lu18WofuwJeEYi3HKX3Pw6DHbjft2rxdD/35KYP2CjC+aTfu6qur+qGHZsES20FntjuC MVh50ZtcU0msQSyzIh5heqQ+QmUHjfYSOUWtJX2ADIySBPwY8jOFkX2dVeeGB0sVND4e hnTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=KrHsQAP0a9eh1NM9sOVdFPeaeyaEh108A3v2h0i3x0E=; b=mYDcE/Ym94NbIOkafzTk6Rl4H3iOe2GTUvrwjraC500Pa1g2oOXs0Frg1mcp+K+thc z3zuXCaHT8rWWNfk0s34KGcizkSjZ7q6c8wu6uHWFQNPc8nrqySKITqUAqiNBdFmuM6S lZGemYUii9RyUdppdsyhDbx6b2WMit28YeTVUxR//aO9DRU0oFT2Uyc9VLBCiUStVNfX hEk/JEhyoSAC+8EREo6sKZSQlCWIWjaTolVq62PZ3d7VeHSlqkSo30wy+KAMYe8atYDL hPclJrAOTpfUTpnI8EzxTxqXhnrAsQPQHzdGu9aiLxQMH2/ylH2Y5tAtdhO82M7f+RYb 2DBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="be/0HgRE"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e24si1974908otl.62.2020.01.08.09.44.27; Wed, 08 Jan 2020 09:44:39 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="be/0HgRE"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727280AbgAHPsF (ORCPT + 99 others); Wed, 8 Jan 2020 10:48:05 -0500 Received: from mail-wm1-f68.google.com ([209.85.128.68]:38667 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726401AbgAHPsE (ORCPT ); Wed, 8 Jan 2020 10:48:04 -0500 Received: by mail-wm1-f68.google.com with SMTP id u2so3011172wmc.3 for ; Wed, 08 Jan 2020 07:48:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=KrHsQAP0a9eh1NM9sOVdFPeaeyaEh108A3v2h0i3x0E=; b=be/0HgREopOPW+2tP9ai/6DG9k194a1evqoodK9bIBc3vz7RTuMFmpvx7YvMURM5+j /WfI9/uYzboJbd4o0O0nLDJ9+DcfHOY4/XH6QArnNld2yqZas8y3GJqdqqy1reHM3uMs M0dIbzPeNLNZrbUYAHWfYJEsssmZPAGKUi0ggzMFLAxOg86ZjaZifHm0/KHB+isTebos bHnq13duf8YWMA+Zhg/OuOjEy86QXkuphb9cZXKwnkcQIuumgHLIPPjMQDnC9bD66Lox 018PiSNZ1dXZhSEWycjVxWW7z+2AeT6M8LODMD+KI0/cY0Lz2dWIhYD3vFGVpuiqu7LO s4XQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=KrHsQAP0a9eh1NM9sOVdFPeaeyaEh108A3v2h0i3x0E=; b=uOBbQvwK7xvN7jHrKK2pyIWBn/uFTvbq7FgJ/g97VFLimlRB3TIFeS7/GH8hQ/QFgc WykdXymbQ3s0w9vfNUbQg7brair5WT2CbHjuTl9BSg1WNo9qwXep0IQxasy21mHRG4mZ IBbmo7q34xKX1xqwEPegRRcBYuLbETGekTq0bCmYKrqHZInfIJsQP33LTR6UjYXGbTw/ GmlkJP1x1MsnHEphQsDoZoFmul5Cdeq94+sAfbyaxjcAl9/cuNtJ3XLSXYAz1v6ysI9+ gYER+0J5PKfPWWuich20f/6PHujFvpq2xpmAchviXtkax9zhkAKz5d6jAGduf0GphYOc auqQ== X-Gm-Message-State: APjAAAXVU57yjFpa7xG7NfXO+3dXNRq6QrJx/yMILqWF20npXLdMLAal sMfZVkQyrLPVfZCndKEuDtZuav7XZKVxezgLFhTWQg== X-Received: by 2002:a1c:3dc3:: with SMTP id k186mr4477316wma.95.1578498482821; Wed, 08 Jan 2020 07:48:02 -0800 (PST) MIME-Version: 1.0 References: <20200108102304.25800-1-ardb@kernel.org> <20200108102304.25800-3-ardb@kernel.org> <20200108154031.GA2512498@rani.riverdale.lan> In-Reply-To: <20200108154031.GA2512498@rani.riverdale.lan> From: Ard Biesheuvel Date: Wed, 8 Jan 2020 16:47:51 +0100 Message-ID: Subject: Re: [RFC PATCH 2/3] x86/boot/compressed: force hidden visibility for all symbol references To: Arvind Sankar Cc: Ard Biesheuvel , linux-efi , "the arch/x86 maintainers" , Andy Lutomirski , 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, 8 Jan 2020 at 16:40, Arvind Sankar wrote: > > On Wed, Jan 08, 2020 at 11:23:03AM +0100, 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 56aa5fa0a66b..361df91b2288 100644 > > --- a/arch/x86/boot/compressed/Makefile > > +++ b/arch/x86/boot/compressed/Makefile > > @@ -39,6 +39,7 @@ KBUILD_CFLAGS += $(call cc-disable-warning, address-of-packed-member) > > KBUILD_CFLAGS += $(call cc-disable-warning, gnu) > > KBUILD_CFLAGS += -Wno-pointer-sign > > KBUILD_CFLAGS += $(call cc-option,-fmacro-prefix-map=$(srctree)/=) > > +KBUILD_CFLAGS += -include hidden.h > > > > This should be added to drivers/firmware/efi/libstub as well in case > future code changes bring in global references there? The EFI stub already sets the hidden visibility attribute for the few external symbol references that it contains, so it is not needed in the context of this series. In the future, we can revisit this if we want to get rid of the various __pure getter functions, but that requires thorough testing on other architectures and toolchains, so I'd prefer to leave that for later.