Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp1048433ybm; Wed, 27 May 2020 14:53:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwkQiguy3wS6taqBiWLPa8aoBT3guDxaudhC6Y87hpl6Dcy3KG3AXVLJqWtmhck5GHb3MJM X-Received: by 2002:a17:906:c828:: with SMTP id dd8mr352303ejb.550.1590616388231; Wed, 27 May 2020 14:53:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590616388; cv=none; d=google.com; s=arc-20160816; b=DH/na5F/xxPGOKDnV8QktBi+cZ3EYNqXl/UHJqjRoZfArkzXeA3vpOTsz1mOcF0Zkv GnEn30ez9hQjoJeG/gemMSHTj5noZtL3iP4ryr8YQZ0cJP6KSm2magUEB7fY41v0wuHZ 0RnxaBjB2cB71+DWBcLBItoyDFvorIwIxP8FESGRpJNcCpmXmF47wPwM1QUhMmYKF6oE sXkWUMqev9EJk5uHSziwqBNXEvDeRto1Lb4S0mG5UZc9N+nSOfS72R26r+6jaF9plPwc avYh5H2J3unYfc3ZZ65BuP4YHZMMhpQMP09OUhH4F5segxts/CeB2T/BQW3AbTQkhjG8 FfMg== 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=6nqB1CqAOrD7N/RSJ1Jbie0/pGnHAP1CoqIdVTZpGhI=; b=uK+1lOYSZkWS+E1il8qg1JN6coPE3eHhM7+wlFaJngM32xLiqP0i8AXJN1GF97BerU eB/AoJELp/8SWuR68EulXqBFvNoAmzqhp9dEha2TW/Ngr70jnlAr6l8VU4e5SrVdmrV1 0R2wLRgcaZD1eZ7ULk7g3JQzDprT++GaMdH99FKVtFNDotyx9YKQPGtZbBWxeHDFgT54 vKVZL1ljXxFlqeHHnQLOBK02SSPfif13uxgMo50C+ZJi6nEy2wZFlamX9vnfzyRW6+3t RSy/bvXgg6UWCOuzfcMZKsd0XPYeo8ESnsVr74ZjNNu2U1Il8KnGfb016EJy82ohI8Cj 1vMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=2UmN9xCp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z10si2388266edi.521.2020.05.27.14.52.44; Wed, 27 May 2020 14:53:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=2UmN9xCp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727101AbgE0SuQ (ORCPT + 99 others); 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-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.