Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp61304pxj; Thu, 20 May 2021 04:36:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxsrvzf/fL0gO9BndSQV8OG09ALamhRuJtYgv7chTrgI56QS5xxAhUuttZzb9guFWYWjyD+ X-Received: by 2002:aa7:d58b:: with SMTP id r11mr4519681edq.231.1621510561861; Thu, 20 May 2021 04:36:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621510561; cv=none; d=google.com; s=arc-20160816; b=huBUL5zfKcEonAMX7PDzD3hFlRyb1+Oe2GiWGUeQ7JvxIwoNO32AMTeo7M8+ysOJO+ XHb7+yapuG7vwDGv9GBJWZL3I4k1ste8OTw9p6clc1/OkIjkT5gVMZgqSFTDj60KwxiT feLnA0UpL67B5Q3MCjzwMWhuUHvy7DWe8u6+Z5qCcI/1gchOm139Jh8Bp8e2TRsSR5ht AMSaEcZsWqZVqD5zeVJFtR8KvGLuoGnbQ3waajqjrWHtaV+V2qbUD4U4rmc3fhGxGe66 BEkT3i2Q7CsDoM67JOX8IY1SAzJirU1Bb2Xrj07ChnEHwoMx6qmy6hEh8lo8WyYWUCrL F6NQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Rt0ck1kICl+J6eydM4ele4+sKf4e8CmeKLncMiyjmRM=; b=B+gvZ1lifYJvczwOder/ysD0C48f4PVuCw1MoT06o+LqPFa/ZtwjZszMiPBitKFlCY gTous/wTmjHn1sPGETzALPHUDtbFFiT6CWMcI4EKMd3UzhBxM8uWBcZV0P7Wf18zOX7k zoekYKElNGEPoLrIMGypvRJhtlBwjbd7ii+OAlDXvoYVqTyI/FDi8hwGN/SC7nDmtBdW Ty53MHDW9I+Q2BAvgsIw9JtM+Gwwow9IvhH5rhij+RSHLHWRe/kTPVxlr94yxxjHyezQ Jo/28M7pogCGBzkI10aqRbKFj7Vje5seHPuVnSEL1ZRGSMG56sVpsIJ9ovmAkIVyw1Np 4mMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=bwIPh4Xa; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j8si2989046ejk.38.2021.05.20.04.35.38; Thu, 20 May 2021 04:36:01 -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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=bwIPh4Xa; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242169AbhETLe7 (ORCPT + 99 others); Thu, 20 May 2021 07:34:59 -0400 Received: from mail.kernel.org ([198.145.29.99]:56748 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239796AbhETLOL (ORCPT ); Thu, 20 May 2021 07:14:11 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 9D9BD61948; Thu, 20 May 2021 10:08:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621505309; bh=bMDSByNOiPklIrA2k1Ro+e9MtWrmK7+cEubHy0un9C8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bwIPh4XaZQ2COit1W01+UqpbQ2jTnkpfKtqBUh8uDWwtdnWdQB3rN4p82xtAxFYA0 CzxIm+Syx9nf/w62As1uzQnpAZU8rJaQ3Mnji7wyAjbwZygS83z4Wg0uXxHpNUJA0d Mo20K6Dtibo4uHq5vrW+o4VeTbyQaFfWYg/sDftU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bill Wendling , Kees Cook , Ard Biesheuvel , Catalin Marinas , Sasha Levin Subject: [PATCH 4.4 041/190] arm64/vdso: Discard .note.gnu.property sections in vDSO Date: Thu, 20 May 2021 11:21:45 +0200 Message-Id: <20210520092103.529991338@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520092102.149300807@linuxfoundation.org> References: <20210520092102.149300807@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Bill Wendling [ Upstream commit 388708028e6937f3fc5fc19aeeb847f8970f489c ] 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. Signed-off-by: Bill Wendling Reviewed-by: Kees Cook Acked-by: Ard Biesheuvel Link: https://lore.kernel.org/r/20210423205159.830854-1-morbo@google.com Signed-off-by: Catalin Marinas Signed-off-by: Sasha Levin --- arch/arm64/kernel/vdso/vdso.lds.S | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) --- a/arch/arm64/kernel/vdso/vdso.lds.S +++ b/arch/arm64/kernel/vdso/vdso.lds.S @@ -39,6 +39,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); @@ -59,7 +66,6 @@ SECTIONS PROVIDE(end = .); /DISCARD/ : { - *(.note.GNU-stack) *(.data .data.* .gnu.linkonce.d.* .sdata*) *(.bss .sbss .dynbss .dynsbss) }