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.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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 38575C433E0 for ; Wed, 24 Jun 2020 04:46:16 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E79372072E for ; Wed, 24 Jun 2020 04:46:15 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="ELcVqtR0"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="foHqhRb7" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E79372072E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=mgYcGfHZctZwGdzmtLV9XoX4GfFsx8LZRfX9WP2tiS8=; b=ELcVqtR0QtI5xNeyGjWIEBHt2 Er6h549pYVUZgdZHuPEEtVv1ewy3hRudJ/cYXVv723z3+p6f8pzKCuTmy5I9lM0wYjIDhyvtXUwqT xJzJtkhdBDEVFcdcFedIgOb1gwFD5qDSTpAjx5CnBfMfti5pwSWSnl/IBgq43SGADft+JxtrhXfI5 nRXVVFNCDu1lX1ZBLe9q4kXGXrIoS8xjrqhGVJrGOuF2pGCRbVR2kKoPcAuL7YGcuq0myMQPyXiaL Jmkl64B3yEAJHG0XVVu/dkT2CUChzbZrUepWh7FaFebTHyQ9ETZ84Qmm7d4FT1ZK4llqWhkklW8yV 3xqUzCSkQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnxGl-0000kz-59; Wed, 24 Jun 2020 04:44:19 +0000 Received: from mail-pj1-x1042.google.com ([2607:f8b0:4864:20::1042]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnxGh-0000h7-4a for linux-arm-kernel@lists.infradead.org; Wed, 24 Jun 2020 04:44:16 +0000 Received: by mail-pj1-x1042.google.com with SMTP id u8so616393pje.4 for ; Tue, 23 Jun 2020 21:44:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=Yc7m6q+AETZbQf/A/NW3gp84TMebMUYFiYcSc962UaI=; b=foHqhRb7hf5KgQA5HSRO5284qQLj7K1f7jI6KtpF4wP8UIugY2Q4C+9vTK7tIsFkyu gCNVka1KLRgmXwoVN0JFbY5Ac/BHQH24PxKAlxSyvl0q99hluofpS33VW/NvUHVQlz+U gne2QItKrmtHY7DGvrNp9LyDns2aXJiINfTjY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=Yc7m6q+AETZbQf/A/NW3gp84TMebMUYFiYcSc962UaI=; b=FUkBYhgGi3QMBf5GhNi7ynnLU1FuB/heDD2hXBH5c3tTrvFoaJrX9f6LkpPg8xfx+F c1JvE927KqnwGcDPiNqneemVeokCOQq0H9QRo4xdVoTmiKesbxorJzmkBhx05FyfSL6g 63UD0JnZ81OQmtVG/93cQ7igeNhFSsfHhM+WgvyhF/lotSIST6U9a2JA1GIpghdN5oPY 2NpbOijvQX25RJEErzWHMSNbpZtDq+ICN3nvad0xOHg8ascEwMyBXja5oBOKdapZtKbm vFvMNrqA28Lo3FdDTaIxIk1xah0RCkIe8R+Bsvp2txtVVyAjZ0ZHLE16/mgGd5MLOmhb Ki9Q== X-Gm-Message-State: AOAM531L8Z/PaH5bS8tbNJEdnomxt4MuKoOpq5s65OHAYRsaQImy1FeC HT91JWVC+SF1eVBTWq0Vp3Y0cA== X-Google-Smtp-Source: ABdhPJwXxE4pwrV4JSPaLhEV6G1BlATgL4ZGVyFiXtLbOqPg4UWtN+ePnA8hBS3vgqyDG0O2W9xKlw== X-Received: by 2002:a17:90b:a02:: with SMTP id gg2mr6864076pjb.110.1592973853293; Tue, 23 Jun 2020 21:44:13 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id c7sm3578791pfj.106.2020.06.23.21.44.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jun 2020 21:44:12 -0700 (PDT) Date: Tue, 23 Jun 2020 21:44:11 -0700 From: Kees Cook To: Fangrui Song Subject: Re: [PATCH v3 3/9] efi/libstub: Remove .note.gnu.property Message-ID: <202006232143.66828CD3@keescook> References: <20200624014940.1204448-1-keescook@chromium.org> <20200624014940.1204448-4-keescook@chromium.org> <20200624033142.cinvg6rbg252j46d@google.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200624033142.cinvg6rbg252j46d@google.com> X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , linux-arch@vger.kernel.org, linux-efi@vger.kernel.org, Arnd Bergmann , Peter Collingbourne , Catalin Marinas , Masahiro Yamada , x86@kernel.org, Nick Desaulniers , Russell King , linux-kernel@vger.kernel.org, Nathan Chancellor , clang-built-linux@googlegroups.com, Arvind Sankar , Ingo Molnar , James Morse , Thomas Gleixner , Borislav Petkov , Will Deacon , Ard Biesheuvel , linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, Jun 23, 2020 at 08:31:42PM -0700, 'Fangrui Song' via Clang Built Linux wrote: > On 2020-06-23, Kees Cook wrote: > > In preparation for adding --orphan-handling=warn to more architectures, > > make sure unwanted sections don't end up appearing under the .init > > section prefix that libstub adds to itself during objcopy. > > > > Signed-off-by: Kees Cook > > --- > > drivers/firmware/efi/libstub/Makefile | 3 +++ > > 1 file changed, 3 insertions(+) > > > > diff --git a/drivers/firmware/efi/libstub/Makefile b/drivers/firmware/efi/libstub/Makefile > > index 75daaf20374e..9d2d2e784bca 100644 > > --- a/drivers/firmware/efi/libstub/Makefile > > +++ b/drivers/firmware/efi/libstub/Makefile > > @@ -66,6 +66,9 @@ lib-$(CONFIG_X86) += x86-stub.o > > CFLAGS_arm32-stub.o := -DTEXT_OFFSET=$(TEXT_OFFSET) > > CFLAGS_arm64-stub.o := -DTEXT_OFFSET=$(TEXT_OFFSET) > > > > +# Remove unwanted sections first. > > +STUBCOPY_FLAGS-y += --remove-section=.note.gnu.property > > + > > # > > # For x86, bootloaders like systemd-boot or grub-efi do not zero-initialize the > > # .bss section, so the .bss section of the EFI stub needs to be included in the > > arch/arm64/Kconfig enables ARM64_PTR_AUTH by default. When the config is on > > ifeq ($(CONFIG_ARM64_BTI_KERNEL),y) > branch-prot-flags-$(CONFIG_CC_HAS_BRANCH_PROT_PAC_RET_BTI) := -mbranch-protection=pac-ret+leaf+bti > else > branch-prot-flags-$(CONFIG_CC_HAS_BRANCH_PROT_PAC_RET) := -mbranch-protection=pac-ret+leaf > endif > > This option creates .note.gnu.property: > > % readelf -n drivers/firmware/efi/libstub/efi-stub.o > > Displaying notes found in: .note.gnu.property > Owner Data size Description > GNU 0x00000010 NT_GNU_PROPERTY_TYPE_0 > Properties: AArch64 feature: PAC > > If .note.gnu.property is not desired in drivers/firmware/efi/libstub, specifying > -mbranch-protection=none can override -mbranch-protection=pac-ret+leaf We want to keep the branch protection enabled. But since it's not a "regular" ELF, we don't need to keep the property that identifies the feature. -- Kees Cook _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel