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=-2.3 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no 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 85776C433E0 for ; Wed, 24 Jun 2020 11:28:44 +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 54CCB20836 for ; Wed, 24 Jun 2020 11:28:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="vrBlNqIM"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="TaJFnJBJ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 54CCB20836 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=AdAXwRs4e6vYCiq4Mt1TNBapQXhIgryqzZB/HXaTMOI=; b=vrBlNqIMTSvat/8ln/lQZE2ty +z0jrM5jBAajRiAZMZYyqf2x9jW6L++rsv6jQSAucMAe4qHX3HVzww2rIpyoMkguke876SbJDlOQk CVOCHsXFumM01ps3eMcjf8VgdFTlcI7RdOAompYKjmFVx5XV8XsJaqlHS+FimldroeBtq61C9g7iX YQP4ZBuJQmaoxrJn9Ii+9VJVaRFGfm95hxAR0FE6IjXR4RS2H9RJMfVPukEb4q/Sp8KyuVVwx60Dq CEBO0oW9thtnhuvAf2KX17PINCxjpVS2ZONPSRtUWl4n8FNXhoiLj7mwy8PTItsJyWZ7ld1Kr9dLH uKGq4KfZA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jo3YQ-0001pB-CA; Wed, 24 Jun 2020 11:26:58 +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 1jo3YN-0001o8-Ay for linux-arm-kernel@lists.infradead.org; Wed, 24 Jun 2020 11:26:56 +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 2917020836; Wed, 24 Jun 2020 11:26:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592998014; bh=0UmukP6NVeEd+zs9QbZciKhf63orfAMQP6x99v2ThjI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=TaJFnJBJH6v57vh4k4qpqczHZE+gAEuxHL0D7vQKZQV7498wW0m4uJi1n74icYaZA 4pEeFLTVg9u3esVOG13VCDEP7R/rDl5jdIk3cq65wbNF6TsH1UVIJvzqGffQpDl5ff dRwYJhIecRl6FOQtcWKDOiGr4iahuuAGRSV4kBsU= Date: Wed, 24 Jun 2020 12:26:47 +0100 From: Will Deacon To: Ard Biesheuvel Subject: Re: [PATCH v3 3/9] efi/libstub: Remove .note.gnu.property Message-ID: <20200624112647.GC6134@willie-the-truck> References: <20200624014940.1204448-1-keescook@chromium.org> <20200624014940.1204448-4-keescook@chromium.org> <20200624033142.cinvg6rbg252j46d@google.com> <202006232143.66828CD3@keescook> <20200624104356.GA6134@willie-the-truck> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: 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 , linux-efi , Kees Cook , Fangrui Song , Catalin Marinas , Masahiro Yamada , X86 ML , Nick Desaulniers , Russell King , Linux Kernel Mailing List , clang-built-linux , Arvind Sankar , Ingo Molnar , James Morse , Linux ARM , Thomas Gleixner , Borislav Petkov , Peter Collingbourne , Nathan Chancellor , Arnd Bergmann 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 Wed, Jun 24, 2020 at 12:46:32PM +0200, Ard Biesheuvel wrote: > On Wed, 24 Jun 2020 at 12:44, Will Deacon wrote: > > 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: > > > > 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. > > > > The latter is the fault of the libstub make rules, that prepend .init > to all section names. Hmm. I tried adding -mbranch-protection=none to arm64 cflags for the stub, but I still see this note in vmlinux. It looks like it comes in via the stub copy of lib-ctype.o, but I don't know why that would force the note. The cflags look ok to me [1] and I confirmed that the note is being generated by the compiler. > I'm not sure if there is a point to having PAC and/or BTI in the EFI > stub, given that it runs under the control of the firmware, with its > memory mappings and PAC configuration etc. Agreed, I just can't figure out how to get rid of the note. Will [1] -mlittle-endian -DKASAN_SHADOW_SCALE_SHIFT=3 -Qunused-arguments -Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE -Werror=implicit-function-declaration -Werror=implicit-int -Wno-format-security -std=gnu89 --target=aarch64-linux-gnu --prefix=/usr/local/google/home/willdeacon/bin/ --gcc-toolchain=/usr/local/google/home/willdeacon -no-integrated-as -Werror=unknown-warning-option -mgeneral-regs-only -DCONFIG_CC_HAS_K_CONSTRAINT=1 -fno-asynchronous-unwind-tables -mbranch-protection=pac-ret+leaf+bti -Wa,-march=armv8.3-a -DKASAN_SHADOW_SCALE_SHIFT=3 -fno-delete-null-pointer-checks -Wno-address-of-packed-member -O2 -Wframe-larger-than=2048 -fstack-protector-strong -Wno-format-invalid-specifier -Wno-gnu -mno-global-merge -Wno-unused-const-variable -fno-omit-frame-pointer -fno-optimize-sibling-calls -g -Wdeclaration-after-statement -Wvla -Wno-pointer-sign -Wno-array-bounds -fno-strict-overflow -fno-merge-all-constants -fno-stack- check -Werror=date-time -Werror=incompatible-pointer-types -fmacro-prefix-map=./= -Wno-initializer-overrides -Wno-format -Wno-sign-compare -Wno-format-zero-length -Wno-tautological-constant-out-of-range-compare -fpie -mbranch-protection=none -I./scripts/dtc/libfdt -Os -DDISABLE_BRANCH_PROFILING -include ./drivers/firmware/efi/libstub/hidden.h -D__NO_FORTIFY -ffreestanding -fno-stack-protector -fno-addrsig -D__DISABLE_EXPORTS -DKBUILD_MODFILE='"drivers/firmware/efi/libstub/lib-ctype"' -DKBUILD_BASENAME='"lib_ctype"' -DKBUILD_MODNAME='"lib_ctype"' -c -o drivers/firmware/efi/libstub/lib-ctype.o lib/ctype.c _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel