From patchwork Tue Feb 7 18:31:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 54043 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp3014460wrn; Tue, 7 Feb 2023 10:44:24 -0800 (PST) X-Google-Smtp-Source: AK7set+g2ZQbI/nT3KvIvDM6id99P7DtWcExw3DrLR6oMtO3+9OH5PwicJW5D+TaHMDK/noq9nXq X-Received: by 2002:a17:907:7e98:b0:872:6bd0:d2b with SMTP id qb24-20020a1709077e9800b008726bd00d2bmr6421566ejc.45.1675795463874; Tue, 07 Feb 2023 10:44:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675795463; cv=none; d=google.com; s=arc-20160816; b=QaLBDtCeF8IafK5hlUxRobRshQGMEcuRLRzaBxMY6l3kmOCNxgJqRiSYiqU5sViq/E F4a1QXk6AiSiEHFYQQurVGwrugbNEtVVIq3z83AclmIf1cO1pbNtdUVAXG4TzS25QdCW UYxrQR0uauapy1ZDZki8/e0pbwETtjtZMUc/P0a1HHZJRPvOIWMX6BJvyplKCS/uMNkz FH2KCPsuSikLH7bQNoZoHz826OIYnEj8xPJDpmtzCeSWtcT/qbLCtKBzhnOmgPhNGa0o tQ6CYJkCb3qu2tSPl3Q4lbPE+6KrJ40WONT0joBmk6zq0wRJgddwm2nstapwDo2VMs/Y Uqog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=pVEgpFbb89uzvDqj2F2KafQpfVwF9UZkdx+Dy5o27Xs=; b=rUR9Pa8LdfC32D4FZlGcg3Gr6XS2P1bbqTkhnHZukJnov2FUZ7VNAgW6FyRW5qBHdB 1VDFEjiW0GKwGgzfgOKNpwz0UB2L0MKCq6yALidjLARlYklh1D6JGL1bRXsu5fT2YF3t 9bwlqUf6+a+DGoaSpOOfrTbdV5X2MGLnhzWLjPgfOt8HOwZdAGg795NYvuU4omv9qtwn gVz/UY7gTos49JlTpGUHsWYCGd1QWp3MQfqBRZSpYYho7OXPKeYPked0pPEKzpXYzCQQ 21wc193j1aBXsLfUxa273SgTyS0Mfm6ShZG5IMAeNOifSEj4dSRGtRRetgHSf3zQFzTd e7eQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=xWxxwEF5; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id fd22-20020a1709072a1600b00889507a0820si4100490ejc.70.2023.02.07.10.44.01; Tue, 07 Feb 2023 10:44:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=xWxxwEF5; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232588AbjBGSb5 (ORCPT + 99 others); Tue, 7 Feb 2023 13:31:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57360 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232517AbjBGSbw (ORCPT ); Tue, 7 Feb 2023 13:31:52 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B80593E619; Tue, 7 Feb 2023 10:31:40 -0800 (PST) Date: Tue, 07 Feb 2023 18:31:38 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1675794699; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=pVEgpFbb89uzvDqj2F2KafQpfVwF9UZkdx+Dy5o27Xs=; b=xWxxwEF56n+vzZ7Hfo98TIKuzn4XgZ/gKHTOEez57a6yNeAcNM/JaIF4U7vBcMOhExqGZD Bl7vF7WsTy2EWTZrSiKnSmBktQXNERtUAh2McEpXIMxoQGqEZB75hK5WGGfscLZxQ9dtMR ntmyAz56wgM2cpLh42dD2JXSY4rFVsA2kaLk8nntnUtZfHii8EiT+JhnlU1QGvuGCHCYgi z6XMuB28f6oKjiD5Z6JzMS+SEH9WkbdMKUvfjvbRmmEwLj0G2lXmcCaKItSqAaqHOhkzf5 tCJHmcpxqqb7JHtEKsmhWzo/G2eSvmdTb9mIfwX5t7rFgWqdE3Q14Q6x44H/qw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1675794699; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=pVEgpFbb89uzvDqj2F2KafQpfVwF9UZkdx+Dy5o27Xs=; b=xQj148jzhHqYfaC15qJwzFxpzA9NVUEfDX08P24c1k0ZJlRuuNh+8JGBNoEjIX7iARzNtd P66QcJNNLYHYr6DA== From: "tip-bot2 for Sebastian Andrzej Siewior" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/vdso] x86/vdso: Fake 32bit VDSO build on 64bit compile for vgetcpu Cc: kernel test robot , Sebastian Andrzej Siewior , "Borislav Petkov (AMD)" , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: References: MIME-Version: 1.0 Message-ID: <167579469870.4906.6486562892768142110.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757198904299643124?= X-GMAIL-MSGID: =?utf-8?q?1757198904299643124?= The following commit has been merged into the x86/vdso branch of tip: Commit-ID: 877cff5296faa6ef312f8002216bbf73bea006c7 Gitweb: https://git.kernel.org/tip/877cff5296faa6ef312f8002216bbf73bea006c7 Author: Sebastian Andrzej Siewior AuthorDate: Tue, 07 Feb 2023 11:46:33 +01:00 Committer: Borislav Petkov (AMD) CommitterDate: Tue, 07 Feb 2023 18:20:41 +01:00 x86/vdso: Fake 32bit VDSO build on 64bit compile for vgetcpu The 64bit register constrains in __arch_hweight64() cannot be fulfilled in a 32-bit build. The function is only declared but not used within vclock_gettime.c and gcc does not care. LLVM complains and aborts. Reportedly because it validates extended asm even if latter would get compiled out, see https://lore.kernel.org/r/Y%2BJ%2BUQ1vAKr6RHuH@dev-arch.thelio-3990X i.e., a long standing design difference between gcc and LLVM. Move the "fake a 32 bit kernel configuration" bits from vclock_gettime.c into a common header file. Use this from vclock_gettime.c and vgetcpu.c. [ bp: Add background info from Nathan. ] Fixes: 92d33063c081a ("x86/vdso: Provide getcpu for x86-32.") Reported-by: kernel test robot Signed-off-by: Sebastian Andrzej Siewior Signed-off-by: Borislav Petkov (AMD) Link: https://lore.kernel.org/r/Y+IsCWQdXEr8d9Vy@linutronix.de --- arch/x86/entry/vdso/vdso32/fake_32bit_build.h | 25 +++++++++++++++++- arch/x86/entry/vdso/vdso32/vclock_gettime.c | 27 +------------------ arch/x86/entry/vdso/vdso32/vgetcpu.c | 1 +- 3 files changed, 27 insertions(+), 26 deletions(-) create mode 100644 arch/x86/entry/vdso/vdso32/fake_32bit_build.h diff --git a/arch/x86/entry/vdso/vdso32/fake_32bit_build.h b/arch/x86/entry/vdso/vdso32/fake_32bit_build.h new file mode 100644 index 0000000..db1b15f --- /dev/null +++ b/arch/x86/entry/vdso/vdso32/fake_32bit_build.h @@ -0,0 +1,25 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifdef CONFIG_X86_64 + +/* + * in case of a 32 bit VDSO for a 64 bit kernel fake a 32 bit kernel + * configuration + */ +#undef CONFIG_64BIT +#undef CONFIG_X86_64 +#undef CONFIG_COMPAT +#undef CONFIG_PGTABLE_LEVELS +#undef CONFIG_ILLEGAL_POINTER_VALUE +#undef CONFIG_SPARSEMEM_VMEMMAP +#undef CONFIG_NR_CPUS +#undef CONFIG_PARAVIRT_XXL + +#define CONFIG_X86_32 1 +#define CONFIG_PGTABLE_LEVELS 2 +#define CONFIG_PAGE_OFFSET 0 +#define CONFIG_ILLEGAL_POINTER_VALUE 0 +#define CONFIG_NR_CPUS 1 + +#define BUILD_VDSO32_64 + +#endif diff --git a/arch/x86/entry/vdso/vdso32/vclock_gettime.c b/arch/x86/entry/vdso/vdso32/vclock_gettime.c index 283ed9d..86981de 100644 --- a/arch/x86/entry/vdso/vdso32/vclock_gettime.c +++ b/arch/x86/entry/vdso/vdso32/vclock_gettime.c @@ -1,29 +1,4 @@ // SPDX-License-Identifier: GPL-2.0 #define BUILD_VDSO32 - -#ifdef CONFIG_X86_64 - -/* - * in case of a 32 bit VDSO for a 64 bit kernel fake a 32 bit kernel - * configuration - */ -#undef CONFIG_64BIT -#undef CONFIG_X86_64 -#undef CONFIG_COMPAT -#undef CONFIG_PGTABLE_LEVELS -#undef CONFIG_ILLEGAL_POINTER_VALUE -#undef CONFIG_SPARSEMEM_VMEMMAP -#undef CONFIG_NR_CPUS -#undef CONFIG_PARAVIRT_XXL - -#define CONFIG_X86_32 1 -#define CONFIG_PGTABLE_LEVELS 2 -#define CONFIG_PAGE_OFFSET 0 -#define CONFIG_ILLEGAL_POINTER_VALUE 0 -#define CONFIG_NR_CPUS 1 - -#define BUILD_VDSO32_64 - -#endif - +#include "fake_32bit_build.h" #include "../vclock_gettime.c" diff --git a/arch/x86/entry/vdso/vdso32/vgetcpu.c b/arch/x86/entry/vdso/vdso32/vgetcpu.c index b777f84..3a9791f 100644 --- a/arch/x86/entry/vdso/vdso32/vgetcpu.c +++ b/arch/x86/entry/vdso/vdso32/vgetcpu.c @@ -1,2 +1,3 @@ // SPDX-License-Identifier: GPL-2.0 +#include "fake_32bit_build.h" #include "../vgetcpu.c"