Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp766620pxy; Wed, 28 Apr 2021 13:51:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzHEcYVcM/gf/AXuWVXip8ZHzYjVBHUbKGgLKUJyfUdYzDIF+0GEggkptseEcKTyEqylpuz X-Received: by 2002:a17:906:2408:: with SMTP id z8mr14800110eja.60.1619643100141; Wed, 28 Apr 2021 13:51:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619643100; cv=none; d=google.com; s=arc-20160816; b=j38x4pvR8JfjCEityFeZVG6w+8hak0REmQ8kp7SeYcJZ9wyZvSY0lB4iIzJnt9mDAP Af0iYoZk0O8lZYc8bA30oUaw5MYITNyC83fOqspLmjytdPRWFmVccUb3+mJ84A6Vr318 7bR0DvugorfSweiCl7lXERE7GDQfJI5jw7fCSy0xrtgBizC8CFIOK3gjEf3u1oZtWRFj tp5sSk/9JJksZHFDeVJZaGkEwT5WGgjse3JDuBITj1gVAhMEuMBP3m1R3vpzGsKrH262 dl8KeOC5lZDJ+JMoiXoCdk9rcu2bIyyKumuwlMyDUa3YC5IMDa2y4JZ9CRmE6eMDMWyX j/CA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=tw93ry4P2C+U+5BgUutcCPSc2U8RndsDWwKCsTv9FxE=; b=pFw6ybK6OGglvfqiS5Pt1lJJHdeaY8IdpArYUprjsMvayYLjFZwqg58QSmfW+Kusjl LIWHU9aabiJ0YFUKnNNzuxpvN0oN0PJGhfQfElFeXXQHJrZm5QSXFleURKX2HkFW/mmI B2LGXpLBBe8oEHFpAua1nIvNwLH4xGQLvm9xq/+3pUXgi2ae3uHTFfV1nt9CajZJSTHL qkauUQHptIqIsQrTaEXnaWkvfYjlPLXEcBvqWDK19n1FoGoiviKof8/Pz4Mjnefut/q5 VhvvaX6LhNWDu68cX+ltaQH7RfCwW/AWrowSTidBdsKc4020+cJJeYM5b9X6vKwiQLCl n/XA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h14si849804edr.525.2021.04.28.13.51.17; Wed, 28 Apr 2021 13:51:40 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241651AbhD1R3h (ORCPT + 99 others); Wed, 28 Apr 2021 13:29:37 -0400 Received: from mail.kernel.org ([198.145.29.99]:48476 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241631AbhD1R3h (ORCPT ); Wed, 28 Apr 2021 13:29:37 -0400 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-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210423205159.830854-1-morbo@google.com> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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