Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2465513pxj; Mon, 10 May 2021 03:45:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwUEhxb6Pd7ymUxEnitwfkUMcEdgkQYAiVyQ6Oyge27ObWtae0iQ7F5BefH6EB4SjBvwQnW X-Received: by 2002:a17:906:158c:: with SMTP id k12mr2520823ejd.274.1620643559075; Mon, 10 May 2021 03:45:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620643559; cv=none; d=google.com; s=arc-20160816; b=kbgas5Vs6+TAXXMUqmLpfe6Rh9ZeJ2sO5MowL7lNM7R5CV8W2a8RvnkngTt3zNGbG3 Pt479cbDOfzioqdB/By/7rVGuzue9HlbqyikjsXCas3xqMPKRYb4/YyQw12/s7Ppeudh sQ79N1vy2yFMxhtnxNeLhf8P3TChur7BLLlfy2wlJmRXLkqM+1DhT1UOrfyJ112n3p8I JJqFU99Eb+oWg21E81rpJ77tMYmFgw+TgXPRJDBq3JWCiqVMPcK7Az/NLyQ+Rf7YbHvu e+4fHicR/LHvel4wa+gnq7OUuJaNI26WO3GO/ua39/dCVGnP4eqAXe+VZOUFy4Bm3gCl XbbA== 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=2pFkjtmOxtjlwTOHHCTmtoepQW4I+nwppEIvwZNEsJk=; b=V7Dz5R/6w1mkD8AzX2zXUX47ZDHjMsV9uS6Nm+lRMsPKMRAZZu+8+mJkglohUtLaJq U84O+HAekTE4sc8RqcPEnJxUNoMPEvDnwKGPphecYeYPxfC82nlBKdUwhxNLOu1zgJa3 sBljpezHMoxlVS0sU5fVDvxivzfOFSr8qbHFSMmuT1s5Vv0vf1Cp8QEqlkyYQUzgNGj8 IlsN+FPz87Mo4kc48tkjhCloGscz0ih9Pq/jKxZFcrdFHUr87KcLjDz25ok22wNas1PQ XjRLRClKQipbQYbPSA7yZDuwDIr7kv79+eqCy2oaizIhkn/MT1xGRY/BymZqmZYbNzcO kJDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Mstsz44G; 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 k19si12535165edx.68.2021.05.10.03.45.34; Mon, 10 May 2021 03:45:59 -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=Mstsz44G; 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 S232566AbhEJKo0 (ORCPT + 99 others); Mon, 10 May 2021 06:44:26 -0400 Received: from mail.kernel.org ([198.145.29.99]:40468 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231867AbhEJKfp (ORCPT ); Mon, 10 May 2021 06:35:45 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id CBCAC61935; Mon, 10 May 2021 10:28:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620642538; bh=A4BMpIbDqHeE71Hyy2pt8f5E6pO94shDlNlFupU82ns=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Mstsz44GzmluusSQJ1OfGK2rW0lr4qtZgrffkO6kdZeq9UACgLBzq8tsJ/ot9i1Yx sifHjUxy64b1XBUxmYflS+Ke4OYDplWvyOImw9UTCguJagn3rre4AX9xX+0LVwG/CI 58yw/p/9uI/G/oAjoCqxNwSoPXryLCB2KYdP4ugw= 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 5.4 136/184] arm64/vdso: Discard .note.gnu.property sections in vDSO Date: Mon, 10 May 2021 12:20:30 +0200 Message-Id: <20210510101954.611509007@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210510101950.200777181@linuxfoundation.org> References: <20210510101950.200777181@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(-) diff --git a/arch/arm64/kernel/vdso/vdso.lds.S b/arch/arm64/kernel/vdso/vdso.lds.S index 7ad2d3a0cd48..815df253f96e 100644 --- a/arch/arm64/kernel/vdso/vdso.lds.S +++ b/arch/arm64/kernel/vdso/vdso.lds.S @@ -28,6 +28,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) } -- 2.30.2