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=-26.2 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT,USER_IN_DEF_DKIM_WL autolearn=ham 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 18C4AC433ED for ; Fri, 23 Apr 2021 20:52:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F16796146B for ; Fri, 23 Apr 2021 20:52:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244087AbhDWUx2 (ORCPT ); Fri, 23 Apr 2021 16:53:28 -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-Google-Smtp-Source: ABdhPJwv/59pdLX82gp8PqpMkUaplFvUKA8LCO3J7fNWfEQCZyRfqlrilrf9+ihVp0/woARn6xzPmoFAEQ== 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