Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp1667933pxy; Fri, 23 Apr 2021 13:55:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxdXyeBuD5tBek5nZ67Wru8w+vi60udrdSXs17OcFL90hCYgVDUq7/SVjWmUHCHQBZEP1tM X-Received: by 2002:a17:906:fb19:: with SMTP id lz25mr6041683ejb.544.1619211314982; Fri, 23 Apr 2021 13:55:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619211314; cv=none; d=google.com; s=arc-20160816; b=oVtxX+6trDZnyNDTLoCe/8tRWoWI48DHGCWcMXdexlmYu7Hi8WvedBGAeICCp5X5a6 VwsHNccWMHUUPfeR+Dq5WhCX9p7sCH1pfUKLOZpAMEehHoVOiqxvpCeWEiT9gOsqP/O5 8LeoPJ/beNW2EjFLCZZa/+TZBu+jh94YpJGeYIuWdMBq5td8FwJfrvss0V1xXITtLyH5 OcDVQhYs2WundlvBYwjvy9mc/hK6en9+6Ps6zTCBrAk3jr/4kY9awU8Sl2Ea3/Z13eC0 UtOzgQ+Y6NJBEvWbrTvpvUqxtRCyytTWyNLKrgWl5VfOvtqiUo354mkjHY060H6vyOJC PFXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:mime-version:message-id:date :dkim-signature; bh=B8W9GuZq7WCqEr4jUqEgvsObyRTlZeW6D3zN4no97As=; b=p8dFuukm/Euzc/uHfDpIP88z8iBvpO+O5PhCLC0mcouR5qLvx3E5JN54dtYGigwNxc ZmgR+vskEYfCOfYmKhfIm4QqRv1XySQXEuXnuDgkAtKfTZgkXmcUlltijTdNjysLYdOe 8mw2xEeur1wZcNVnBGpwz/4NOLMj74+r/FEHk6jczk5WIVA8r9Tj1tv8/jg2MRWu69HH Uy8iG2e7kW0a0dkSUmfylZVzeoVbqapZc/KfB3/b3HrgnmAu5phOFxGbweqR38DOQgZL tFb90kYj8ypBhyjVWYmGXxs9wgmS8LQO43hfSmQkiC57KcDFpQIb+YQC0zmyZOYE2DS+ Sj1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=nbrufPBS; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hc43si7170766ejc.387.2021.04.23.13.54.51; Fri, 23 Apr 2021 13:55:14 -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=@google.com header.s=20161025 header.b=nbrufPBS; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244109AbhDWUx1 (ORCPT + 99 others); Fri, 23 Apr 2021 16:53:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42336 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244032AbhDWUwt (ORCPT ); Fri, 23 Apr 2021 16:52:49 -0400 Received: from mail-yb1-xb49.google.com (mail-yb1-xb49.google.com [IPv6:2607:f8b0:4864:20::b49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9FF95C061574 for ; Fri, 23 Apr 2021 13:52:11 -0700 (PDT) Received: by mail-yb1-xb49.google.com with SMTP id u7-20020a259b470000b02904dca50820c2so25779408ybo.11 for ; Fri, 23 Apr 2021 13:52:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:message-id:mime-version:subject:from:to:cc; bh=B8W9GuZq7WCqEr4jUqEgvsObyRTlZeW6D3zN4no97As=; b=nbrufPBSmak7MDiEHek/PT1aubL0xnaD1hyWWnJG8uuf0C8ZyAFS+NnBoyChnJteoE JwzPLdQqlxGSK/SmTiMKguEP1IV+AMFMaOy41jaXmbzSoSAOhLn4khXAbWNDhPMb7OGz ME2yM1Np1EOTU5r4EHmyT8RsaSYR/9aOQSPImuNnTOzPHFu9JRCu/UPt6qMHQmVj7AGt xQO6OTfbmaW3AudcyF1Y6MWQZhLolc0VV1xt9KMp+PCDGKTN+46vlGn75rjzsEI14Ydo QxdKUJU/wcWdS49RwIXNQWfK9PBbha2VRSTdUyuZOCVqJf9qR1a69lRzH7SOeGE7sAqn xF4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:mime-version:subject:from:to:cc; bh=B8W9GuZq7WCqEr4jUqEgvsObyRTlZeW6D3zN4no97As=; b=lAoaceVhNQniWPEtppZOpgkVfDQwhsx8OWQXKeE6hIuJ6JJSo/1z76OydH49zvf9Ob CVnO5Bre5qQkAMQjTo5HoXWF6rqGut9M6kI25L2KVefs6p19Ky2dPxwAcuWTluEfmr9W E43eWd4LYcWFJm18zK37jLpCRZ7KGfbooVxg0cXgqwOUN6WEFtLhidWxILTVoMIQtnbP lgihRJecLTpjkd/+rwQFpQyVr+xDYGdLNU/MU3LuYB0cYHFXd8rEcl057GAMgZp4VZ/A pwJxrfHOdElli+R0n/wHuiczUxh1hn0RWNgnKHtT+MhkVvOviMG6Xma5pQP91udE6lX9 XuAw== X-Gm-Message-State: AOAM531LYzPI45HRhuw5/3/0vBSccMsxX+fdN0vivySuK1h02b0j62ek k4JEG0Bg1/R+UiLc/zR+qDWchY9e X-Received: from fawn.svl.corp.google.com ([2620:15c:2cd:202:346a:676a:80d1:2aa0]) (user=morbo job=sendgmr) by 2002:a25:9942:: with SMTP id n2mr8391320ybo.230.1619211130899; Fri, 23 Apr 2021 13:52:10 -0700 (PDT) Date: Fri, 23 Apr 2021 13:51:59 -0700 Message-Id: <20210423205159.830854-1-morbo@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.31.1.498.g6c1eba8ee3d-goog Subject: [PATCH] arm64/vdso: Discard .note.gnu.property sections in vDSO From: Bill Wendling To: Kees Cook , Ard Biesheuvel , Catalin Marinas , Will Deacon , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Bill Wendling Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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