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=-8.5 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 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 791AFC433DF for ; Wed, 24 Jun 2020 10:46:00 +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 4AFB520781 for ; Wed, 24 Jun 2020 10:46:00 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="vHto0nPu"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="tw0YgqlB" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4AFB520781 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.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=Qe8hx8U+lVy1Xch1OnRnEmkduMjjnFfnSM/G/ib/QyA=; b=vHto0nPuzmYPwlbX0hkmEVRtU mQ/vxX1jD4eAkVZBBPM0wR4AbMn4U5glKsMeOFcsFqtPEjF7jw3wKlenswS2sdmVbidwIyJkrTsl4 FBXnOxaSMWzut3YjuB5E3JzFdbZJy+ZGDHGHFQFKbtGrQcnrVaCmL8kP8CZDrdIeAbb2sMdK0q/5L 1zNY5N4Op0o+p3dA2c9v5oBXcjpVdgKrAyZtvXFDhXSO5LWoird3TOzsgvCVpAqatvX7a6Rt1FXwi /jYgrw2YWpr0v1l5TQLxBCXHIu+C4uG0iemiihiwEeRpFTI0h9++TmgRt3Gp3HvwA8hLfXtwYS+J8 6rzrs09Tg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jo2sy-0005Ew-9u; Wed, 24 Jun 2020 10:44:08 +0000 Received: from mail.kernel.org ([198.145.29.99]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jo2su-0005Di-Lo for linux-arm-kernel@lists.infradead.org; Wed, 24 Jun 2020 10:44:05 +0000 Received: from willie-the-truck (236.31.169.217.in-addr.arpa [217.169.31.236]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id DC61F20644; Wed, 24 Jun 2020 10:43:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592995443; bh=mdTAfhkDJYCASKqPut+490INXl3yMYXb8omd1AxIpR4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=tw0YgqlBzSkYR/8dx7x7agmXiX8h/g6EpRmEO/a+1MwBTs1pSuTCrSWZC5vI/je1Y B8zTuAPx69gOyfVPgWUiRzAt6Ps2l+kX6KH9h9vy5X05ox3kvM9GqlQXGjW5kCT8lk WRLAu0eli8TOtr0mprB99/5d9B7o1GRFfm+BjnNo= Date: Wed, 24 Jun 2020 11:43:56 +0100 From: Will Deacon To: Kees Cook Subject: Re: [PATCH v3 3/9] efi/libstub: Remove .note.gnu.property Message-ID: <20200624104356.GA6134@willie-the-truck> References: <20200624014940.1204448-1-keescook@chromium.org> <20200624014940.1204448-4-keescook@chromium.org> <20200624033142.cinvg6rbg252j46d@google.com> <202006232143.66828CD3@keescook> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <202006232143.66828CD3@keescook> User-Agent: Mutt/1.10.1 (2018-07-13) 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 , Fangrui Song , 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 , Peter Collingbourne , 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 09:44:11PM -0700, Kees Cook wrote: > 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. For the kernel Image, how do we remove these sections? The objcopy flags in arch/arm64/boot/Makefile look both insufficient and out of date. My vmlinux ends up with both a ".notes" and a ".init.note.gnu.property" segment. Will _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel