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 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=-16.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable 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 8A28EC433B4 for ; Fri, 23 Apr 2021 20:54:47 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 06531611AC for ; Fri, 23 Apr 2021 20:54:46 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 06531611AC Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:Cc:To:From:Subject:Mime-Version:Message-Id:Date: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=k7BCK9RgmNoU6KRORTGqUZw6VXQw7TlogLvU1KN9TxI=; b=Kc6ARw5n0iKrw8dXLCv2CRJLMc HzS1nxRSofQhEJ3V4VP1hQ99YKxYa1uC79pilxz9/zz6BgVKqiwYcudPek6p71mcJg4B4shByFOVQ z0/t3HC2bJLuI7MlhxlnoCsIpfm1LbdPeOftDzaS+Pw7juWl0l0VcwriAWn/J6pmpavZp0r1dLyOT Pl7sXt5rkludNGyQRRwkyDQQhPWeEL4riQIfJmelzANgYHn1tqrz06dENQjYfre3Xzw4IRpNpNDQL K8ofeyTGZpY7He1PxFPz3feXCcRi1InBYdqdNzYVahj0CgYUBmZFXHpiKyXFodKj/FgLkJ0IF7Kcg G/SjaF3w==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1la2mj-002KjP-4V; Fri, 23 Apr 2021 20:52:21 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1la2mg-002KjJ-9s for linux-arm-kernel@desiato.infradead.org; Fri, 23 Apr 2021 20:52:18 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Type:Cc:To:From:Subject: Mime-Version:Message-Id:Date:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:In-Reply-To:References; bh=B8W9GuZq7WCqEr4jUqEgvsObyRTlZeW6D3zN4no97As=; b=XXMpGt2atG6sEtgnerN3W5qdVN jZjWyrCZ8pauMSUopHeti+SQrMm31Unx13adk06FbE7cUb6F32TEa0AMMJmilbzVwxM+A2vYhi3GN /p2gRzlNPhG18bo58Td4UxvB3UD8iwg9jIlc+lCELaiAIzzwg6LEqMIR6F7vH5y/0Yt4OgFqDC3bB H9zndXiQ4hhK/CvyH/ULA7jizjNgYL9X5bNfRJkBISbFdi95ie25u16d63lwsiIOLFkd2xmyj/lVy ckPLJRuvvBZIwhoo/BdFheaxOHkHp2VvaAMgv9jmEkRwZkUG+/mDImTyHfUIYayZTloD/K/AYf+6/ CHMAM84g==; Received: from mail-yb1-xb4a.google.com ([2607:f8b0:4864:20::b4a]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1la2mc-00Eh8j-BW for linux-arm-kernel@lists.infradead.org; Fri, 23 Apr 2021 20:52:17 +0000 Received: by mail-yb1-xb4a.google.com with SMTP id s2-20020a5b07420000b02904eb842efc40so25590363ybq.3 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=fMj5OLP6kX1GhDszpbF+TYr0XCl5bgRrAzSeJ9EL0L+jlAMVRaNkEkE7EQVfhAcFQM 0CnAT5ZXL9VBG9NAKkxgjp/32wp15Jh1bfF40nxCg+Wcd5y3FYrV2eO8lAFcU7ZihWBa dlIrkygUJcMIOn1urlSjS+IwZAFDYDKFHo3LbIWVxNZrx16z24njqjNVUTV7gxT4kGvx xJDnP74+gnosLHH32sEoBxy/Lm1QsCC+sgFoub7ZxMzJvr0bK1gWf4PL9PbDrLewudGm WgGSOizvKt9ZH085w1J7dC/icf+ICaQckEoIRu1idhTf6JdaFpyO0X4/tUnK8bnxcqPx N65Q== X-Gm-Message-State: AOAM532hu880caPsJFfnMy/exXICPjnA60i6dYZDjz3v1t+uf24iOm60 WgM0oVAGn4zGdX7DOZIEaB/8/qJ0 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210423_135214_437343_DB8A022B X-CRM114-Status: GOOD ( 13.92 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel