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=-15.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,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 84347C433B4 for ; Wed, 28 Apr 2021 17:30:35 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 08142613F7 for ; Wed, 28 Apr 2021 17:30:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 08142613F7 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com 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=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:Cc: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=ZZVFmUtV61l13rm/ajEq3XUQFeLq7Ra0L9w6qFMqy8g=; b=cLnkyP87G8Z2NKKg+8zDJiit0 LwI3TA1kTTAyG8Rkyo8XFexP2Qb6LhIgjThkJ8EKQSPNN036owlni1a6oKXhK3+rQBIlOLyKE6CDb CL4ZdCZsEX9tSaESYakZTGDYxRw0l3Bs2Fb1z66i7w1edxqtSKiyLASsTWiigk6DMHCqDZS/crdol XBmmFg0oVLhQg6PHxYCthERT8qlRSyj9D0XRbXAGtbQQB/nnleloYUcfa4AAiFSDkZlCYtkRtFPtT RaqCT5wx5AC6g/KptxoKra6UCIS7G4azGp5gQXvCxnAPhHzHSRmx4FwzGUHCkSAuDHJ6CEXIq0Sza 24SbwUTQg==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lbnzd-00404a-Qv; Wed, 28 Apr 2021 17:28:58 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lbnzb-00404S-5P for linux-arm-kernel@desiato.infradead.org; Wed, 28 Apr 2021 17:28:55 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=tw93ry4P2C+U+5BgUutcCPSc2U8RndsDWwKCsTv9FxE=; b=n8pl27Dh/OCaepOavGwkpe+FUu AiezOJS3eWHEBCz1NRu827R/zOx2asa6Rsfeg/oCC6wW9vYRAXVOl49WdBvp4ZTv/srKsbnW5DVcT U/5fMucGsW1+8wIQMNLN6OjZ7j91DGAT02hYejLNGgFL1wUrQeMxEcWsonR7oYwydveLNpamlxuiX cnrRWp+kWSaqvJSfSJJcey0rdAXQIBDJrykaLl9Fb2U+sncg7Za5Wvo9fjkz3CTExmFD0r59jNRYZ BlUbkkZ/tPanun21Sh1D/+7bPxQpEbK90B7v9Q5uFgA7z3C0KpDkdARJVaK1w8rwKsNWhwOoKMQcZ EsakJH2A==; Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lbnzY-0003z2-Ai for linux-arm-kernel@lists.infradead.org; Wed, 28 Apr 2021 17:28:53 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 18F8461431; Wed, 28 Apr 2021 17:28:49 +0000 (UTC) Date: Wed, 28 Apr 2021 18:28:47 +0100 From: Catalin Marinas To: Bill Wendling Cc: Kees Cook , Ard Biesheuvel , Will Deacon , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Mark Brown , Szabolcs Nagy , Daniel Kiss Subject: Re: [PATCH] arm64/vdso: Discard .note.gnu.property sections in vDSO Message-ID: <20210428172847.GC4022@arm.com> References: <20210423205159.830854-1-morbo@google.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210423205159.830854-1-morbo@google.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210428_102852_430311_BB5D1006 X-CRM114-Status: GOOD ( 24.71 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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 Fri, Apr 23, 2021 at 01:51:59PM -0700, Bill Wendling wrote: > The arm64 assembler in binutils 2.32 and above generates a program > property note in a note section, .note.gnu.property, to encode used x86 > ISAs and features. But the kernel linker script only contains a single > NOTE segment: > > PHDRS > { > text PT_LOAD FLAGS(5) FILEHDR PHDRS; /* PF_R|PF_X */ > dynamic PT_DYNAMIC FLAGS(4); /* PF_R */ > note PT_NOTE FLAGS(4); /* PF_R */ > } > > The NOTE segment generated by the vDSO linker script is aligned to 4 bytes. > But the .note.gnu.property section must be aligned to 8 bytes on arm64. > > $ readelf -n vdso64.so > > Displaying notes found in: .note > Owner Data size Description > Linux 0x00000004 Unknown note type: (0x00000000) > description data: 06 00 00 00 > readelf: Warning: note with invalid namesz and/or descsz found at offset 0x20 > readelf: Warning: type: 0x78, namesize: 0x00000100, descsize: 0x756e694c, alignment: 8 > > Since the note.gnu.property section in the vDSO is not checked by the > dynamic linker, discard the .note.gnu.property sections in the vDSO. > > Similar to commit 4caffe6a28d31 ("x86/vdso: Discard .note.gnu.property > sections in vDSO"), but for arm64. Can we not instead fix the linker script to preserve the .note.gnu.property, correctly aligned? It doesn't take much space and while we don't use it now, it has the BTI information about the binary. Cc'ing a few others who were involved in the BTI support. > Signed-off-by: Bill Wendling > --- > arch/arm64/kernel/vdso/vdso.lds.S | 8 +++++++- > 1 file changed, 7 insertions(+), 1 deletion(-) > > diff --git a/arch/arm64/kernel/vdso/vdso.lds.S b/arch/arm64/kernel/vdso/vdso.lds.S > index 61dbb4c838ef..a5e61e09ea92 100644 > --- a/arch/arm64/kernel/vdso/vdso.lds.S > +++ b/arch/arm64/kernel/vdso/vdso.lds.S > @@ -31,6 +31,13 @@ SECTIONS > .gnu.version_d : { *(.gnu.version_d) } > .gnu.version_r : { *(.gnu.version_r) } > > + /* > + * Discard .note.gnu.property sections which are unused and have > + * different alignment requirement from vDSO note sections. > + */ > + /DISCARD/ : { > + *(.note.GNU-stack .note.gnu.property) > + } > .note : { *(.note.*) } :text :note > > . = ALIGN(16); > @@ -48,7 +55,6 @@ SECTIONS > PROVIDE(end = .); > > /DISCARD/ : { > - *(.note.GNU-stack) > *(.data .data.* .gnu.linkonce.d.* .sdata*) > *(.bss .sbss .dynbss .dynsbss) > *(.eh_frame .eh_frame_hdr) > -- > 2.31.1.498.g6c1eba8ee3d-goog -- Catalin _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel