From patchwork Thu Aug 22 07:13:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 13772812 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3140DC3DA4A for ; Thu, 22 Aug 2024 07:13:33 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B65106B01B1; Thu, 22 Aug 2024 03:13:32 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B14DA80009; Thu, 22 Aug 2024 03:13:32 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9B5AC6B01F3; Thu, 22 Aug 2024 03:13:32 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 812776B01B1 for ; Thu, 22 Aug 2024 03:13:32 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 3D06D16138D for ; Thu, 22 Aug 2024 07:13:32 +0000 (UTC) X-FDA: 82479015864.01.3BE50F9 Received: from pegase2.c-s.fr (pegase2.c-s.fr [93.17.235.10]) by imf01.hostedemail.com (Postfix) with ESMTP id 11AC440010 for ; Thu, 22 Aug 2024 07:13:29 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=none; spf=pass (imf01.hostedemail.com: domain of christophe.leroy@csgroup.eu designates 93.17.235.10 as permitted sender) smtp.mailfrom=christophe.leroy@csgroup.eu; dmarc=pass (policy=quarantine) header.from=csgroup.eu ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1724310769; a=rsa-sha256; cv=none; b=FKg9nNQ3tGf5zkAw5RlIWw4cL8+C1rP6hRsEDE25JSA0VLshboppNG6Tani08rSlXu71ZL lPJ2CZjzl3bShEXSpvbGxfValwycs9oFsb+ZlelVGKAlZd6WaJTAiiZ4FefcgncI0MBDyF NvssKNF0O5hYZO22SjzfQctddKpX7hM= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=none; spf=pass (imf01.hostedemail.com: domain of christophe.leroy@csgroup.eu designates 93.17.235.10 as permitted sender) smtp.mailfrom=christophe.leroy@csgroup.eu; dmarc=pass (policy=quarantine) header.from=csgroup.eu ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1724310769; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sif7IgiJ5FNM15Q3ELj8Pi8FnPDRW+/Wer7b5sNOKo0=; b=moa/lT9zDxor6bNvO34Cv4Yv6njHgg9/Q9pXLgjIyR9zQ35zyztHHM7JWrkqDK+lFjL/uC HELQj1k6T41nCrjmGG+lHp81UTmh4N+b7rlCjCC63c6QCTZ7R0eqBBNv8U4wmZzEW4NZpe vq6Ih1HMNmW669By2Kx16wu5Nw+Sbjo= Received: from localhost (mailhub3.si.c-s.fr [172.26.127.67]) by localhost (Postfix) with ESMTP id 4WqDv764knz9sSL; Thu, 22 Aug 2024 09:13:23 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from pegase2.c-s.fr ([172.26.127.65]) by localhost (pegase2.c-s.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id teSSTAQ_JMUd; Thu, 22 Aug 2024 09:13:23 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase2.c-s.fr (Postfix) with ESMTP id 4WqDv751hwz9sSH; Thu, 22 Aug 2024 09:13:23 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 981318B77E; Thu, 22 Aug 2024 09:13:23 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id deVhGSnWC0EM; Thu, 22 Aug 2024 09:13:23 +0200 (CEST) Received: from PO20335.idsi0.si.c-s.fr (PO16920.IDSI0.si.c-s.fr [192.168.232.181]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 7D1878B77D; Thu, 22 Aug 2024 09:13:22 +0200 (CEST) From: Christophe Leroy To: Michael Ellerman , Nicholas Piggin , Christophe Leroy , Naveen N Rao , Andy Lutomirski , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , "Theodore Ts'o" , "Jason A. Donenfeld" , Arnd Bergmann , Andrew Morton , Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , Vincenzo Frascino , Shuah Khan Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-arch@vger.kernel.org, linux-mm@kvack.org, linux-trace-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: [PATCH v2 01/17] asm-generic/unaligned.h: Extract common header for vDSO Date: Thu, 22 Aug 2024 09:13:09 +0200 Message-ID: X-Mailer: git-send-email 2.44.0 In-Reply-To: References: MIME-Version: 1.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1724310793; l=2154; i=christophe.leroy@csgroup.eu; s=20211009; h=from:subject:message-id; bh=PMuEkb4wUUODc8BHWuAMDd3O1VO5F7l6ew490+ETezs=; b=SCbozmVIQ2N0YmD5LdvWZtFwtXyTP5t5NaLd+wgmzFt0RkjCtkLWbQu2r6nA/RS5ZBAbgtMi5 NOvPh+CSjVFDGZxHHEvNd8+6dh4WhQuiz0RR1GxQc29ssqo1F2FgOFN X-Developer-Key: i=christophe.leroy@csgroup.eu; a=ed25519; pk=HIzTzUj91asvincQGOFx6+ZF5AoUuP9GdOtQChs7Mm0= X-Stat-Signature: 7iot4mek3od18j7oy9i8wbn8cnex1mnb X-Rspamd-Queue-Id: 11AC440010 X-Rspam-User: X-Rspamd-Server: rspam10 X-HE-Tag: 1724310809-240663 X-HE-Meta: U2FsdGVkX19NSHu9ghOkPlWPY6k6QfDE3KHrS1reLefRLt9MTcSf/Zdk8/tstIsD0E/GcbZJHN/TQk5zAuTY//PI3mRYRoMYT6QrNZgxSdr1OdiIJJodieu/lcAQhvSOYEb6xEsX3EnS75eoOBuaV92cfGfigtzlrPf/5BVPXGRx9lGrAlH5LRSV+wGZunbFpVJJcMsbspbHJ8qK5QsLzVYXyK7SeCpPpEzD2oTARcqF/flqwpIr9bsJS4hN0jYGmphR7wlhQeDR6h1S96iitK15zxyOD7y1FMnnAYGYwkyOJgI6yEYN51Ip4d5COKsvBjVmjLqr7onYgVtQL9XoSiDjBA0AkPa2Gbw+H7W4JpAu7NoDNeH2sTLxfVgFGcCqgATK+voFdCPeV/QB1bKGv5SX0GBigPlDUD8ZTuVZFNLPStg8kkLSfwrECuIY3TTzqP3CD5YcPAzEbSxXYHlI0rJ9TkeUsdyY1K1v9HZ+ZySApIr04C0fSUDvWAg1IAHVAqrARJrXJTGzEGDDcKfZyL0v+0YKWdGHO2QJBk9IuGqU2y/r5xC5WsvZh2I/WIPd+7xodY+8ZUVcMIW3/1xZR6N3ND84dN3HPAaenqft+6JxkIJycbyXQ+Q2gATc6Pu/ZeU19jXsPjmLp3JAcvxTNX7KeY913r0nbXAK94Azbgz/VQaPNnEwytsQiKgxu9KE2PKnChyrUQAlZMwNmX7PzDYFyV6t5/exkqiwrspf1CndPsjwppArJcNTMQX1k9ETY9fN/ZLD/bEOachjREFyTgG7OzySOOwAARc+zFKkhkHUvezyykA6/wOJudABHfN3o5YjoXck8paQ4G/SggK7rC3zCVb7a/kvVIMV4Dyex8Xs7l/2IEO2ySvEgi3q9ECOg2Mf8SzC0MJALbzwjO/3hiDAH89T6DwALsK30mC9RYRLCLfsFPR9AUbpIVGYXTQLIM+VGaSbDuGpJEOnRwY UKAgwlyv V174wEOfRdSPoxPLIv/IyUsx6FKURfdpd/emB7Y0K3Yfu4+6RbTJuarDgIeOzTW5wS4BpPQMI9sPTH3SK74P+GMH5HBTtI2lcNvzgKac+287bUAyB7gFABjdIbZbp75MjzZAn X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: getrandom vDSO implementation requires __put_unaligned_t() and __put_unaligned_t() but including asm-generic/unaligned.h pulls too many other headers. Follow the same approach as for most things in include/vdso/, see for instance commit 8165b57bca21 ("linux/const.h: Extract common header for vDSO"): Move __get_unaligned_t and __put_unaligned_t into a new unaligned.h living in the vdso/ include directory. Signed-off-by: Christophe Leroy --- include/asm-generic/unaligned.h | 11 +---------- include/vdso/unaligned.h | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 10 deletions(-) create mode 100644 include/vdso/unaligned.h diff --git a/include/asm-generic/unaligned.h b/include/asm-generic/unaligned.h index a84c64e5f11e..95acdd70b3b2 100644 --- a/include/asm-generic/unaligned.h +++ b/include/asm-generic/unaligned.h @@ -8,16 +8,7 @@ */ #include #include - -#define __get_unaligned_t(type, ptr) ({ \ - const struct { type x; } __packed *__pptr = (typeof(__pptr))(ptr); \ - __pptr->x; \ -}) - -#define __put_unaligned_t(type, val, ptr) do { \ - struct { type x; } __packed *__pptr = (typeof(__pptr))(ptr); \ - __pptr->x = (val); \ -} while (0) +#include #define get_unaligned(ptr) __get_unaligned_t(typeof(*(ptr)), (ptr)) #define put_unaligned(val, ptr) __put_unaligned_t(typeof(*(ptr)), (val), (ptr)) diff --git a/include/vdso/unaligned.h b/include/vdso/unaligned.h new file mode 100644 index 000000000000..eee3d2a4dbe4 --- /dev/null +++ b/include/vdso/unaligned.h @@ -0,0 +1,15 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __VDSO_UNALIGNED_H +#define __VDSO_UNALIGNED_H + +#define __get_unaligned_t(type, ptr) ({ \ + const struct { type x; } __packed *__pptr = (typeof(__pptr))(ptr); \ + __pptr->x; \ +}) + +#define __put_unaligned_t(type, val, ptr) do { \ + struct { type x; } __packed *__pptr = (typeof(__pptr))(ptr); \ + __pptr->x = (val); \ +} while (0) + +#endif /* __VDSO_UNALIGNED_H */ From patchwork Thu Aug 22 07:13:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 13772813 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id D9DB8C5320E for ; Thu, 22 Aug 2024 07:13:37 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 746A76B01F5; Thu, 22 Aug 2024 03:13:37 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6F67C6B01F7; Thu, 22 Aug 2024 03:13:37 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5BDD26B029F; Thu, 22 Aug 2024 03:13:37 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 3DD946B01F5 for ; Thu, 22 Aug 2024 03:13:37 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id DB6AF1213FE for ; Thu, 22 Aug 2024 07:13:36 +0000 (UTC) X-FDA: 82479016032.23.BA9ADA5 Received: from pegase2.c-s.fr (pegase2.c-s.fr [93.17.235.10]) by imf06.hostedemail.com (Postfix) with ESMTP id A90D418001F for ; Thu, 22 Aug 2024 07:13:34 +0000 (UTC) Authentication-Results: imf06.hostedemail.com; dkim=none; spf=pass (imf06.hostedemail.com: domain of christophe.leroy@csgroup.eu designates 93.17.235.10 as permitted sender) smtp.mailfrom=christophe.leroy@csgroup.eu; dmarc=pass (policy=quarantine) header.from=csgroup.eu ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1724310774; a=rsa-sha256; cv=none; b=VhSWvJRcwm+8LxDKV+KXRR7u+YJ/FUrUZH/kadkbtkX5wHV64gTcDqMYp7zzjLPCDyx4Zu 631vR8K539VODMHMnlIiu1RKG+TzqfPyZ9gmoYLXn0kojq225Jb37Omftz26l0PU7iK7Kd g8qic5DGkNEu5ZG+opfNbfftT3jMKKE= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=none; spf=pass (imf06.hostedemail.com: domain of christophe.leroy@csgroup.eu designates 93.17.235.10 as permitted sender) smtp.mailfrom=christophe.leroy@csgroup.eu; dmarc=pass (policy=quarantine) header.from=csgroup.eu ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1724310774; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wIcjOS5mdzYYCt6rXdfHi7QObcg9a7ZKGf4I39Qdb90=; b=eJbPhq6NVloQZ7l9/gM5CBKEnmYdUmUEDhRhz7O3i+ipx4N0Q/dafb1jnPTo+1aKEsvffb CnFkNFUJmnLIMFvax5rZrgn/kUb1xlLdbSivbyaPJhB8JJ4M+JGpvbjvB1iQcY2fQmD441 KJpLzZ++uqy+tjGw2pgQPFigjDurSqE= Received: from localhost (mailhub3.si.c-s.fr [172.26.127.67]) by localhost (Postfix) with ESMTP id 4WqDv86QrKz9sSN; Thu, 22 Aug 2024 09:13:24 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from pegase2.c-s.fr ([172.26.127.65]) by localhost (pegase2.c-s.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id FdCDskQ2p5WL; Thu, 22 Aug 2024 09:13:24 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase2.c-s.fr (Postfix) with ESMTP id 4WqDv85QXJz9sSH; Thu, 22 Aug 2024 09:13:24 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id A7ED78B77E; Thu, 22 Aug 2024 09:13:24 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id ouP_vD4wp4xB; Thu, 22 Aug 2024 09:13:24 +0200 (CEST) Received: from PO20335.idsi0.si.c-s.fr (PO16920.IDSI0.si.c-s.fr [192.168.232.181]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 944968B763; Thu, 22 Aug 2024 09:13:23 +0200 (CEST) From: Christophe Leroy To: Michael Ellerman , Nicholas Piggin , Christophe Leroy , Naveen N Rao , Andy Lutomirski , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , "Theodore Ts'o" , "Jason A. Donenfeld" , Arnd Bergmann , Andrew Morton , Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , Vincenzo Frascino , Shuah Khan Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-arch@vger.kernel.org, linux-mm@kvack.org, linux-trace-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: [PATCH v2 02/17] vdso: Clean header inclusion in getrandom Date: Thu, 22 Aug 2024 09:13:10 +0200 Message-ID: <2a081f1fff5e40f496153f8e0162fc7ec5adab2e.1724309198.git.christophe.leroy@csgroup.eu> X-Mailer: git-send-email 2.44.0 In-Reply-To: References: MIME-Version: 1.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1724310793; l=3539; i=christophe.leroy@csgroup.eu; s=20211009; h=from:subject:message-id; bh=t1ii3oP+DWJaA3RAVE9qv0Jl6VLeHCEWNNWvjxnIH5Q=; b=ANTjekVtAyR0hDVIxrc3nu2T9PxOuN9Ua7Gf4v/suoPDxg/04vzQWBh3+1ksJJaTwPqkpldnx KcQYfaLEwU7BvUlhMxVrCjpvlWYlePU5fPx0kouXgxCqKaovwoxnEp7 X-Developer-Key: i=christophe.leroy@csgroup.eu; a=ed25519; pk=HIzTzUj91asvincQGOFx6+ZF5AoUuP9GdOtQChs7Mm0= X-Stat-Signature: pkwoe98uxzn83mysx541aa66yragpkyj X-Rspamd-Queue-Id: A90D418001F X-Rspam-User: X-Rspamd-Server: rspam10 X-HE-Tag: 1724310814-34375 X-HE-Meta: U2FsdGVkX1+L7rQ7yHL7Mp6bMfZnpNYnpSiEIZDz5kmv4I4qZ6pD9TqbVlGF9kitYEexBLyDHOpGjirmT7+k31FpmjO2KnUbcORUy630OIuU6jYYZSt9RBHnb27LWKLU1Re1P7ZzOWykwPxB5YhGkobXczqkpOJmcIwKoJbF/38bUmOpux+3JGUZFKh6jSpM+Os8uINfQj9jIZkeZcca2TV/FLKLWNpI1GyoChFsOmu1A5SK1pavsAfmOwpYX+tgqnCg63irmCrdRoU2tbhvkRcYWaqrwsw146j7RdaU6gChbqIi0c71FhCRe5O6ajHMLuIQxQ73429Y9PPk5J5VV2/4SFv6TrYIqy+CIOoZX3IWP6yvhZbEx/IbD1J/vUuHcfu73IDe9uD4Gz9bfZNBMrae2om7S0rq8H3998fuVv0Kb4jlg/HOtd3Fv73Jma7TiVgdkbEeT0lPLJA6wR+bIZeqGeZGWojAkQXjTDzKjOvIGrtGNyhr7/j71ljtHPz/tWzDLrVxoAGKHBYjJjA7R9zqPXpT2Q2LEEwKS7tXemye2HRG7W/UwnW5X77k8CbY2VzVeKCszK3HDfVbj8/wWGOoA04BJj2vP4n/NFc2W6up2Z/eP9ZuVfAdgpv630/KXjj9I5Rqlbuvknu5o4F3QKvEjpIbi7miIA2dxciCj4LPLhBSrcUuER0v2iOZJAVAJiI6yrq+jevulVIdfXitCa3RgpcKOLMbyWoWyQnQp9LrUH2B8f+BuYJ27D5kRLQ6mxrshIf9JS3PTB+vt/jVGW7nW6gqS5XCUHT0/1YAsj/5QCMQtWgfjUADPybMrBEoZ0V9zVrc2MQBoPdC01aSTQ0lAGBKAxzLz9CgXX4blp2alMZRl5EKbOPnyugB/fqaHxkCE/Tr3IaqkamqeJz36JX4n3Xq5id7rOywl1aX4raXSjxmiXSPlloopiD1yYTNCE7kTacbDO1CKb/C2xi T7Ld7GE5 9gX+PTqx8c8K8opZWGmroWwKxMvL0ZSXNflYeh8vyNH3nf4Vlx+H2fp4clTL/sszYvev/h1dmhyOFpCgYeqibx0Lyn9zhK6LusFyhd+gzQ0xho4hx6kvMK9Vcw+Z505zks+Zv8F+vw8Ehzh6NoWD9K1S5QfAQbxZRFxZU9H1yolQ7oelqHMmUOSPCp0p7sA+1uEhKxUUAxYFpJw9CJmFKJWG5dA== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Building a VDSO32 on a 64 bits kernel is problematic when some system headers are included. See commit 8c59ab839f52 ("lib/vdso: Enable common headers") for more details. Minimise the amount of headers by moving needed items into dedicated common headers. For PAGE_SIZE and PAGE_MASK, redefine them from CONFIG_PAGE_SHIFT in the same way as commit cffaefd15a8f ("vdso: Use CONFIG_PAGE_SHIFT in vdso/datapage.h") Signed-off-by: Christophe Leroy --- arch/x86/include/asm/pvclock.h | 1 + include/vdso/helpers.h | 1 + lib/vdso/getrandom.c | 15 ++++++++------- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/arch/x86/include/asm/pvclock.h b/arch/x86/include/asm/pvclock.h index 0c92db84469d..6e4f8fae3ce9 100644 --- a/arch/x86/include/asm/pvclock.h +++ b/arch/x86/include/asm/pvclock.h @@ -5,6 +5,7 @@ #include #include +struct timespec64; /* some helper functions for xen and kvm pv clock sources */ u64 pvclock_clocksource_read(struct pvclock_vcpu_time_info *src); u64 pvclock_clocksource_read_nowd(struct pvclock_vcpu_time_info *src); diff --git a/include/vdso/helpers.h b/include/vdso/helpers.h index 73501149439d..3ddb03bb05cb 100644 --- a/include/vdso/helpers.h +++ b/include/vdso/helpers.h @@ -4,6 +4,7 @@ #ifndef __ASSEMBLY__ +#include #include static __always_inline u32 vdso_read_begin(const struct vdso_data *vd) diff --git a/lib/vdso/getrandom.c b/lib/vdso/getrandom.c index b230f0b10832..cab153c5f9be 100644 --- a/lib/vdso/getrandom.c +++ b/lib/vdso/getrandom.c @@ -3,15 +3,13 @@ * Copyright (C) 2022-2024 Jason A. Donenfeld . All Rights Reserved. */ -#include -#include -#include +#include #include #include +#include #include -#include -#include #include +#include #define MEMCPY_AND_ZERO_SRC(type, dst, src, len) do { \ while (len >= sizeof(type)) { \ @@ -23,6 +21,9 @@ } \ } while (0) +#define _PAGE_SIZE (1UL << CONFIG_PAGE_SHIFT) +#define _PAGE_MASK (~(_PAGE_SIZE - 1)) + static void memcpy_and_zero_src(void *dst, void *src, size_t len) { if (IS_ENABLED(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS)) { @@ -64,7 +65,7 @@ static __always_inline ssize_t __cvdso_getrandom_data(const struct vdso_rng_data *rng_info, void *buffer, size_t len, unsigned int flags, void *opaque_state, size_t opaque_len) { - ssize_t ret = min_t(size_t, INT_MAX & PAGE_MASK /* = MAX_RW_COUNT */, len); + ssize_t ret = min_t(size_t, INT_MAX & _PAGE_MASK /* = MAX_RW_COUNT */, len); struct vgetrandom_state *state = opaque_state; size_t batch_len, nblocks, orig_len = len; bool in_use, have_retried = false; @@ -82,7 +83,7 @@ __cvdso_getrandom_data(const struct vdso_rng_data *rng_info, void *buffer, size_ } /* The state must not straddle a page, since pages can be zeroed at any time. */ - if (unlikely(((unsigned long)opaque_state & ~PAGE_MASK) + sizeof(*state) > PAGE_SIZE)) + if (unlikely(((unsigned long)opaque_state & ~_PAGE_MASK) + sizeof(*state) > _PAGE_SIZE)) return -EFAULT; /* If the caller passes the wrong size, which might happen due to CRIU, fallback. */ From patchwork Thu Aug 22 07:13:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 13772814 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 60081C531DF for ; Thu, 22 Aug 2024 07:13:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E72336B00FE; Thu, 22 Aug 2024 03:13:41 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DD55D6B01F9; Thu, 22 Aug 2024 03:13:41 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C27386B01FA; Thu, 22 Aug 2024 03:13:41 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 97FE66B00FE for ; Thu, 22 Aug 2024 03:13:41 -0400 (EDT) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 50F75A1340 for ; Thu, 22 Aug 2024 07:13:41 +0000 (UTC) X-FDA: 82479016242.24.B7BAA03 Received: from pegase2.c-s.fr (pegase2.c-s.fr [93.17.235.10]) by imf03.hostedemail.com (Postfix) with ESMTP id 333A120007 for ; Thu, 22 Aug 2024 07:13:38 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=none; spf=pass (imf03.hostedemail.com: domain of christophe.leroy@csgroup.eu designates 93.17.235.10 as permitted sender) smtp.mailfrom=christophe.leroy@csgroup.eu; dmarc=pass (policy=quarantine) header.from=csgroup.eu ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1724310779; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6SDwL14ZIrZxG7R+BLlX+inC+cmgy6s0nI9uw46bbT0=; b=PYC14P9Iz42EpWU7nfEJiR1z/mt40h5wnnudnu5Zhiu23x5BtfpzlyuG8YUByKWmE1s3o7 oSeEDCGRD+cyFd5cFJAB/eHznxN1TUzwKPcsXfPQkd1WhvweP6EGjehvMZwVvGoNhCllnh k2Ob0epIsnZNOUl0DCGp83+nk9F7Rv4= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=none; spf=pass (imf03.hostedemail.com: domain of christophe.leroy@csgroup.eu designates 93.17.235.10 as permitted sender) smtp.mailfrom=christophe.leroy@csgroup.eu; dmarc=pass (policy=quarantine) header.from=csgroup.eu ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1724310779; a=rsa-sha256; cv=none; b=OYKqbIW/6P3eOOPyJ0V9Vy/+yyl2jl0avIhB5c5cqGM/kMM9MIzDC8Uy9LlL+LodlzteK9 K44kccDc2p7CrMwfcAPYQOP8rcYcmXATguwbIViVdrGW36ILEhBILT/xBtvJAGiN+umxho V9ioYfe5o+C+tGi+eFak9V+AueDiMm8= Received: from localhost (mailhub3.si.c-s.fr [172.26.127.67]) by localhost (Postfix) with ESMTP id 4WqDv96knHz9sSR; Thu, 22 Aug 2024 09:13:25 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from pegase2.c-s.fr ([172.26.127.65]) by localhost (pegase2.c-s.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ZY8vgATUItE0; Thu, 22 Aug 2024 09:13:25 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase2.c-s.fr (Postfix) with ESMTP id 4WqDv95q7Yz9sSH; Thu, 22 Aug 2024 09:13:25 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id B59318B77E; Thu, 22 Aug 2024 09:13:25 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id XTrqY5A4cZMU; Thu, 22 Aug 2024 09:13:25 +0200 (CEST) Received: from PO20335.idsi0.si.c-s.fr (PO16920.IDSI0.si.c-s.fr [192.168.232.181]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 9FE3E8B77D; Thu, 22 Aug 2024 09:13:24 +0200 (CEST) From: Christophe Leroy To: Michael Ellerman , Nicholas Piggin , Christophe Leroy , Naveen N Rao , Andy Lutomirski , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , "Theodore Ts'o" , "Jason A. Donenfeld" , Arnd Bergmann , Andrew Morton , Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , Vincenzo Frascino , Shuah Khan Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-arch@vger.kernel.org, linux-mm@kvack.org, linux-trace-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: [PATCH v2 03/17] vdso: Add __arch_get_k_vdso_rng_data() Date: Thu, 22 Aug 2024 09:13:11 +0200 Message-ID: <30560b394eaa00fded11fa5bbe5f679c7ffe1714.1724309198.git.christophe.leroy@csgroup.eu> X-Mailer: git-send-email 2.44.0 In-Reply-To: References: MIME-Version: 1.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1724310793; l=3615; i=christophe.leroy@csgroup.eu; s=20211009; h=from:subject:message-id; bh=0FkV6ZQv7UmPicI0ISFP55470ytlmKI8lU8exIbKjSc=; b=rfgTJTLJ/AVYzFQ0JlvoCOtXx4fadthoJUp407DtCeMplj9i+sD7+IM9C0ey883rkE5yU2iFJ tg03vMqD5JmCRbRJZ3og1OVFm2FAdigfeIv6Ehg0Ok2plru3FzYH+sf X-Developer-Key: i=christophe.leroy@csgroup.eu; a=ed25519; pk=HIzTzUj91asvincQGOFx6+ZF5AoUuP9GdOtQChs7Mm0= X-Rspamd-Server: rspam03 X-Rspam-User: X-Rspamd-Queue-Id: 333A120007 X-Stat-Signature: 358aja35ec9mfs635o99iz7dnhihwhd1 X-HE-Tag: 1724310818-257192 X-HE-Meta: U2FsdGVkX1/h2pk01+POdtevckjCIddGbwdIhZ0rs61XX/bWCrvcqH0qlXvxqIJCLhvJSIi5ZmwHPIIhYrXnrgRFX3xGf376HLgJT4qB+BZ0bkGDvR26sQwyUZqGBF8rWDjopZ5y/Q27rZkJ05pdfXjASwh2zizBHY6+VWqVtK6nENQJeQDdjZk1vFu2f2UbDFeEoXvqV2OWPCws9LIR1hlhPHNuwpGyujGlzbeINfkRI3GSrB6mxpCquGrhdFgm9Fwezqdkx3PT6EWmhmAYYPRFqZItkv/HFHIKk4tIM6/I7UO4bPeEPjfNomXEUVHeFazFelf/x6YKLLoJxnWB5Qj0OXCbw1TzPlLMJfHewirntZ4pEw161wajGEO+j1wjguIIIsLk23N7gA+0ttB6cNKX0D04TnnsDX3pVBdMnpXIlwh4FO7isbSLJd50ewnBq/fzLaWb4L39GZ3U3b8ME8M/pAAL3WC37TevD2Pp8qIm3c7wJG6Xwnv0Huj0RccQaysuSAi4ScUgXVi0jcIIrERWI3PuFoPKUeQYEYKCGHRkwwrsYrj5AujdxIaeGKfgnP0h+DYXL7w66wov0GulhgsQw2tKZ2ismDPcnONSEqjqrGaq4RE8TXkk9FRWj7QFpvuQ/N14XWkdqClFNEgXNmNhjdywEeSrsgRjmK5MBGQvmqbhcOd6XXo2dAca29zg0LG5hpl7ObuTtTzuW4wbBTj/C07gDOXXawz3IP98NfQxM5OM1bXtDk7oPlpa2kbC/mSPp516/Y7hqoBsyhIkSsp1ByzAkCIBfdnkGN9R7HESQYcAFUJ2/6XC325/J+YDnOblukQ9HkC+h0UTwrBu6sh0CHlTXqqMJbMWiCeS801VjsRMgZ0v5fO8cQubDq+Xii0rKH7fugEZafYjL9JS2YC123mSrTIze71Vat/GM0XGgEDF3DdsQXaI63Y0/FC92kscgzos3vKNirLfjfS Yff0cQaT hlfXbA8J5pu3BgILDgZQ0UsUleymVYJcXxmOvr70EF+rYLBNxR3qIOqMj/dWASPUgF4qxdIOfH/7dWTY3YRKoeyjPBlJttxcNQU3E3GaVO7MOQZND3weg/zBKWhglMNZFjOdR7pRh4SK/LoyhOiDjPzXXAJFSCNfyRHBaR2Chy8LSbWE= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: _vdso_data is specific to x86 and __arch_get_k_vdso_data() is provided so that all architectures can provide the requested pointer. Do the same with _vdso_rng_data, provide __arch_get_k_vdso_rng_data() and don't use x86 _vdso_rng_data directly. Until now vdso/vsyscall.h was only included by time/vsyscall.c but now it will also be included in char/random.c, leading to a duplicate declaration of _vdso_data and _vdso_rng_data. To fix this issue, move declaration in a C file. vma.c looks like the most appropriate candidate. Don't need to replace the definitions in vsyscall.h by declarations as declarations are already in asm/vvar.h Signed-off-by: Christophe Leroy --- v2: Move x86 DEFINE_VVAR(_vdso_data) and DEFINE_VVAR(_vdso_rng_data) in vma.c --- arch/x86/entry/vdso/vma.c | 3 +++ arch/x86/include/asm/vdso/vsyscall.h | 10 +++++++--- drivers/char/random.c | 5 +++-- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/arch/x86/entry/vdso/vma.c b/arch/x86/entry/vdso/vma.c index 6d83ceb7f1ba..b8fed8b8b9cc 100644 --- a/arch/x86/entry/vdso/vma.c +++ b/arch/x86/entry/vdso/vma.c @@ -38,6 +38,9 @@ struct vdso_data *arch_get_vdso_data(void *vvar_page) } #undef EMIT_VVAR +DEFINE_VVAR(struct vdso_data, _vdso_data); +DEFINE_VVAR_SINGLE(struct vdso_rng_data, _vdso_rng_data); + unsigned int vclocks_used __read_mostly; #if defined(CONFIG_X86_64) diff --git a/arch/x86/include/asm/vdso/vsyscall.h b/arch/x86/include/asm/vdso/vsyscall.h index 972415a8be31..67fedf1698b5 100644 --- a/arch/x86/include/asm/vdso/vsyscall.h +++ b/arch/x86/include/asm/vdso/vsyscall.h @@ -9,9 +9,6 @@ #include #include -DEFINE_VVAR(struct vdso_data, _vdso_data); -DEFINE_VVAR_SINGLE(struct vdso_rng_data, _vdso_rng_data); - /* * Update the vDSO data page to keep in sync with kernel timekeeping. */ @@ -22,6 +19,13 @@ struct vdso_data *__x86_get_k_vdso_data(void) } #define __arch_get_k_vdso_data __x86_get_k_vdso_data +static __always_inline +struct vdso_rng_data *__x86_get_k_vdso_rng_data(void) +{ + return &_vdso_rng_data; +} +#define __arch_get_k_vdso_rng_data __x86_get_k_vdso_rng_data + /* The asm-generic header needs to be included after the definitions above */ #include diff --git a/drivers/char/random.c b/drivers/char/random.c index 87fe61295ea1..77968309e2c2 100644 --- a/drivers/char/random.c +++ b/drivers/char/random.c @@ -59,6 +59,7 @@ #ifdef CONFIG_VDSO_GETRANDOM #include #include +#include #endif #include #include @@ -282,7 +283,7 @@ static void crng_reseed(struct work_struct *work) * is ordered with the write above to base_crng.generation. Pairs with * the smp_rmb() before the syscall in the vDSO code. */ - smp_store_release(&_vdso_rng_data.generation, next_gen + 1); + smp_store_release(&__arch_get_k_vdso_rng_data()->generation, next_gen + 1); #endif if (!static_branch_likely(&crng_is_ready)) crng_init = CRNG_READY; @@ -735,7 +736,7 @@ static void __cold _credit_init_bits(size_t bits) queue_work(system_unbound_wq, &set_ready); atomic_notifier_call_chain(&random_ready_notifier, 0, NULL); #ifdef CONFIG_VDSO_GETRANDOM - WRITE_ONCE(_vdso_rng_data.is_ready, true); + WRITE_ONCE(__arch_get_k_vdso_rng_data()->is_ready, true); #endif wake_up_interruptible(&crng_init_wait); kill_fasync(&fasync, SIGIO, POLL_IN); From patchwork Thu Aug 22 07:13:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 13772815 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id B24B1C5320E for ; Thu, 22 Aug 2024 07:13:46 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3C4F06B0200; Thu, 22 Aug 2024 03:13:46 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2DC056B02A0; Thu, 22 Aug 2024 03:13:46 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0B7146B02A1; Thu, 22 Aug 2024 03:13:46 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id DAD296B0200 for ; Thu, 22 Aug 2024 03:13:45 -0400 (EDT) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 841AA413C8 for ; Thu, 22 Aug 2024 07:13:45 +0000 (UTC) X-FDA: 82479016410.10.354159A Received: from pegase2.c-s.fr (pegase2.c-s.fr [93.17.235.10]) by imf22.hostedemail.com (Postfix) with ESMTP id 7ED34C0014 for ; Thu, 22 Aug 2024 07:13:43 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=none; spf=pass (imf22.hostedemail.com: domain of christophe.leroy@csgroup.eu designates 93.17.235.10 as permitted sender) smtp.mailfrom=christophe.leroy@csgroup.eu; dmarc=pass (policy=quarantine) header.from=csgroup.eu ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1724310743; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=BXI2w538Qd1aThuSRJTZpr+CLSlO8H192+GbJKxMuxM=; b=INo3Yv34To82bnepd8vdxn2e4R83peyOCMZa8U+2JjI6wxC3G2A1RE7nbVArNRTZlqUvmh TVwy6/JeJid9a1/qJy4X5HiE4rhkn0UFXZLbP43BeHhLFzlr7CBBqdEWZ0FcBz7kS420xS Cp7NfmOmLWIBD2dC3CLa4S3QquDw400= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1724310743; a=rsa-sha256; cv=none; b=NF+l+2iHLOFs9Gph8KYkvExV0aO047WTHt5AMv1h2ZPWFyuDHsTHqh5+dTDrK9c1TrztHX D5Z+JVHsqCf0aJ2ybCX8RpUKlLcOt/sUM9DTr4hP6zwaDo5NYIaEmBDYvIkB4MlFSkY0cT aNcXLfMydMfYwEh3IAkGiHi98okQy2g= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=none; spf=pass (imf22.hostedemail.com: domain of christophe.leroy@csgroup.eu designates 93.17.235.10 as permitted sender) smtp.mailfrom=christophe.leroy@csgroup.eu; dmarc=pass (policy=quarantine) header.from=csgroup.eu Received: from localhost (mailhub3.si.c-s.fr [172.26.127.67]) by localhost (Postfix) with ESMTP id 4WqDvB6wCcz9sSS; Thu, 22 Aug 2024 09:13:26 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from pegase2.c-s.fr ([172.26.127.65]) by localhost (pegase2.c-s.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id j_PpJleCxFhw; Thu, 22 Aug 2024 09:13:26 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase2.c-s.fr (Postfix) with ESMTP id 4WqDvB63W6z9sSH; Thu, 22 Aug 2024 09:13:26 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id BD35D8B77D; Thu, 22 Aug 2024 09:13:26 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id YjBIjwOuIeHr; Thu, 22 Aug 2024 09:13:26 +0200 (CEST) Received: from PO20335.idsi0.si.c-s.fr (PO16920.IDSI0.si.c-s.fr [192.168.232.181]) by messagerie.si.c-s.fr (Postfix) with ESMTP id B20CE8B763; Thu, 22 Aug 2024 09:13:25 +0200 (CEST) From: Christophe Leroy To: Michael Ellerman , Nicholas Piggin , Christophe Leroy , Naveen N Rao , Andy Lutomirski , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , "Theodore Ts'o" , "Jason A. Donenfeld" , Arnd Bergmann , Andrew Morton , Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , Vincenzo Frascino , Shuah Khan Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-arch@vger.kernel.org, linux-mm@kvack.org, linux-trace-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: [PATCH v2 04/17] vdso: Add missing c-getrandom-y in Makefile Date: Thu, 22 Aug 2024 09:13:12 +0200 Message-ID: <4ba87b8daeb2f3c0f98e62e16bf60c7e97fb53d5.1724309198.git.christophe.leroy@csgroup.eu> X-Mailer: git-send-email 2.44.0 In-Reply-To: References: MIME-Version: 1.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1724310793; l=917; i=christophe.leroy@csgroup.eu; s=20211009; h=from:subject:message-id; bh=+zsbiRN1Rsvt2mjgra0iuNna45++1Wbks1WsFgQokwI=; b=2AfI70PEj4f7IlK/0JPNIuIysPxZX41Nyq8vstRlw5T4vE5uGLfODApjwg2SJ4Pz/gF8h97/4 zakI/eTMUjpBA1Xm+QvdyQWVNPrgotgD0KB4hiOOMH8kcDGdiZXSdcS X-Developer-Key: i=christophe.leroy@csgroup.eu; a=ed25519; pk=HIzTzUj91asvincQGOFx6+ZF5AoUuP9GdOtQChs7Mm0= X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 7ED34C0014 X-Stat-Signature: j1pm4w61h4g94wjqt6t4u8cycwzmdete X-HE-Tag: 1724310823-36120 X-HE-Meta: U2FsdGVkX1/NU7y1zdArewNHLpQTymZJuVJ80TTaHenZ6RlrdHjKg0azL8JYA1ZYtd9VvtreXO+B5dzcNqbft0heEA47/vHnvEqEHNUKQ1x6RqygSY2rQTFkj3m8gnNdtfkxyYl+Q/KThSw05yt7oBfDrFn9qG5TPQ+v3khx/Sa9YwaOB+Npob13O9RtxiJOBO+MAGl2WPaLMOUjYK6F6BmX6HaAmx1OmYrm2Mhv24zO/cvTyUQykm1T/dPBzrMudNvWPqANgiSCzQL/EqRQJ4jNA4gtDKASx+jVcpue5WK0SlCPajhV1EDNDS4aiiPjQh/6uV/H9uUABZu5ck5qe+9rMSTu/osGLV72D3AkMGYQWp404uRRdTMoyKuHwlCGw8WbDrWK11hmqmAdKjTnIWZ1jYfZrhFY8/dy++9HpqG1FKa001owAgJLkej0AC0p2K/ne86kP2xgLQVC1oq/B74gxBicrt2jrmOfvVAN8HahbpVxNpVXJ1/UJyiNlf9DlLUcJZSh4+WRJQk5i4MQAe25LOpowwJLeX1KX0cg+xdLUhAE+qpJed9jH+WPrrcCzVU3NXhCe3Se+1zrrRmLVUI1qAurtXroPYRvjMSpjM67G6qYkN0X784T0k09/SeZEiGliAYganIOo7m97VVPOEPvmi/pXBYgTkjtbKzhC1CPxqNUlm8BGPG6saP9n84Wg15X8xhFg5tqSFcITbwWtkmrYRsKL2Xh2emlIPS5IrcmddBptbraD1fQfW5Df1B9HUmMy/ROalxystMKHeI0UGtO7xtJ3IQYl5mPBZANA/12a2sITugmXjMrFveifWKK/LJuIFXKHhDx104RVBw4L4TE3VX+f2ysUn3UnzHh1Fl4FuCHs7jt/qchiIFGYZYGaMk0N2/ptI7tGUy5CXlSm6ZQxwHDZeuOZXX+Flt3A6CStJ4tCbWDuKC5d+jBa3mwmZ2u1xhya9i3aj+tV1G G4RrIGLp mfSjMh8oZayH7Ar8PMFCGIzFupzD1PTwr7EVxe0gRMOKV6VHbXO4PVsvKBBazLuFqTvXI1I2eA+g3uoVVaGq3AmbwkZrE5Qs856dT3lTZ7WZXpGNC+cJQ8IY9L/qvBg6NLzTn+q7ZCnaGUEcUHlHzm8MaGg== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Same as for gettimeofday CVDSO implementation, add c-getrandom-y to ease the inclusion of lib/vdso/getrandom.c in architectures VDSO builds. Signed-off-by: Christophe Leroy --- lib/vdso/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/vdso/Makefile b/lib/vdso/Makefile index 9f031eafc465..cedbf15f8087 100644 --- a/lib/vdso/Makefile +++ b/lib/vdso/Makefile @@ -4,6 +4,7 @@ GENERIC_VDSO_MK_PATH := $(abspath $(lastword $(MAKEFILE_LIST))) GENERIC_VDSO_DIR := $(dir $(GENERIC_VDSO_MK_PATH)) c-gettimeofday-$(CONFIG_GENERIC_GETTIMEOFDAY) := $(addprefix $(GENERIC_VDSO_DIR), gettimeofday.c) +c-getrandom-$(CONFIG_VDSO_GETRANDOM) := $(addprefix $(GENERIC_VDSO_DIR), getrandom.c) # This cmd checks that the vdso library does not contain dynamic relocations. # It has to be called after the linking of the vdso library and requires it From patchwork Thu Aug 22 07:13:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 13772816 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0683FC5320E for ; Thu, 22 Aug 2024 07:13:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8A6656B02A3; Thu, 22 Aug 2024 03:13:50 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 82F236B02A5; Thu, 22 Aug 2024 03:13:50 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6A9DA6B02A6; Thu, 22 Aug 2024 03:13:50 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 464036B02A3 for ; Thu, 22 Aug 2024 03:13:50 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id D90C1140486 for ; Thu, 22 Aug 2024 07:13:49 +0000 (UTC) X-FDA: 82479016578.21.3ADD083 Received: from pegase2.c-s.fr (pegase2.c-s.fr [93.17.235.10]) by imf13.hostedemail.com (Postfix) with ESMTP id AC8D72001F for ; Thu, 22 Aug 2024 07:13:47 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=none; spf=pass (imf13.hostedemail.com: domain of christophe.leroy@csgroup.eu designates 93.17.235.10 as permitted sender) smtp.mailfrom=christophe.leroy@csgroup.eu; dmarc=pass (policy=quarantine) header.from=csgroup.eu ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1724310811; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zLsbp86mxniEb3E+YlEDfPU3PdYohETKqxCyxm1NoGA=; b=QaDOFH5T8whMyRZ/09UUmvpa3fdIWeZCTZF9d2F+tb1bi/OEzpAEf5+37Zzpx7uWEgedwi r7vYnNCJLOpTiIVFGBWGDdo5vWumZog1RvC8LHWMKYPC2EaKUQqKj6/8NchB5qaf2SDf6X 5YGxQTFxnFsM0vTTZQDvVpeOmlLjtaY= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=none; spf=pass (imf13.hostedemail.com: domain of christophe.leroy@csgroup.eu designates 93.17.235.10 as permitted sender) smtp.mailfrom=christophe.leroy@csgroup.eu; dmarc=pass (policy=quarantine) header.from=csgroup.eu ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1724310811; a=rsa-sha256; cv=none; b=soTfkBwTE7ZWQ0ikaad7GWlSlm3cdne81aPsGLKScV7858kMn/gSxbiDBkTEQRQELsXN2R BLwbdxLvo523cMiwU3uZ/cgmarL0s+1k81KiNwRqBDRx+OrfFmGVFWAqnIqkBSinZJVK3L GIWsoLqq1boaTXoygEAUGPemMbchByY= Received: from localhost (mailhub3.si.c-s.fr [172.26.127.67]) by localhost (Postfix) with ESMTP id 4WqDvD04KVz9sST; Thu, 22 Aug 2024 09:13:28 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from pegase2.c-s.fr ([172.26.127.65]) by localhost (pegase2.c-s.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id U1MT9tMdHKEz; Thu, 22 Aug 2024 09:13:27 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase2.c-s.fr (Postfix) with ESMTP id 4WqDvC6NsKz9sSH; Thu, 22 Aug 2024 09:13:27 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id C8F7C8B763; Thu, 22 Aug 2024 09:13:27 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id Bo_6-yJM0v5v; Thu, 22 Aug 2024 09:13:27 +0200 (CEST) Received: from PO20335.idsi0.si.c-s.fr (PO16920.IDSI0.si.c-s.fr [192.168.232.181]) by messagerie.si.c-s.fr (Postfix) with ESMTP id C10D08B77E; Thu, 22 Aug 2024 09:13:26 +0200 (CEST) From: Christophe Leroy To: Michael Ellerman , Nicholas Piggin , Christophe Leroy , Naveen N Rao , Andy Lutomirski , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , "Theodore Ts'o" , "Jason A. Donenfeld" , Arnd Bergmann , Andrew Morton , Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , Vincenzo Frascino , Shuah Khan Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-arch@vger.kernel.org, linux-mm@kvack.org, linux-trace-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: [PATCH v2 05/17] vdso: Avoid call to memset() by getrandom Date: Thu, 22 Aug 2024 09:13:13 +0200 Message-ID: <5deb67090b214f0e6eae96b7c406546d1a16f89b.1724309198.git.christophe.leroy@csgroup.eu> X-Mailer: git-send-email 2.44.0 In-Reply-To: References: MIME-Version: 1.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1724310794; l=1449; i=christophe.leroy@csgroup.eu; s=20211009; h=from:subject:message-id; bh=Tu05MKphwEOYciYKJrZW1zS/5ujWTK6L6L6gDjvRdHs=; b=u0fyVWP390/v2lcPCFKdHXUzbaZAGOJ9fxQFiyRBtDUCKlOBBFypazkoFT3x/4k36OQuZN9O+ 8qHLZBslISeCEi/TEk76Xkmo8/onzIZnJ6KuWgXgE5X334zHCd965Tw X-Developer-Key: i=christophe.leroy@csgroup.eu; a=ed25519; pk=HIzTzUj91asvincQGOFx6+ZF5AoUuP9GdOtQChs7Mm0= X-Rspam-User: X-Stat-Signature: 9kihy5d3qjo6whq6ckx1khhih17uhc5e X-Rspamd-Queue-Id: AC8D72001F X-Rspamd-Server: rspam11 X-HE-Tag: 1724310827-175038 X-HE-Meta: U2FsdGVkX1+qCNYjNNGu+TAW/01m9PTtej5pG0E4xMrO/n5whdkq9v9bLPJK9i8AB6BTnv/DxMC6Zp3ObePoTc8S3oOdp0NFQ43yAREEDcO02xjq6QwBDErL0UIcunR2GDFlNZROUfO2HkTQnNyJkaSGxz0p+B6yMJtAEDhiPy1kJHT5d5ozSMOnxyCTiqIlq/p4rzkAoiTW56eN1a1SSzuKU7lUCeSD4bx6F0JCPgseqGCh7fl9irbdBFRR4XiSs4mh6gJcq/DxkJ4S2EcDGhaum9Xu6RQz8fP1pxmF9OwNlTyXeuyDFsV3SLXyzQGSGvxBaWwIIkw6V23bLd1KPTT+9U6ufs+XZ28gkyjePxxDC5FD+zhTiBHU3ezqAtNdkDegGiaf9QiE4AcF0DvUAcJMoZZy1dx1z1vagHsFUovVoRgQYsjolVtkpkY2u+KSY4gDls6DLr4qrRgMMwwBpvko18WLAX9Xl0f9edBE8tB3Dn2BgaMyWypt5M55Ut6IWM2HPYMG9FpQTo1BJJySY6tLaXAPXGt++OTPyXeVP8bULENLZCRjP0R6CTOdpwUokWLqQWqkoBrzFc+CGZ93fwkT33Cr/pm1vxcCZ2qNmF3CCCnZpR4NIfstmCWtCqXrzX8jEz2jd0deMV2BlMvfqh1L5Gp/Z1FT7GsvB4ec6UiEL4hlCy7GuDp1uk4GBaFS4v2i1dCoXBmKgu8PdduHLuQhnyvJBMaKcZD1JeDgDwflVClQttXwNOjdxjg1GxBlaE6VTGj5FLQ4bd6bTGypmvgozHZJPyEaC1076I4z3hmLP/dMBSg1HthSgDwjKxwKEDzs1tHrPOoh/dpvSwEumZk7WHsnn1EBbWoZdx78EyBJgeaqdK/OvlSfoq6YWDZ2lEmqkCUFm9/P9m+3K/B9juj2PjxQtCFf+0q2HRwVUl8qX5XNHT6GmZeJncEap92iu3OI9kBVm5F05uwuFco Sj2n096r CGjDdUTI30oK++lOnsPF5PNuolWeRd1pmKwLosfF4uIjDxO73gpJtvpJPKCTJ7kT6iTcfwW1yVflEJniFCk6YgQ3fwNlRf2CV7AvPcAJuJaXFhWWDyaS2QkU7SOHdzR0p4Tvo X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: With the current implementation, __cvdso_getrandom_data() calls memset(), which is unexpected in the VDSO. Rewrite opaque data initialisation to avoid memset(). Signed-off-by: Christophe Leroy Acked-by: Ard Biesheuvel --- lib/vdso/getrandom.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/lib/vdso/getrandom.c b/lib/vdso/getrandom.c index cab153c5f9be..4a56f45141b4 100644 --- a/lib/vdso/getrandom.c +++ b/lib/vdso/getrandom.c @@ -4,6 +4,7 @@ */ #include +#include #include #include #include @@ -74,11 +75,15 @@ __cvdso_getrandom_data(const struct vdso_rng_data *rng_info, void *buffer, size_ u32 counter[2] = { 0 }; if (unlikely(opaque_len == ~0UL && !buffer && !len && !flags)) { - *(struct vgetrandom_opaque_params *)opaque_state = (struct vgetrandom_opaque_params) { - .size_of_opaque_state = sizeof(*state), - .mmap_prot = PROT_READ | PROT_WRITE, - .mmap_flags = MAP_DROPPABLE | MAP_ANONYMOUS - }; + struct vgetrandom_opaque_params *params = opaque_state; + int i; + + params->size_of_opaque_state = sizeof(*state); + params->mmap_prot = PROT_READ | PROT_WRITE; + params->mmap_flags = MAP_DROPPABLE | MAP_ANONYMOUS; + for (i = 0; i < ARRAY_SIZE(params->reserved); i++) + params->reserved[i] = 0; + return 0; } From patchwork Thu Aug 22 07:13:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 13772817 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 11021C531DF for ; Thu, 22 Aug 2024 07:13:55 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 969E06B02A6; Thu, 22 Aug 2024 03:13:54 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 91A166B02A7; Thu, 22 Aug 2024 03:13:54 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7935A6B02A8; Thu, 22 Aug 2024 03:13:54 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 553B46B02A6 for ; Thu, 22 Aug 2024 03:13:54 -0400 (EDT) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 02E8512144D for ; Thu, 22 Aug 2024 07:13:54 +0000 (UTC) X-FDA: 82479016788.24.D5E0298 Received: from pegase2.c-s.fr (pegase2.c-s.fr [93.17.235.10]) by imf27.hostedemail.com (Postfix) with ESMTP id DB3C240002 for ; Thu, 22 Aug 2024 07:13:51 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=csgroup.eu; spf=pass (imf27.hostedemail.com: domain of christophe.leroy@csgroup.eu designates 93.17.235.10 as permitted sender) smtp.mailfrom=christophe.leroy@csgroup.eu ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1724310752; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gin0KM29g+LOb2tgM21IdolWj9FiJmh08DvLxNUq9yQ=; b=Gl+4X8gsmsD3FpNG/ZiEFR72oqETBe4ptrN2vD+slctxV2XJKMLoh6sr+M7CK0o1EtnrPA 8Mnmn4B+L9iz9Yx/ZDoZ/KtcisMHWtq62rgNwN+Jl104UOGMAMZ5uybgE4EHElPwyElHzB Y8Wrxu2vwAxHNilgu7UAPEJYFslWqPs= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1724310752; a=rsa-sha256; cv=none; b=MAbmRZUsO84ZI+2r2rCXyM2r8BMznq1X91i8H9Odfs885OjIvbfj4w8YIAb/ovM3y7D85y ZJw5eKFJ5fL6CI/aI13P89a5zZRyANcjRW9H2vZOXJROq4TMzFHBunY02G6VD0cZpJw0I+ nquFAKYzLmnV5cC7KjztA8xBKco23Kg= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=csgroup.eu; spf=pass (imf27.hostedemail.com: domain of christophe.leroy@csgroup.eu designates 93.17.235.10 as permitted sender) smtp.mailfrom=christophe.leroy@csgroup.eu Received: from localhost (mailhub3.si.c-s.fr [172.26.127.67]) by localhost (Postfix) with ESMTP id 4WqDvF1Dg6z9sSW; Thu, 22 Aug 2024 09:13:29 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from pegase2.c-s.fr ([172.26.127.65]) by localhost (pegase2.c-s.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id RkC5cLxZ4aFG; Thu, 22 Aug 2024 09:13:29 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase2.c-s.fr (Postfix) with ESMTP id 4WqDvD6yC3z9sSH; Thu, 22 Aug 2024 09:13:28 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id D585A8B763; Thu, 22 Aug 2024 09:13:28 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id 6SSl1lnhD-ee; Thu, 22 Aug 2024 09:13:28 +0200 (CEST) Received: from PO20335.idsi0.si.c-s.fr (PO16920.IDSI0.si.c-s.fr [192.168.232.181]) by messagerie.si.c-s.fr (Postfix) with ESMTP id CBB698B77D; Thu, 22 Aug 2024 09:13:27 +0200 (CEST) From: Christophe Leroy To: Michael Ellerman , Nicholas Piggin , Christophe Leroy , Naveen N Rao , Andy Lutomirski , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , "Theodore Ts'o" , "Jason A. Donenfeld" , Arnd Bergmann , Andrew Morton , Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , Vincenzo Frascino , Shuah Khan Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-arch@vger.kernel.org, linux-mm@kvack.org, linux-trace-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: [PATCH v2 06/17] vdso: Change getrandom's generation to unsigned long Date: Thu, 22 Aug 2024 09:13:14 +0200 Message-ID: <525b48eb79978ddba2d1b8ee23b27bd6c5b0b4ee.1724309198.git.christophe.leroy@csgroup.eu> X-Mailer: git-send-email 2.44.0 In-Reply-To: References: MIME-Version: 1.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1724310794; l=1276; i=christophe.leroy@csgroup.eu; s=20211009; h=from:subject:message-id; bh=DHKz0nvjKBEZw1qFdyeiMuLRmQ0ExqxUlDOlPsu+3EA=; b=6rTkR9UfUapFGijZerpzLYHhj4PimSMK+GNZzXry6VAozVYosYDA1h8oocTbDByNjWJQ8Sh+H SV2G/Pz6kbDAVsKqsh13uCcc2q8jEtNaLgRwvLicmTZ4KYZyiB5QJXR X-Developer-Key: i=christophe.leroy@csgroup.eu; a=ed25519; pk=HIzTzUj91asvincQGOFx6+ZF5AoUuP9GdOtQChs7Mm0= X-Rspamd-Queue-Id: DB3C240002 X-Stat-Signature: 6c4x36dr4f44tttmd8e798xu99jjreqn X-Rspamd-Server: rspam09 X-Rspam-User: X-HE-Tag: 1724310831-725524 X-HE-Meta: U2FsdGVkX1+te/RYE+MtWmm8cAwdxfE+J+E+LNZVn/rXqWKSakbdSH6PFmlXEQ7yuG2RdPEJoDKWfwyOerHNVR+Ck0E1ci4JoiQUaHgcffTD0HVqiyrMVgUchCoHScD6IM/SAkB2ueD8/x4fl6JA9Ohsxcj1TelnIQS9i0So2tSNUn5ZAyrovbPvjuUCI6G6w04ROZ4tY1mBc1/hVNR21PYMtgeA9LhN0TtKb51IUJ+YtD/KoowZa/915cJpBKTIiSqzJEaWH2GhyS5DOKfQ1mNm4ugd1L/+PzBkRsZcuweOOGMIsg4Q79dIOIFz8WTujdzk+A203h4ztjlIY7hlah2i+92HGptTVmjb9koEVD2tJo93qaEYSe+lrG7FA0MrDYK7piqe+lrRzZ6zJEbU04EOfz3CW4pHnWEJPAYWcuubsvmds6PX0vyn4icuitg+rtTyqz7b8fyWAVsbHj5qxqXCEj3PoVNybuZl6Nex01ft887E/wd7G3bccp2qtyHsAwXwHNECoepl96Ls5v9cx1Xhsk1blyMQL9MXFoNdxe9iNmiu2W06H3LWjF+aQuU3bIGQEyoHq93jNOWrZJemwLokHuBZwnNEAmjniGmhM3RfQMAAt04guyPnDTwi5/Do9Ib4XbaTOyKdWEhEN7lF1VzqLrUs6pZnR2pw0xOiSjNdFmfctxAHXbKOin7MMBMX6teX2Ual1B7BUZr9bZsYvr2d6dfe9g0xMOW+rSg6BNc9+h0KdEZp011QixB3yN5eoQ2r0YU4+8jOUlqJlZgTWp9gkLpOTUbFLMHGFjo2pVWhpee3meCTr41EOC8dvkcpKs+LDXtpmFchvb2RPppP5r1yyBSXj72qnk31CIho2yAm6MnPVjB7p86ISFxCEFtzCVqQftufVu1PmQrVa8aWAqcgGOdFTIn1oFX2dIYOwUIkCRNHG9NAyblqeEPg8EbFQLv32RkPaky1dAyZHGy Ue8ku1KT 7Lz6kdA2VXG2e/l3qumVUtowvKxjCNC1+3JFKN3RStIdFNUvt+ZLZp1a5bHt5uarj6MLqjJsjOqtMTCIfEh2NDWNx52wJzvtBic4XZP1jzWJKcU6duCVMvU6bI/I6aIkZd+Gv X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Performing SMP atomic operations on u64 fails on powerpc32. Random driver generation is handled as unsigned long not u64, see for instance base_cnrg or struct crng. Use the same type for vDSO's getrandom as it gets copied from the above. This is also in line with the local current_generation which is already an unsigned long. Signed-off-by: Christophe Leroy --- include/vdso/datapage.h | 2 +- include/vdso/getrandom.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/vdso/datapage.h b/include/vdso/datapage.h index b85f24cac3f5..00b66a9b5778 100644 --- a/include/vdso/datapage.h +++ b/include/vdso/datapage.h @@ -123,7 +123,7 @@ struct vdso_data { * @is_ready: boolean signaling whether the RNG is initialized */ struct vdso_rng_data { - u64 generation; + unsigned long generation; u8 is_ready; }; diff --git a/include/vdso/getrandom.h b/include/vdso/getrandom.h index a8b7c14b0ae0..36fd166bf330 100644 --- a/include/vdso/getrandom.h +++ b/include/vdso/getrandom.h @@ -38,7 +38,7 @@ struct vgetrandom_state { }; u8 batch_key[CHACHA_BLOCK_SIZE * 2]; }; - u64 generation; + unsigned long generation; u8 pos; bool in_use; }; From patchwork Thu Aug 22 07:13:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 13772819 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id A772DC5320E for ; Thu, 22 Aug 2024 07:13:59 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 68A256B02A9; Thu, 22 Aug 2024 03:13:58 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5F69C6B02AB; Thu, 22 Aug 2024 03:13:58 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3EA6F6B02AA; Thu, 22 Aug 2024 03:13:58 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 125826B02A8 for ; Thu, 22 Aug 2024 03:13:58 -0400 (EDT) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id B8BF61A13C4 for ; Thu, 22 Aug 2024 07:13:57 +0000 (UTC) X-FDA: 82479016914.26.165295D Received: from pegase2.c-s.fr (pegase2.c-s.fr [93.17.235.10]) by imf16.hostedemail.com (Postfix) with ESMTP id 7749D180007 for ; Thu, 22 Aug 2024 07:13:55 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=none; spf=pass (imf16.hostedemail.com: domain of christophe.leroy@csgroup.eu designates 93.17.235.10 as permitted sender) smtp.mailfrom=christophe.leroy@csgroup.eu; dmarc=pass (policy=quarantine) header.from=csgroup.eu ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1724310819; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=rLjIhPKDj/Dh4USx6+zotffWYAdCTHoJiXbPZyXF+3g=; b=6tGY4cQvBmwauqeiEIvLk6GsiyOncZaypySszfjeadi9PAC2THQjtMi7g/MRA0ZxADBuBt wajaWgLxXy7LjBM1L/11nQbhWtYryWSO7Iw90IAPljcTYjXMJEG11gnSqh5FGu8rMsyiSl k8j51Yyv04DgyW3DfDKjaVjo+GZkjFM= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=none; spf=pass (imf16.hostedemail.com: domain of christophe.leroy@csgroup.eu designates 93.17.235.10 as permitted sender) smtp.mailfrom=christophe.leroy@csgroup.eu; dmarc=pass (policy=quarantine) header.from=csgroup.eu ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1724310819; a=rsa-sha256; cv=none; b=Io/YJ5C6K8hXU0OZATLPdoX4h7HmSZnASWAGwEjxml9wtOXKUrgqKwYbVLZxsIrSww58uc sM44oXv22HC7dsGxcI2Ciyd2rXIFoWbRdg/dg9O8bPe/F5KddH1PNXyCJIb4pFANAg1xxD ubxQjIHYk+iTRQLn+n0zo4+70NH+C9U= Received: from localhost (mailhub3.si.c-s.fr [172.26.127.67]) by localhost (Postfix) with ESMTP id 4WqDvG1Hfxz9sSX; Thu, 22 Aug 2024 09:13:30 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from pegase2.c-s.fr ([172.26.127.65]) by localhost (pegase2.c-s.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id cfcB8-hHUiZb; Thu, 22 Aug 2024 09:13:30 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase2.c-s.fr (Postfix) with ESMTP id 4WqDvG0NQrz9sSH; Thu, 22 Aug 2024 09:13:30 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id ED0E58B77D; Thu, 22 Aug 2024 09:13:29 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id mLRSvJmx548r; Thu, 22 Aug 2024 09:13:29 +0200 (CEST) Received: from PO20335.idsi0.si.c-s.fr (PO16920.IDSI0.si.c-s.fr [192.168.232.181]) by messagerie.si.c-s.fr (Postfix) with ESMTP id D75308B77E; Thu, 22 Aug 2024 09:13:28 +0200 (CEST) From: Christophe Leroy To: Michael Ellerman , Nicholas Piggin , Christophe Leroy , Naveen N Rao , Andy Lutomirski , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , "Theodore Ts'o" , "Jason A. Donenfeld" , Arnd Bergmann , Andrew Morton , Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , Vincenzo Frascino , Shuah Khan Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-arch@vger.kernel.org, linux-mm@kvack.org, linux-trace-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: [PATCH v2 07/17] mm: Define VM_DROPPABLE for powerpc/32 Date: Thu, 22 Aug 2024 09:13:15 +0200 Message-ID: <315e3a268b165b6edad7dcb723b0d8a506a56c4e.1724309198.git.christophe.leroy@csgroup.eu> X-Mailer: git-send-email 2.44.0 In-Reply-To: References: MIME-Version: 1.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1724310794; l=2716; i=christophe.leroy@csgroup.eu; s=20211009; h=from:subject:message-id; bh=OlEqmFYyA/zYCHsi3M5a6YAHLTZymd8rahW36+TnP9o=; b=0KtX+75e5aHacqDKWQzqJJ0c3IpXSB6kgpJ4hqMZLLHdQ8eM9uPGFxsA9pxzj08bhyJT2vwTC Mzj8u0pdGU1Avply/I3zb6bed28Vac+xMEzM29FNgP7xAAaRupkUHDN X-Developer-Key: i=christophe.leroy@csgroup.eu; a=ed25519; pk=HIzTzUj91asvincQGOFx6+ZF5AoUuP9GdOtQChs7Mm0= X-Rspam-User: X-Stat-Signature: mu9hdzt1ccaqt69pyc69nrsptjhp66f9 X-Rspamd-Queue-Id: 7749D180007 X-Rspamd-Server: rspam11 X-HE-Tag: 1724310835-12709 X-HE-Meta: U2FsdGVkX1+Ab5T7ElSTbQfj3wt6gqdotpMi/FtVgTYhBRE0pVTmCiNYSqKgli8PjdpcYS7EXqe6+60BSDsp3Go2gUSzb+CqRKeqwBysJHNkj+hyvfINPlj4Jmi8xZA+usZMMDwqceroovu1waWLzi9xieZwcmqqHMTz07Dkx061d7CgGyt48F0T8CKGsZGsVkObbL2I/GdpFgoq+tmYZydix9nV4kZS6d0iN42qdLoZV8ixS0sZi2PjKA0t/JqXLMq5/h+N9WrwWb9yn//YUyunbolt6sDByG+xlJDHwN6qp922uyOqvpyGdqLjiCisehAJevQ7GfELwuDh+wVREvfPxpaY2XTK7DbjgoR+sF0dpvttdMmKvPdY7p8f4jTDWs1CSraSAxOpxV96ZCV1TrmspgcEYQ4CUAvDPFxiqGxcdkI1ZN2uMBFQFDfcWhT3v+Tt03n/xWinTvjxhYM7yVJVft4G3sKVQJ+tkEtaQB9iMX18VWphuZkpEiCF+bF2lT3LnmZLv8jwykeVR3P/UHRkhhZPaE1Okscd9CJSwk3GPfoqKeU/DuV6i/YAYjDs4juVJOfys2H1bUBMD4X3Rainud6MZc49PKrZSOue9MMMYGFbHXB2VJJNkH5hZvCTxyey6tGPBfGTkGvTA8cNNMtVBvAfdQ3dNVVR0C5ekgfMCpDen5c1u1UwQySJsoWFoX5WTUNBDaoQc5QiJNk/POhvtZoOyM17TcQxM97AbgLPfqjXr/AXrzFCHa92dVTd5yryUdqIhFmiQymuKVvIv8h0QcNd8jOwgxucGw6iJxiiOpC4Gld50OmNQD0GsuQokDr75+k9Jo0Rvg3SOLIlqRuQbIGl3d6Oq4Ux0Gmnxd4sGcqx5OKY7ZwHUsCHImRrjuEAv9kYIExWc0M61lbRxVaOomEpOhWF4wAjSlFPQDBoop+bFrpJZfah0MyCkDxRMOLgOd1oPFN28/FR5lA 8J6iacAK uOf0Pv/ytbEKqM8FCBM7MXSt05fXmHY5OOioly/1ogVMSPMnvkSW43icgE6jfIsqHUuaTcZL8QA1+zHdCIFsvnFVSenE1FeSJxEcDZ+80R5LtkyZi57jW0JN9+b+hfbe0ArEZi2tgUyGWixw7N87CvNZ4GHh+/8t91sGIw8zGIvBZPnk= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Commit 9651fcedf7b9 ("mm: add MAP_DROPPABLE for designating always lazily freeable mappings") only adds VM_DROPPABLE for 64 bits architectures. In order to also use the getrandom vDSO implementation on powerpc/32, use VM_ARCH_1 for VM_DROPPABLE on powerpc/32. This is possible because VM_ARCH_1 is used for VM_SAO on powerpc and VM_SAO is only for powerpc/64. Signed-off-by: Christophe Leroy --- fs/proc/task_mmu.c | 4 +++- include/linux/mm.h | 4 +++- include/trace/events/mmflags.h | 4 ++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c index 5f171ad7b436..4a3fe961cbf6 100644 --- a/fs/proc/task_mmu.c +++ b/fs/proc/task_mmu.c @@ -987,8 +987,10 @@ static void show_smap_vma_flags(struct seq_file *m, struct vm_area_struct *vma) #ifdef CONFIG_X86_USER_SHADOW_STACK [ilog2(VM_SHADOW_STACK)] = "ss", #endif -#ifdef CONFIG_64BIT +#if VM_DROPPABLE != VM_NONE [ilog2(VM_DROPPABLE)] = "dp", +#endif +#ifdef CONFIG_64BIT [ilog2(VM_SEALED)] = "sl", #endif }; diff --git a/include/linux/mm.h b/include/linux/mm.h index c4b238a20b76..865d3e21ee5e 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -359,7 +359,7 @@ extern unsigned int kobjsize(const void *objp); #if defined(CONFIG_X86) # define VM_PAT VM_ARCH_1 /* PAT reserves whole VMA at once (x86) */ -#elif defined(CONFIG_PPC) +#elif defined(CONFIG_PPC64) # define VM_SAO VM_ARCH_1 /* Strong Access Ordering (powerpc) */ #elif defined(CONFIG_PARISC) # define VM_GROWSUP VM_ARCH_1 @@ -409,6 +409,8 @@ extern unsigned int kobjsize(const void *objp); #ifdef CONFIG_64BIT #define VM_DROPPABLE_BIT 40 #define VM_DROPPABLE BIT(VM_DROPPABLE_BIT) +#elif defined(CONFIG_PPC32) +#define VM_DROPPABLE VM_ARCH_1 #else #define VM_DROPPABLE VM_NONE #endif diff --git a/include/trace/events/mmflags.h b/include/trace/events/mmflags.h index b63d211bd141..9820cbfbcb14 100644 --- a/include/trace/events/mmflags.h +++ b/include/trace/events/mmflags.h @@ -143,7 +143,7 @@ IF_HAVE_PG_ARCH_X(arch_3) #if defined(CONFIG_X86) #define __VM_ARCH_SPECIFIC_1 {VM_PAT, "pat" } -#elif defined(CONFIG_PPC) +#elif defined(CONFIG_PPC64) #define __VM_ARCH_SPECIFIC_1 {VM_SAO, "sao" } #elif defined(CONFIG_PARISC) #define __VM_ARCH_SPECIFIC_1 {VM_GROWSUP, "growsup" } @@ -165,7 +165,7 @@ IF_HAVE_PG_ARCH_X(arch_3) # define IF_HAVE_UFFD_MINOR(flag, name) #endif -#ifdef CONFIG_64BIT +#if VM_DROPPABLE != VM_NONE # define IF_HAVE_VM_DROPPABLE(flag, name) {flag, name}, #else # define IF_HAVE_VM_DROPPABLE(flag, name) From patchwork Thu Aug 22 07:13:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 13772821 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 91F20C5320E for ; Thu, 22 Aug 2024 07:14:06 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4B78A6B0123; Thu, 22 Aug 2024 03:14:02 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4131580009; Thu, 22 Aug 2024 03:14:02 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1EF086B0125; Thu, 22 Aug 2024 03:14:02 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id DFAA680009 for ; Thu, 22 Aug 2024 03:14:01 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id A30B91A0513 for ; Thu, 22 Aug 2024 07:14:01 +0000 (UTC) X-FDA: 82479017082.15.541A88F Received: from pegase2.c-s.fr (pegase2.c-s.fr [93.17.235.10]) by imf14.hostedemail.com (Postfix) with ESMTP id 8BB26100002 for ; Thu, 22 Aug 2024 07:13:59 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=none; spf=pass (imf14.hostedemail.com: domain of christophe.leroy@csgroup.eu designates 93.17.235.10 as permitted sender) smtp.mailfrom=christophe.leroy@csgroup.eu; dmarc=pass (policy=quarantine) header.from=csgroup.eu ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1724310799; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+w5057F0bNv+xLFZqfMIzOONVXrbI7WDtq/qfAWpav4=; b=PhtyZlB3kh5OIp7GbTCEsa8GkecHBUvWrq+Br0Dn2/yUu3iOaqD2bwsg6BQ5CcQYkZmlJh 2eL8+BNkV1dZxYY1Uu7PMy7zGZrZ90BjvbIQHbptqqaHWD57MLHds27NtvffDPJcfngpnK OzosIJMlgukSVvwfGfXOYvkkkgGXjWo= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=none; spf=pass (imf14.hostedemail.com: domain of christophe.leroy@csgroup.eu designates 93.17.235.10 as permitted sender) smtp.mailfrom=christophe.leroy@csgroup.eu; dmarc=pass (policy=quarantine) header.from=csgroup.eu ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1724310799; a=rsa-sha256; cv=none; b=SFVladggb0px645yIxMyhYaSbEzBnx8bUs3jUD6Y89cqkdBOFOLmfbhFEcoOm5ChbAAyxQ 8oaBEEIBKDNGxnL+xuDri7/12Z0UEGubLX0K5bMGsYDpCGCHz025RVan2zJkz1EHvgoHzM H4ffdpjC0VGSnNp06PMbeYT6C8ej/SU= Received: from localhost (mailhub3.si.c-s.fr [172.26.127.67]) by localhost (Postfix) with ESMTP id 4WqDvH1Lg0z9sSY; Thu, 22 Aug 2024 09:13:31 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from pegase2.c-s.fr ([172.26.127.65]) by localhost (pegase2.c-s.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id HrgTAL98uEO3; Thu, 22 Aug 2024 09:13:31 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase2.c-s.fr (Postfix) with ESMTP id 4WqDvH0Z6sz9sSH; Thu, 22 Aug 2024 09:13:31 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 018F68B77D; Thu, 22 Aug 2024 09:13:31 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id 4Xoul67SwRYa; Thu, 22 Aug 2024 09:13:30 +0200 (CEST) Received: from PO20335.idsi0.si.c-s.fr (PO16920.IDSI0.si.c-s.fr [192.168.232.181]) by messagerie.si.c-s.fr (Postfix) with ESMTP id EC72A8B763; Thu, 22 Aug 2024 09:13:29 +0200 (CEST) From: Christophe Leroy To: Michael Ellerman , Nicholas Piggin , Christophe Leroy , Naveen N Rao , Andy Lutomirski , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , "Theodore Ts'o" , "Jason A. Donenfeld" , Arnd Bergmann , Andrew Morton , Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , Vincenzo Frascino , Shuah Khan Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-arch@vger.kernel.org, linux-mm@kvack.org, linux-trace-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: [PATCH v2 08/17] powerpc: Add little endian variants of LWZX_BE and STWX_BE Date: Thu, 22 Aug 2024 09:13:16 +0200 Message-ID: X-Mailer: git-send-email 2.44.0 In-Reply-To: References: MIME-Version: 1.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1724310794; l=906; i=christophe.leroy@csgroup.eu; s=20211009; h=from:subject:message-id; bh=6H7T4OtghNGIKLYUW15IDF5ngiuRyCUv+bUYaWIueQo=; b=hNY+LGr2Rcm1FruX/Pi4TXpEpJ3NK0USBgOJB07umxT2MU3l11Qrgf0kRkvOEtaehX9BImGb3 aPlCV4CucUaA5+VROpxaJP9JVn4u1j8nncN+Akg3rm5xpKRsYhQxEMu X-Developer-Key: i=christophe.leroy@csgroup.eu; a=ed25519; pk=HIzTzUj91asvincQGOFx6+ZF5AoUuP9GdOtQChs7Mm0= X-Rspamd-Server: rspam03 X-Rspam-User: X-Rspamd-Queue-Id: 8BB26100002 X-Stat-Signature: urm5muz9uxx15nnru6m839f56spkera7 X-HE-Tag: 1724310839-152903 X-HE-Meta: U2FsdGVkX1/vGmUwEYXWD93doUS2wDxDqDLmdZzxqoI0LLtKGaCuMGLC/LhwJAn2Vg2A+o1WFz74acJbLdeGEQgf3icgRbCvJZPb+IDua7IECvLGGahkSU+KBIQJPE1m5ECN/qrA7uWCI/Bq1sJ2higK2V04ZkLAP8pJv0QUNsr1xwuYTOsHuoqThqGkzyBwN8qmoIALSmqWPL2bZZ6pSJZhJQNucDUfCUQO3sRomk823iRJptgYbIJR/R4FsJ3T68eK3bLSQC9R1rsW2T81AC5h97K471Nqoc1E7jFs+CKDBxbNGpo7lcJpiPmdDbvipqo7wBVeMGu+sL4VpninSGSrmgTlAxU0xbKT21Pr9KI6cg347o52CaGv9YilbilbCWLK6PcrkJ5M7mjlZXwGw/4Q+04ON+7MTe6+y1I24oHHkFaVH+j2PCJyVu2wKUIHeqPXt7sVsTtAHAZW9n1xdP2+OAeRFVdeeL7x9PcJi2FQhKAbOqOaLpRh1/li4uu9p1rSeP0N0dYkwpAqvkdUpqM4E9sI9TeqG/91Dbzp4ZqaSczIDD7Dt545sv6Jkzam+tjjeMZE2+GuAI61WkIbb4X9WUSyxNanauqwaO8ALvm39Qc2W4O3WLjJM344JOuJufn7ddVMCM83GZ4vW8he3fRHaBo/3ZXDE+BcNFz8IHLwojmNDBKMImcj12/IWnyQNpwF6p68FpnF0zDp3hgEiKGVfOYt7X114xydr2RQGLgYlBjiMWaEa+txn6ujL6rPR/6Gg0lNm22NzTfOJeVs+XUlXnPfOz4P9KfFOTrkCcZ4kZwhBtHcPkNUmMyzGbSfZkM5FQ4pwIYaTkErJj1UXQg3+FTG4mamyzDpzfbkLES0SmSw65hfLDdE4FweecFVHCtbpT+gvgJyk5KPxMG/H/cX5z5nZ+eMsCys+CINC+ykm6t6UlBu9F0FJfkmysKv1CbznDWvSBywM0nEgF8 Xq9kBF63 OIMhHvM3LhvYBEjNg43e8bTpoM5hgUlWagx56su06XjpyNr7sILaPiI4dALhPGNGVy2bINbAS5wTJkTIi3/EB9pn4KtgTXewyavv+1ifuICinmwce3Z2PysctkhEwGXAuTVsRq1NlgAkccF2DE2Hmaol338k3P9/PWZeguSgOUgCUams= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: To support getrandom in VDSO which is based on little endian storage, add macros equivalent to LWZX_BE and STWX_BE for little endian accesses. Put them outside of __powerpc64__ #ifdef so that they can also be used for PPC32. Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/asm-compat.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/arch/powerpc/include/asm/asm-compat.h b/arch/powerpc/include/asm/asm-compat.h index 2bc53c646ccd..6e53a80917ef 100644 --- a/arch/powerpc/include/asm/asm-compat.h +++ b/arch/powerpc/include/asm/asm-compat.h @@ -61,4 +61,12 @@ #endif +#ifdef __BIG_ENDIAN__ +#define LWZX_LE stringify_in_c(lwbrx) +#define STWX_LE stringify_in_c(stwbrx) +#else +#define LWZX_LE stringify_in_c(lwzx) +#define STWX_LE stringify_in_c(stwx) +#endif + #endif /* _ASM_POWERPC_ASM_COMPAT_H */ From patchwork Thu Aug 22 07:13:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 13772823 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 15FC3C3DA4A for ; Thu, 22 Aug 2024 07:14:13 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 684E66B02B0; Thu, 22 Aug 2024 03:14:06 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 60DCE6B02AF; Thu, 22 Aug 2024 03:14:06 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 438696B02B0; Thu, 22 Aug 2024 03:14:06 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 1C5DA6B02AE for ; Thu, 22 Aug 2024 03:14:06 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id CACAE1412F9 for ; Thu, 22 Aug 2024 07:14:05 +0000 (UTC) X-FDA: 82479017250.03.811005B Received: from pegase2.c-s.fr (pegase2.c-s.fr [93.17.235.10]) by imf24.hostedemail.com (Postfix) with ESMTP id A675018001D for ; Thu, 22 Aug 2024 07:14:03 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=csgroup.eu; spf=pass (imf24.hostedemail.com: domain of christophe.leroy@csgroup.eu designates 93.17.235.10 as permitted sender) smtp.mailfrom=christophe.leroy@csgroup.eu ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1724310784; a=rsa-sha256; cv=none; b=wHPFpmhTyIix+Vj9BKZKqloBtfsAxC7dOkVnmrAqwIgWb6hUOeUeCEOC4jGoc2aDnfyfdb 5AydpBiBe+4VDnSX3Qe8q9EfFBiyS7L52lg7G2BQ8YVwkJo+XqjKZOYyvTEAH7IpmWyRLB zFtH5rhCeI8JagO7qME1lALaomGLTwY= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=csgroup.eu; spf=pass (imf24.hostedemail.com: domain of christophe.leroy@csgroup.eu designates 93.17.235.10 as permitted sender) smtp.mailfrom=christophe.leroy@csgroup.eu ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1724310784; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MwCQPr+DkzFiDHzjMK222UDVKoya0EMyZrgWc4ytvxg=; b=6wRJlwfU3HjrO7xU/fuJ8lB3uH4lfjo1jWxD6dlmeOfa1C0rTcEIzR2GgXUpH3DvdbpKDQ 7UXqZVFeP4YwLny3ZZDCaihqtpa6O/YxDQa8fdNIz3ETMAiYpquLTAASdbIl/e51b7lVDr Zj3eaQ7fv6i8b2VWuRpWLdZQfbHyRbU= Received: from localhost (mailhub3.si.c-s.fr [172.26.127.67]) by localhost (Postfix) with ESMTP id 4WqDvJ1ts2z9sSZ; Thu, 22 Aug 2024 09:13:32 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from pegase2.c-s.fr ([172.26.127.65]) by localhost (pegase2.c-s.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id J19dfRjWyl6q; Thu, 22 Aug 2024 09:13:32 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase2.c-s.fr (Postfix) with ESMTP id 4WqDvJ14jHz9sSH; Thu, 22 Aug 2024 09:13:32 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 13A3D8B77D; Thu, 22 Aug 2024 09:13:32 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id mXHlUX_aoLcN; Thu, 22 Aug 2024 09:13:31 +0200 (CEST) Received: from PO20335.idsi0.si.c-s.fr (PO16920.IDSI0.si.c-s.fr [192.168.232.181]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 02F3A8B77E; Thu, 22 Aug 2024 09:13:30 +0200 (CEST) From: Christophe Leroy To: Michael Ellerman , Nicholas Piggin , Christophe Leroy , Naveen N Rao , Andy Lutomirski , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , "Theodore Ts'o" , "Jason A. Donenfeld" , Arnd Bergmann , Andrew Morton , Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , Vincenzo Frascino , Shuah Khan Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-arch@vger.kernel.org, linux-mm@kvack.org, linux-trace-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: [PATCH v2 09/17] powerpc/vdso32: Add crtsavres Date: Thu, 22 Aug 2024 09:13:17 +0200 Message-ID: <3730201dbc5add4d3a87c0ce80dd1dddf938d13a.1724309198.git.christophe.leroy@csgroup.eu> X-Mailer: git-send-email 2.44.0 In-Reply-To: References: MIME-Version: 1.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1724310794; l=2796; i=christophe.leroy@csgroup.eu; s=20211009; h=from:subject:message-id; bh=utdv6V/SvZxVA50hOk7t/lkGWDvSE1q/kJYchx6i5SU=; b=SZIg9brB+vtPlEI/uhJ6lsYxQKnhHvbMUlfNQ42Zutu1csaGNwZMYx5RZ2ib0CRRFeQMaLt+k d2yQvcpbkvsCMYHUVfLugVTmTgBTZPnr1GTiaE51BS2+woZrEdRxKII X-Developer-Key: i=christophe.leroy@csgroup.eu; a=ed25519; pk=HIzTzUj91asvincQGOFx6+ZF5AoUuP9GdOtQChs7Mm0= X-Rspamd-Queue-Id: A675018001D X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: oun8557dmwqgu6zm6knmgppimeasnm18 X-HE-Tag: 1724310843-762208 X-HE-Meta: U2FsdGVkX19EdKAtHhE/mIyGanOGl0O3gG7T/3CTDPfGB9h0Ik+g4RN3Vgz7plPfvvSRBalyHn0Bow6JwlvoeDgalu4NtHQH1WCvhtTBnhbJvpOPO592FikcJhZsZo4ZabqnZyGZGiSmZ0TVecpr+QcTIwjipukXm9pLH5L7czoNgkFu8XP9X134tOF+pFDFDvyyEj8hkAVAEV8IPWFllGtFSZfE9kOnVzQRmEebhgYrC7sNYOcfGUrKc/LwSQ79VeGi17swL9y/XZ7eD4c0bCWNvxNaGvvTARxRucm9EhxG3ej8nBXz4Dkl5vDzkIT3eWJLZuAkNbUA6+Ivk/wda/XidKHDP/We/KTanvMQhvMDGnzitAdnWHcTwOmujBsqfBDIUoJQ3/zhVErsaa3hsrdBt4rj5H6c31+j3ZFazSpv5BzgyLhN4N1UjU38obug3qKvlv1oF3bJprErJDTNhQWpmGIwTJ4RBHlzzt510qazx4qdW8zt2kP3snNKWVeCugR5SR0j/NU8tHAppTWaTXAJTFRTodsZFQ8/EEe5bgtTqW2PoBHi6FUYGgJfDbmlQtJRkaq68slEX0Q8JIrtR1T8vcSNH5P2ek+eDzoh6fr7NqIHGq27Ukpb1UD54wkEq7m9FeUEDu7hcHpyMaMy02rx/2DE8S5eTbBUG0lvCY9u78qAzqlEPXlQvgy6Esm849j/drqmqUp6UhgVKqun4MJ4MT5iYueVVyvWDAHQUjHJTHLxE73KkdBjqG3Vi2IKWAzd1vMwRFvwnQFBuOLZ6XUNGzJKS1/SNGW8uGroo1QO10gpxAa6l5gIA5Kj213G5tF04v/d7pskCevZcBmnfVNx4K8Jkzz7ZFSV+tdpKjteopv6CiLUqqQcW0Kc2rU7d2p4PBYsrPHfwMK9XXmE0pYnS6QqeVGz3mWFNUEAwALcke9mFqPzvq3mjAB8Qq3V2epP2lMg1DDasUz6syD WaqDmfEi JMCmj2S6RKqVq/uZOX43cVheYmeSUuiOr9HS2Jbu6eXg3kKbAVf64b/2sgalJNXgnCOiYJssxAcHEJ8J8XjyxthMlpcfrqzO0GksX4EZILNF8hSXnMS04Bk0bE00IFCeCqSOx X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Commit 08c18b63d965 ("powerpc/vdso32: Add missing _restgpr_31_x to fix build failure") added _restgpr_31_x to the vdso for gettimeofday, but the work on getrandom shows that we will need more of those functions. Remove _restgpr_31_x and link in crtsavres.o so that we get all save/restore functions when optimising the kernel for size. Signed-off-by: Christophe Leroy --- arch/powerpc/kernel/vdso/Makefile | 5 ++++- arch/powerpc/kernel/vdso/gettimeofday.S | 13 ------------- 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/arch/powerpc/kernel/vdso/Makefile b/arch/powerpc/kernel/vdso/Makefile index 1425b6edc66b..c07a425b8f78 100644 --- a/arch/powerpc/kernel/vdso/Makefile +++ b/arch/powerpc/kernel/vdso/Makefile @@ -43,6 +43,7 @@ else endif targets := $(obj-vdso32) vdso32.so.dbg vgettimeofday-32.o +targets += crtsavres-32.o obj-vdso32 := $(addprefix $(obj)/, $(obj-vdso32)) targets += $(obj-vdso64) vdso64.so.dbg vgettimeofday-64.o obj-vdso64 := $(addprefix $(obj)/, $(obj-vdso64)) @@ -68,7 +69,7 @@ targets += vdso64.lds CPPFLAGS_vdso64.lds += -P -C # link rule for the .so file, .lds has to be first -$(obj)/vdso32.so.dbg: $(obj)/vdso32.lds $(obj-vdso32) $(obj)/vgettimeofday-32.o FORCE +$(obj)/vdso32.so.dbg: $(obj)/vdso32.lds $(obj-vdso32) $(obj)/vgettimeofday-32.o $(obj)/crtsavres-32.o FORCE $(call if_changed,vdso32ld_and_check) $(obj)/vdso64.so.dbg: $(obj)/vdso64.lds $(obj-vdso64) $(obj)/vgettimeofday-64.o FORCE $(call if_changed,vdso64ld_and_check) @@ -76,6 +77,8 @@ $(obj)/vdso64.so.dbg: $(obj)/vdso64.lds $(obj-vdso64) $(obj)/vgettimeofday-64.o # assembly rules for the .S files $(obj-vdso32): %-32.o: %.S FORCE $(call if_changed_dep,vdso32as) +$(obj)/crtsavres-32.o: %-32.o: $(srctree)/arch/powerpc/lib/crtsavres.S FORCE + $(call if_changed_dep,vdso32as) $(obj)/vgettimeofday-32.o: %-32.o: %.c FORCE $(call if_changed_dep,vdso32cc) $(obj-vdso64): %-64.o: %.S FORCE diff --git a/arch/powerpc/kernel/vdso/gettimeofday.S b/arch/powerpc/kernel/vdso/gettimeofday.S index 48fc6658053a..67254ac9c8bb 100644 --- a/arch/powerpc/kernel/vdso/gettimeofday.S +++ b/arch/powerpc/kernel/vdso/gettimeofday.S @@ -118,16 +118,3 @@ V_FUNCTION_END(__kernel_clock_getres) V_FUNCTION_BEGIN(__kernel_time) cvdso_call __c_kernel_time call_time=1 V_FUNCTION_END(__kernel_time) - -/* Routines for restoring integer registers, called by the compiler. */ -/* Called with r11 pointing to the stack header word of the caller of the */ -/* function, just beyond the end of the integer restore area. */ -#ifndef __powerpc64__ -_GLOBAL(_restgpr_31_x) -_GLOBAL(_rest32gpr_31_x) - lwz r0,4(r11) - lwz r31,-4(r11) - mtlr r0 - mr r1,r11 - blr -#endif From patchwork Thu Aug 22 07:13:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 13772825 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6B788C3DA4A for ; Thu, 22 Aug 2024 07:14:19 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 43B156B0131; Thu, 22 Aug 2024 03:14:10 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 34E086B0134; Thu, 22 Aug 2024 03:14:10 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0DD5E6B0133; Thu, 22 Aug 2024 03:14:10 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id D9FA66B0128 for ; Thu, 22 Aug 2024 03:14:09 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 98D23413B8 for ; Thu, 22 Aug 2024 07:14:09 +0000 (UTC) X-FDA: 82479017418.02.DD915C3 Received: from pegase2.c-s.fr (pegase2.c-s.fr [93.17.235.10]) by imf09.hostedemail.com (Postfix) with ESMTP id 67B3414001B for ; Thu, 22 Aug 2024 07:14:07 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=none; spf=pass (imf09.hostedemail.com: domain of christophe.leroy@csgroup.eu designates 93.17.235.10 as permitted sender) smtp.mailfrom=christophe.leroy@csgroup.eu; dmarc=pass (policy=quarantine) header.from=csgroup.eu ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1724310807; a=rsa-sha256; cv=none; b=dEb2wbIm/Gpm/gxzh1mXzhNe/R8H8/dcdvpbO+nUhP0KpL1z1GeekAfIIfy6yxdWJTnuCy xOq2t4IfWce5E2O7qKW6+iI1QZPbGdjjKKY+5BQ+jflzf5I7xHHwGeCbmlHx/vwhfDAcWI bH1umOZ8SfkQ36paJY1XNT7v2SQ5qV0= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=none; spf=pass (imf09.hostedemail.com: domain of christophe.leroy@csgroup.eu designates 93.17.235.10 as permitted sender) smtp.mailfrom=christophe.leroy@csgroup.eu; dmarc=pass (policy=quarantine) header.from=csgroup.eu ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1724310807; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gNvjGydXxM11R6iYxoD5Gjm3JZjBgCRgafHCl+6dfbQ=; b=h/p8ALKL2vSYAbw3OIv2t55bMXcC2HZDqKdg5bQNmXc9LWLaB+VyR+gBYEEhbSdlGS61As p4G1axDYMAio7kMpzSSr86bv+ZvOg0OvYybIIHxIMzl05HYOg7zzzuNb9U8105xE4xTooq e0YTEirIefnjWSSVtJSTVj86xj9TMv0= Received: from localhost (mailhub3.si.c-s.fr [172.26.127.67]) by localhost (Postfix) with ESMTP id 4WqDvK2DXtz9sSc; Thu, 22 Aug 2024 09:13:33 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from pegase2.c-s.fr ([172.26.127.65]) by localhost (pegase2.c-s.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 8A21g5ZTDm9W; Thu, 22 Aug 2024 09:13:33 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase2.c-s.fr (Postfix) with ESMTP id 4WqDvK1LWfz9sSH; Thu, 22 Aug 2024 09:13:33 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 1C6448B77E; Thu, 22 Aug 2024 09:13:33 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id yCpxyD8Ro_93; Thu, 22 Aug 2024 09:13:33 +0200 (CEST) Received: from PO20335.idsi0.si.c-s.fr (PO16920.IDSI0.si.c-s.fr [192.168.232.181]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 09D248B763; Thu, 22 Aug 2024 09:13:32 +0200 (CEST) From: Christophe Leroy To: Michael Ellerman , Nicholas Piggin , Christophe Leroy , Naveen N Rao , Andy Lutomirski , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , "Theodore Ts'o" , "Jason A. Donenfeld" , Arnd Bergmann , Andrew Morton , Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , Vincenzo Frascino , Shuah Khan Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-arch@vger.kernel.org, linux-mm@kvack.org, linux-trace-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: [PATCH v2 10/17] powerpc/vdso: Refactor CFLAGS for CVDSO build Date: Thu, 22 Aug 2024 09:13:18 +0200 Message-ID: <6e3afc882145ee3b771ea41f1046c63f64f56b1e.1724309198.git.christophe.leroy@csgroup.eu> X-Mailer: git-send-email 2.44.0 In-Reply-To: References: MIME-Version: 1.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1724310794; l=2748; i=christophe.leroy@csgroup.eu; s=20211009; h=from:subject:message-id; bh=Ezragzu3H5pSOY8WE3tKe7qLSwAgcLltpLmVKFEiFUM=; b=WaaKs+NofgcatkvWclAWUUw1Lix/JvqHhod4SpDdJ2RuWqwYcRwnwH5nv9cEl8nquqboddZWe nwWjcQtDkbCB2o3GzGri/WTviycNGBuIRjOZTFG132iZZ+ENyqyxk+o X-Developer-Key: i=christophe.leroy@csgroup.eu; a=ed25519; pk=HIzTzUj91asvincQGOFx6+ZF5AoUuP9GdOtQChs7Mm0= X-Stat-Signature: 34eah9kqjbapucbb7p7qjqin8p4wirr7 X-Rspamd-Queue-Id: 67B3414001B X-Rspam-User: X-Rspamd-Server: rspam10 X-HE-Tag: 1724310847-289509 X-HE-Meta: U2FsdGVkX1+v9+o/UScGUh0+XEcuUQx5EZyS5v1u1ywj0yKSlpOHSGqP2DrbR1IejEfjFq1C7Y1bE2CSmr9EDGHTVa2GCWmszL40JFu6tlMnQoUU62ciVc2Ki2jBohs9TDz+anykD1aktXczrB8EPig2E5MkWSoq2ooWNaYrbve+W7tWW87troUNlr3sBuFUt5mOK5cgcWt952YhI0arVrcTv1BwfMiiK3OyRSDB5VEzWLTXJCXXaXb3tvCZ0i4DlUjIc+QsrQN4utq3pov49qJO+Tfb+s4WDvBWPXuRnZOO6CfPq3iin0tXrvvTLZGHa0rYqpatRJ+dgpY/nJ2QEWFaNMta2bEnP2t9hdCvpL8NVGwDgROYJYSIK0ooUkCR2TMKTL9UNz7ivAh5VtRr2Mm3Rs+FKEVJAcLJDX2/X8/zPcq649uVkAUPPWD7i1jCPiLpumHa2Jz020k/8wY4Gf+f2kuLM5peb+OHuPSoutNkkQKmt0f9+zvutjnUC7cCmBuriyz8QGYTSHRcBY5o1kx/qWAxfvcoF2O2b33jebfjfXMFcAsITfXhPkXeso/VLGswnoyAKNnmJuXkiwQEASnNXTnu9/7XCwi9n24n8w77TtzAmtuXG+ydks+Sn8Vw2a+T7h+rPPy32/fO2UpA/hOWiyxdoGnwC1fr1eEY9wQWxDErV11dAoenuQWL8y/7D8L1vOB7wKbVbqIu4s3r9wN9hn3YXHjZyeVaIcKr222YRlujh1y9AjTIwPQwf9qtTmNl3BBj6DeQn1Y8zAFP5eBD66s6jelujDpM7V0Xm3Qr22L3ESyGwbJKGhg6OBxTI6nddhJzJmgmLEP02Vs7wBhKMFjhg42eYUKC7iWRG2rvcuzNpUeKxg7mzfjtVQitkERJMykwSEd1btepBcW8bVhHYlw9tD7di8XSfbEYZzTkDwG9mTdInO0TNAWhVyn3wrKc898FyRsrG3bOzxc 1umrRepH zge5OCMOnajisOBOiivTrXy3ccMUkBQX/uG50DNtTAkMMDDOIPZuSFRFq9khxRXZ2GnQMbaV1JZFSlsrTkppX8NAj2NOUWDwsV4vDortUqkba/Ws2tA/PrBx8iGQ4hTcDiWio X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: In order to avoid duplication when we add new VDSO functionnalities in C like getrandom, refactor common CFLAGS. Signed-off-by: Christophe Leroy --- arch/powerpc/kernel/vdso/Makefile | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/arch/powerpc/kernel/vdso/Makefile b/arch/powerpc/kernel/vdso/Makefile index c07a425b8f78..cd4ed09864f0 100644 --- a/arch/powerpc/kernel/vdso/Makefile +++ b/arch/powerpc/kernel/vdso/Makefile @@ -10,11 +10,6 @@ obj-vdso64 = sigtramp64-64.o gettimeofday-64.o datapage-64.o cacheflush-64.o not ifneq ($(c-gettimeofday-y),) CFLAGS_vgettimeofday-32.o += -include $(c-gettimeofday-y) - CFLAGS_vgettimeofday-32.o += $(DISABLE_LATENT_ENTROPY_PLUGIN) - CFLAGS_vgettimeofday-32.o += $(call cc-option, -fno-stack-protector) - CFLAGS_vgettimeofday-32.o += -DDISABLE_BRANCH_PROFILING - CFLAGS_vgettimeofday-32.o += -ffreestanding -fasynchronous-unwind-tables - CFLAGS_REMOVE_vgettimeofday-32.o = $(CC_FLAGS_FTRACE) CFLAGS_REMOVE_vgettimeofday-32.o += -mcmodel=medium -mabi=elfv1 -mabi=elfv2 -mcall-aixdesc # This flag is supported by clang for 64-bit but not 32-bit so it will cause # an unused command line flag warning for this file. @@ -22,11 +17,6 @@ ifneq ($(c-gettimeofday-y),) CFLAGS_REMOVE_vgettimeofday-32.o += -fno-stack-clash-protection endif CFLAGS_vgettimeofday-64.o += -include $(c-gettimeofday-y) - CFLAGS_vgettimeofday-64.o += $(DISABLE_LATENT_ENTROPY_PLUGIN) - CFLAGS_vgettimeofday-64.o += $(call cc-option, -fno-stack-protector) - CFLAGS_vgettimeofday-64.o += -DDISABLE_BRANCH_PROFILING - CFLAGS_vgettimeofday-64.o += -ffreestanding -fasynchronous-unwind-tables - CFLAGS_REMOVE_vgettimeofday-64.o = $(CC_FLAGS_FTRACE) # Go prior to 1.16.x assumes r30 is not clobbered by any VDSO code. That used to be true # by accident when the VDSO was hand-written asm code, but may not be now that the VDSO is # compiler generated. To avoid breaking Go tell GCC not to use r30. Impact on code @@ -49,7 +39,12 @@ targets += $(obj-vdso64) vdso64.so.dbg vgettimeofday-64.o obj-vdso64 := $(addprefix $(obj)/, $(obj-vdso64)) ccflags-y := -fno-common -fno-builtin +ccflags-y += $(DISABLE_LATENT_ENTROPY_PLUGIN) +ccflags-y += $(call cc-option, -fno-stack-protector) +ccflags-y += -DDISABLE_BRANCH_PROFILING +ccflags-y += -ffreestanding -fasynchronous-unwind-tables ldflags-y := -Wl,--hash-style=both -nostdlib -shared -z noexecstack $(CLANG_FLAGS) +ccflags-remove-y := $(CC_FLAGS_FTRACE) ldflags-$(CONFIG_LD_IS_LLD) += $(call cc-option,--ld-path=$(LD),-fuse-ld=lld) ldflags-$(CONFIG_LD_ORPHAN_WARN) += -Wl,--orphan-handling=$(CONFIG_LD_ORPHAN_WARN_LEVEL) From patchwork Thu Aug 22 07:13:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 13772826 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 43AEEC3DA4A for ; Thu, 22 Aug 2024 07:14:22 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 80D646B025E; Thu, 22 Aug 2024 03:14:14 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 794796B0260; Thu, 22 Aug 2024 03:14:14 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 59A1480009; Thu, 22 Aug 2024 03:14:14 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 24D4D6B025E for ; Thu, 22 Aug 2024 03:14:14 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id D722681341 for ; Thu, 22 Aug 2024 07:14:13 +0000 (UTC) X-FDA: 82479017586.06.A377724 Received: from pegase2.c-s.fr (pegase2.c-s.fr [93.17.235.10]) by imf18.hostedemail.com (Postfix) with ESMTP id A284B1C0011 for ; Thu, 22 Aug 2024 07:14:11 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=csgroup.eu; spf=pass (imf18.hostedemail.com: domain of christophe.leroy@csgroup.eu designates 93.17.235.10 as permitted sender) smtp.mailfrom=christophe.leroy@csgroup.eu ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1724310786; a=rsa-sha256; cv=none; b=mtwqMRh8KPvLdGTosxCypFB3drE2OEd53tvDNjMKarWeHm80CNV7cYmp4OoeTzjpa30XUp 2PGk7YV2qmIOg8OPCmcpQXrsehwt+8bUpGddBfhA1mljpjFNP5M+Q3P86gcS3LT/WF0dwf NKUTJzx3POB6s9NvJEYUvYO3r/wKnp4= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=csgroup.eu; spf=pass (imf18.hostedemail.com: domain of christophe.leroy@csgroup.eu designates 93.17.235.10 as permitted sender) smtp.mailfrom=christophe.leroy@csgroup.eu ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1724310786; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=pg3LJY2BMUnga133KhWtmF7tvxRPCr12uqI+9Ge9ZUY=; b=f/sk/7StII4n0EXg8Q5P9+/iEc0NtY8cfZGDgPUSKg2gD76s19/eHZzUV33ge+8oU3R9Kh PHdQOM+Pzudb1BSpOunhJYtT3WgQc8LdlSQwMp8mx5hOXlEhhHoSpA/olyUt5Yz1gJgdN8 hK+5Rs5CaSp2fkjhgVzg1fcFM5fB+y4= Received: from localhost (mailhub3.si.c-s.fr [172.26.127.67]) by localhost (Postfix) with ESMTP id 4WqDvL3VJlz9sSd; Thu, 22 Aug 2024 09:13:34 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from pegase2.c-s.fr ([172.26.127.65]) by localhost (pegase2.c-s.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id LjWkK4LACyCP; Thu, 22 Aug 2024 09:13:34 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase2.c-s.fr (Postfix) with ESMTP id 4WqDvL2LtBz9sSH; Thu, 22 Aug 2024 09:13:34 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 3F5F08B763; Thu, 22 Aug 2024 09:13:34 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id axVJmGry0EeY; Thu, 22 Aug 2024 09:13:34 +0200 (CEST) Received: from PO20335.idsi0.si.c-s.fr (PO16920.IDSI0.si.c-s.fr [192.168.232.181]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 149768B77D; Thu, 22 Aug 2024 09:13:33 +0200 (CEST) From: Christophe Leroy To: Michael Ellerman , Nicholas Piggin , Christophe Leroy , Naveen N Rao , Andy Lutomirski , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , "Theodore Ts'o" , "Jason A. Donenfeld" , Arnd Bergmann , Andrew Morton , Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , Vincenzo Frascino , Shuah Khan Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-arch@vger.kernel.org, linux-mm@kvack.org, linux-trace-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: [PATCH v2 11/17] powerpc/vdso: Wire up getrandom() vDSO implementation Date: Thu, 22 Aug 2024 09:13:19 +0200 Message-ID: <05fe169721b4f9bb4022f53d9b3f4759df5fcaaa.1724309198.git.christophe.leroy@csgroup.eu> X-Mailer: git-send-email 2.44.0 In-Reply-To: References: MIME-Version: 1.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1724310794; l=20465; i=christophe.leroy@csgroup.eu; s=20211009; h=from:subject:message-id; bh=H7LcEp3kqP72brhCVthUUodG25heFufofPtO/JekUP8=; b=UuIZ2n9goHRYTg5sowXDxSoKYXPBBMU411BahLQzTNqos6dzN/+Iixrnnux3toOEnibizp4sg AEVPNAeKIduBwJY0hBz29l3SJcmnHydAa/kU9GdGmK53z0JbqHvrbse X-Developer-Key: i=christophe.leroy@csgroup.eu; a=ed25519; pk=HIzTzUj91asvincQGOFx6+ZF5AoUuP9GdOtQChs7Mm0= X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: A284B1C0011 X-Stat-Signature: wwr53re9y4wb9bbjy9pqyy4g699wxmgg X-Rspam-User: X-HE-Tag: 1724310851-694657 X-HE-Meta: U2FsdGVkX18l4s6DrZnn9pQeabGMEPs1YxtbEJzaBR7bLI+i0A0dKaswoaDX4Y+PrBM5l6/yIHR2GwpKS/9wsNXmwUkXl3oy2xKRphHnh0Kij5wu4iHtmMGX3B9izNA3mTso5He695vZIF/CPSyhnlOnBhdYI7ynx/nKd1KHfnV2qp6grknNsN1VuJZfh25N9MAkplCqvZoXU1qkjCyzkmq6u9ao0kPZrMalaBpyFrVKvv62YKZh4ekVGM9YLXDjZ1MZ1H6foWGyarxrvQrMmG/qoUliEL8cPu25bo1rXu+mRk9NM2VRM50e/fgRiWcDXvfPH8MK2vdJNEWINtACJTeH2v0e6LesZvO6EG4a1lJGqW1kgwpXiRJt4+9tlWhwy286mgjOIGBQ4rZne4r7r5awF3AMxgekKOrMINKeZYJ6O9F7qyrCRIfWCEedGR44zK+HzLvnIllhdr6YN/9bEr3AXEaG8QEOD3pIUPuhu/sM594Kw/LidxtdO+CCbALvx2NQSXDobM0DkbAQMXL25Wq/gVQiuB1dseBnWiitLlJRtlSX+t1TpcQ8dCHMMwRb3nVgQldzXC5Oue8EqvfcT7zMtpq70Yv1Qv65qixu+NmWerb3/6xZ2c9Q+qweFtLz/5Bnz/77e1xwEP2FBseVklgWeyAT6oTzjZK2+Cf+SyMsoQ6it9o6Tz4llFMvLBKZJdTRzJ/bSLryIY93gDuZIeypGEPYpW31vDMd4SJaIP1kA86w7S6lTHaqpIjkSeChS5r02IWO+fSOArnVxM4xfdki6f815+tUkx0AYnbeSRNbLBdL3oHTcoIbv7Oyy7RhXNIxg5Zv4rjsPrNopwW0fBeT1ZNCrk9cZZD6Kiyl05yMV8XiGl3rTYSsFkuQXXVuP5dFl0Nnuk+1r/91vXFTECJghxOvBoVdnQiE2lf5SXho3jSFda607VWpbEmi6KQXY4PWisBXyvWtEhsVuTg SNkGSNnk ShLmlBg3XIaxgUop7eLaSvvblZi5764XzKpGcLRaYhtCVcQne9RwSMjP7Lb8Em7qKXGSvdARTaWckZsklT55h9aEXa4VoQwNkLPokkCYFxeaAHG/ftPgPxOniTurbsaB1zZiT4EreSNcht9DkePcALPUTxQqpFNXcdaTw X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: To be consistent with other VDSO functions, the function is called __kernel_getrandom() __arch_chacha20_blocks_nostack() fonction is implemented basically with 32 bits operations. It performs 4 QUARTERROUND operations in parallele. There are enough registers to avoid using the stack: On input: r3: output bytes r4: 32-byte key input r5: 8-byte counter input/output r6: number of 64-byte blocks to write to output During operation: r0: counter of blocks (initialised with r6) r4: Value '4' after key has been read, used for indexing r6-r13: key r14-r15: block counter r16-r31: chacha state At the end: r0, r6-r13: Zeroised r14-r31: Restored Performance on powerpc 885 (using kernel selftest): ~# ./vdso_test_getrandom bench-single vdso: 2500000 times in 7.897495392 seconds libc: 2500000 times in 56.091632232 seconds syscall: 2500000 times in 55.704851989 seconds Performance on powerpc 8321 (using kernel selftest): ~# ./vdso_test_getrandom bench-single vdso: 2500000 times in 2.017183250 seconds libc: 2500000 times in 13.088533630 seconds syscall: 2500000 times in 12.952458068 seconds Signed-off-by: Christophe Leroy --- arch/powerpc/Kconfig | 1 + arch/powerpc/include/asm/mman.h | 2 +- arch/powerpc/include/asm/vdso/getrandom.h | 67 +++++ arch/powerpc/include/asm/vdso/vsyscall.h | 6 + arch/powerpc/include/asm/vdso_datapage.h | 2 + arch/powerpc/kernel/asm-offsets.c | 1 + arch/powerpc/kernel/vdso/Makefile | 27 +- arch/powerpc/kernel/vdso/getrandom.S | 58 ++++ arch/powerpc/kernel/vdso/vdso32.lds.S | 1 + arch/powerpc/kernel/vdso/vdso64.lds.S | 1 + arch/powerpc/kernel/vdso/vgetrandom-chacha.S | 297 +++++++++++++++++++ arch/powerpc/kernel/vdso/vgetrandom.c | 14 + 12 files changed, 471 insertions(+), 6 deletions(-) create mode 100644 arch/powerpc/include/asm/vdso/getrandom.h create mode 100644 arch/powerpc/kernel/vdso/getrandom.S create mode 100644 arch/powerpc/kernel/vdso/vgetrandom-chacha.S create mode 100644 arch/powerpc/kernel/vdso/vgetrandom.c diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index d7b09b064a8a..b45452ac4a73 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig @@ -311,6 +311,7 @@ config PPC select SYSCTL_EXCEPTION_TRACE select THREAD_INFO_IN_TASK select TRACE_IRQFLAGS_SUPPORT + select VDSO_GETRANDOM # # Please keep this list sorted alphabetically. # diff --git a/arch/powerpc/include/asm/mman.h b/arch/powerpc/include/asm/mman.h index 17a77d47ed6d..42a51a993d94 100644 --- a/arch/powerpc/include/asm/mman.h +++ b/arch/powerpc/include/asm/mman.h @@ -6,7 +6,7 @@ #include -#ifdef CONFIG_PPC64 +#if defined(CONFIG_PPC64) && !defined(BUILD_VDSO) #include #include diff --git a/arch/powerpc/include/asm/vdso/getrandom.h b/arch/powerpc/include/asm/vdso/getrandom.h new file mode 100644 index 000000000000..b37e581b02cb --- /dev/null +++ b/arch/powerpc/include/asm/vdso/getrandom.h @@ -0,0 +1,67 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Copyright (C) 2024 Christophe Leroy , CS GROUP France + */ +#ifndef _ASM_POWERPC_VDSO_GETRANDOM_H +#define _ASM_POWERPC_VDSO_GETRANDOM_H + +#ifndef __ASSEMBLY__ + +static __always_inline int do_syscall_3(const unsigned long _r0, const unsigned long _r3, + const unsigned long _r4, const unsigned long _r5) +{ + register long r0 asm("r0") = _r0; + register unsigned long r3 asm("r3") = _r3; + register unsigned long r4 asm("r4") = _r4; + register unsigned long r5 asm("r5") = _r5; + register int ret asm ("r3"); + + asm volatile( + " sc\n" + " bns+ 1f\n" + " neg %0, %0\n" + "1:\n" + : "=r" (ret), "+r" (r4), "+r" (r5), "+r" (r0) + : "r" (r3) + : "memory", "r6", "r7", "r8", "r9", "r10", "r11", "r12", "cr0", "ctr"); + + return ret; +} + +/** + * getrandom_syscall - Invoke the getrandom() syscall. + * @buffer: Destination buffer to fill with random bytes. + * @len: Size of @buffer in bytes. + * @flags: Zero or more GRND_* flags. + * Returns: The number of bytes written to @buffer, or a negative value indicating an error. + */ +static __always_inline ssize_t getrandom_syscall(void *buffer, size_t len, unsigned int flags) +{ + return do_syscall_3(__NR_getrandom, (unsigned long)buffer, + (unsigned long)len, (unsigned long)flags); +} + +static __always_inline struct vdso_rng_data *__arch_get_vdso_rng_data(void) +{ + BUILD_BUG(); +} + +ssize_t __c_kernel_getrandom(void *buffer, size_t len, unsigned int flags, void *opaque_state, + size_t opaque_len, const struct vdso_rng_data *vd); + +/** + * __arch_chacha20_blocks_nostack - Generate ChaCha20 stream without using the stack. + * @dst_bytes: Destination buffer to hold @nblocks * 64 bytes of output. + * @key: 32-byte input key. + * @counter: 8-byte counter, read on input and updated on return. + * @nblocks: Number of blocks to generate. + * + * Generates a given positive number of blocks of ChaCha20 output with nonce=0, and does not write + * to any stack or memory outside of the parameters passed to it, in order to mitigate stack data + * leaking into forked child processes. + */ +void __arch_chacha20_blocks_nostack(u8 *dst_bytes, const u32 *key, u32 *counter, size_t nblocks); + +#endif /* !__ASSEMBLY__ */ + +#endif /* _ASM_POWERPC_VDSO_GETRANDOM_H */ diff --git a/arch/powerpc/include/asm/vdso/vsyscall.h b/arch/powerpc/include/asm/vdso/vsyscall.h index 48cf23f1e273..92f480d8cc6d 100644 --- a/arch/powerpc/include/asm/vdso/vsyscall.h +++ b/arch/powerpc/include/asm/vdso/vsyscall.h @@ -17,6 +17,12 @@ struct vdso_data *__arch_get_k_vdso_data(void) } #define __arch_get_k_vdso_data __arch_get_k_vdso_data +static __always_inline +struct vdso_rng_data *__arch_get_k_vdso_rng_data(void) +{ + return &vdso_data->rng_data; +} + /* The asm-generic header needs to be included after the definitions above */ #include diff --git a/arch/powerpc/include/asm/vdso_datapage.h b/arch/powerpc/include/asm/vdso_datapage.h index a585c8e538ff..e17500c5237e 100644 --- a/arch/powerpc/include/asm/vdso_datapage.h +++ b/arch/powerpc/include/asm/vdso_datapage.h @@ -83,6 +83,7 @@ struct vdso_arch_data { __u32 compat_syscall_map[SYSCALL_MAP_SIZE]; /* Map of compat syscalls */ struct vdso_data data[CS_BASES]; + struct vdso_rng_data rng_data; }; #else /* CONFIG_PPC64 */ @@ -95,6 +96,7 @@ struct vdso_arch_data { __u32 syscall_map[SYSCALL_MAP_SIZE]; /* Map of syscalls */ __u32 compat_syscall_map[0]; /* No compat syscalls on PPC32 */ struct vdso_data data[CS_BASES]; + struct vdso_rng_data rng_data; }; #endif /* CONFIG_PPC64 */ diff --git a/arch/powerpc/kernel/asm-offsets.c b/arch/powerpc/kernel/asm-offsets.c index 23733282de4d..eedb2e04c785 100644 --- a/arch/powerpc/kernel/asm-offsets.c +++ b/arch/powerpc/kernel/asm-offsets.c @@ -335,6 +335,7 @@ int main(void) /* datapage offsets for use by vdso */ OFFSET(VDSO_DATA_OFFSET, vdso_arch_data, data); + OFFSET(VDSO_RNG_DATA_OFFSET, vdso_arch_data, rng_data); OFFSET(CFG_TB_TICKS_PER_SEC, vdso_arch_data, tb_ticks_per_sec); #ifdef CONFIG_PPC64 OFFSET(CFG_ICACHE_BLOCKSZ, vdso_arch_data, icache_block_size); diff --git a/arch/powerpc/kernel/vdso/Makefile b/arch/powerpc/kernel/vdso/Makefile index cd4ed09864f0..9109677b2f39 100644 --- a/arch/powerpc/kernel/vdso/Makefile +++ b/arch/powerpc/kernel/vdso/Makefile @@ -8,6 +8,9 @@ include $(srctree)/lib/vdso/Makefile obj-vdso32 = sigtramp32-32.o gettimeofday-32.o datapage-32.o cacheflush-32.o note-32.o getcpu-32.o obj-vdso64 = sigtramp64-64.o gettimeofday-64.o datapage-64.o cacheflush-64.o note-64.o getcpu-64.o +obj-vdso32 += getrandom-32.o vgetrandom-chacha-32.o +obj-vdso64 += getrandom-64.o vgetrandom-chacha-64.o + ifneq ($(c-gettimeofday-y),) CFLAGS_vgettimeofday-32.o += -include $(c-gettimeofday-y) CFLAGS_REMOVE_vgettimeofday-32.o += -mcmodel=medium -mabi=elfv1 -mabi=elfv2 -mcall-aixdesc @@ -24,6 +27,16 @@ ifneq ($(c-gettimeofday-y),) CFLAGS_vgettimeofday-64.o += $(call cc-option, -ffixed-r30) endif +ifneq ($(c-getrandom-y),) + CFLAGS_vgetrandom-32.o += -include $(c-getrandom-y) + CFLAGS_REMOVE_vgetrandom-32.o += -mcmodel=medium -mabi=elfv1 -mabi=elfv2 -mcall-aixdesc + ifdef CONFIG_CC_IS_CLANG + CFLAGS_REMOVE_vgetrandom-32.o += -fno-stack-clash-protection + endif + CFLAGS_vgetrandom-64.o += -include $(c-getrandom-y) + CFLAGS_vgetrandom-64.o += $(call cc-option, -ffixed-r30) +endif + # Build rules ifdef CROSS32_COMPILE @@ -32,13 +45,13 @@ else VDSOCC := $(CC) endif -targets := $(obj-vdso32) vdso32.so.dbg vgettimeofday-32.o +targets := $(obj-vdso32) vdso32.so.dbg vgettimeofday-32.o vgetrandom-32.o targets += crtsavres-32.o obj-vdso32 := $(addprefix $(obj)/, $(obj-vdso32)) -targets += $(obj-vdso64) vdso64.so.dbg vgettimeofday-64.o +targets += $(obj-vdso64) vdso64.so.dbg vgettimeofday-64.o vgetrandom-64.o obj-vdso64 := $(addprefix $(obj)/, $(obj-vdso64)) -ccflags-y := -fno-common -fno-builtin +ccflags-y := -fno-common -fno-builtin -DBUILD_VDSO ccflags-y += $(DISABLE_LATENT_ENTROPY_PLUGIN) ccflags-y += $(call cc-option, -fno-stack-protector) ccflags-y += -DDISABLE_BRANCH_PROFILING @@ -64,9 +77,9 @@ targets += vdso64.lds CPPFLAGS_vdso64.lds += -P -C # link rule for the .so file, .lds has to be first -$(obj)/vdso32.so.dbg: $(obj)/vdso32.lds $(obj-vdso32) $(obj)/vgettimeofday-32.o $(obj)/crtsavres-32.o FORCE +$(obj)/vdso32.so.dbg: $(obj)/vdso32.lds $(obj-vdso32) $(obj)/vgettimeofday-32.o $(obj)/vgetrandom-32.o $(obj)/crtsavres-32.o FORCE $(call if_changed,vdso32ld_and_check) -$(obj)/vdso64.so.dbg: $(obj)/vdso64.lds $(obj-vdso64) $(obj)/vgettimeofday-64.o FORCE +$(obj)/vdso64.so.dbg: $(obj)/vdso64.lds $(obj-vdso64) $(obj)/vgettimeofday-64.o $(obj)/vgetrandom-64.o FORCE $(call if_changed,vdso64ld_and_check) # assembly rules for the .S files @@ -76,10 +89,14 @@ $(obj)/crtsavres-32.o: %-32.o: $(srctree)/arch/powerpc/lib/crtsavres.S FORCE $(call if_changed_dep,vdso32as) $(obj)/vgettimeofday-32.o: %-32.o: %.c FORCE $(call if_changed_dep,vdso32cc) +$(obj)/vgetrandom-32.o: %-32.o: %.c FORCE + $(call if_changed_dep,vdso32cc) $(obj-vdso64): %-64.o: %.S FORCE $(call if_changed_dep,vdso64as) $(obj)/vgettimeofday-64.o: %-64.o: %.c FORCE $(call if_changed_dep,cc_o_c) +$(obj)/vgetrandom-64.o: %-64.o: %.c FORCE + $(call if_changed_dep,cc_o_c) # Generate VDSO offsets using helper script gen-vdso32sym := $(src)/gen_vdso32_offsets.sh diff --git a/arch/powerpc/kernel/vdso/getrandom.S b/arch/powerpc/kernel/vdso/getrandom.S new file mode 100644 index 000000000000..a957cd2b2b03 --- /dev/null +++ b/arch/powerpc/kernel/vdso/getrandom.S @@ -0,0 +1,58 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* + * Userland implementation of getrandom() for processes + * for use in the vDSO + * + * Copyright (C) 2024 Christophe Leroy , CS GROUP France + */ +#include +#include +#include +#include +#include +#include + +/* + * The macro sets two stack frames, one for the caller and one for the callee + * because there are no requirement for the caller to set a stack frame when + * calling VDSO so it may have omitted to set one, especially on PPC64 + */ + +.macro cvdso_call funct + .cfi_startproc + PPC_STLU r1, -PPC_MIN_STKFRM(r1) + .cfi_adjust_cfa_offset PPC_MIN_STKFRM + mflr r0 + PPC_STLU r1, -PPC_MIN_STKFRM(r1) + .cfi_adjust_cfa_offset PPC_MIN_STKFRM + PPC_STL r0, PPC_MIN_STKFRM + PPC_LR_STKOFF(r1) + .cfi_rel_offset lr, PPC_MIN_STKFRM + PPC_LR_STKOFF +#ifdef __powerpc64__ + PPC_STL r2, PPC_MIN_STKFRM + STK_GOT(r1) + .cfi_rel_offset r2, PPC_MIN_STKFRM + STK_GOT +#endif + get_datapage r8 + addi r8, r8, VDSO_RNG_DATA_OFFSET + bl CFUNC(DOTSYM(\funct)) + PPC_LL r0, PPC_MIN_STKFRM + PPC_LR_STKOFF(r1) +#ifdef __powerpc64__ + PPC_LL r2, PPC_MIN_STKFRM + STK_GOT(r1) + .cfi_restore r2 +#endif + cmpwi r3, 0 + mtlr r0 + addi r1, r1, 2 * PPC_MIN_STKFRM + .cfi_restore lr + .cfi_def_cfa_offset 0 + crclr so + bgelr+ + crset so + neg r3, r3 + blr + .cfi_endproc +.endm + + .text +V_FUNCTION_BEGIN(__kernel_getrandom) + cvdso_call __c_kernel_getrandom +V_FUNCTION_END(__kernel_getrandom) diff --git a/arch/powerpc/kernel/vdso/vdso32.lds.S b/arch/powerpc/kernel/vdso/vdso32.lds.S index 8f57107000a2..7b41d5d256e8 100644 --- a/arch/powerpc/kernel/vdso/vdso32.lds.S +++ b/arch/powerpc/kernel/vdso/vdso32.lds.S @@ -130,6 +130,7 @@ VERSION #if defined(CONFIG_PPC64) || !defined(CONFIG_SMP) __kernel_getcpu; #endif + __kernel_getrandom; local: *; }; diff --git a/arch/powerpc/kernel/vdso/vdso64.lds.S b/arch/powerpc/kernel/vdso/vdso64.lds.S index 400819258c06..9481e4b892ed 100644 --- a/arch/powerpc/kernel/vdso/vdso64.lds.S +++ b/arch/powerpc/kernel/vdso/vdso64.lds.S @@ -123,6 +123,7 @@ VERSION __kernel_sigtramp_rt64; __kernel_getcpu; __kernel_time; + __kernel_getrandom; local: *; }; diff --git a/arch/powerpc/kernel/vdso/vgetrandom-chacha.S b/arch/powerpc/kernel/vdso/vgetrandom-chacha.S new file mode 100644 index 000000000000..5375bc5807e1 --- /dev/null +++ b/arch/powerpc/kernel/vdso/vgetrandom-chacha.S @@ -0,0 +1,297 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Copyright (C) 2024 Christophe Leroy , CS GROUP France + */ + +#include + +#include + +.macro quarterround4 a1 b1 c1 d1 a2 b2 c2 d2 a3 b3 c3 d3 a4 b4 c4 d4 + add \a1, \a1, \b1 + add \a2, \a2, \b2 + add \a3, \a3, \b3 + add \a4, \a4, \b4 + xor \d1, \d1, \a1 + xor \d2, \d2, \a2 + xor \d3, \d3, \a3 + xor \d4, \d4, \a4 + rotlwi \d1, \d1, 16 + rotlwi \d2, \d2, 16 + rotlwi \d3, \d3, 16 + rotlwi \d4, \d4, 16 + add \c1, \c1, \d1 + add \c2, \c2, \d2 + add \c3, \c3, \d3 + add \c4, \c4, \d4 + xor \b1, \b1, \c1 + xor \b2, \b2, \c2 + xor \b3, \b3, \c3 + xor \b4, \b4, \c4 + rotlwi \b1, \b1, 12 + rotlwi \b2, \b2, 12 + rotlwi \b3, \b3, 12 + rotlwi \b4, \b4, 12 + add \a1, \a1, \b1 + add \a2, \a2, \b2 + add \a3, \a3, \b3 + add \a4, \a4, \b4 + xor \d1, \d1, \a1 + xor \d2, \d2, \a2 + xor \d3, \d3, \a3 + xor \d4, \d4, \a4 + rotlwi \d1, \d1, 8 + rotlwi \d2, \d2, 8 + rotlwi \d3, \d3, 8 + rotlwi \d4, \d4, 8 + add \c1, \c1, \d1 + add \c2, \c2, \d2 + add \c3, \c3, \d3 + add \c4, \c4, \d4 + xor \b1, \b1, \c1 + xor \b2, \b2, \c2 + xor \b3, \b3, \c3 + xor \b4, \b4, \c4 + rotlwi \b1, \b1, 7 + rotlwi \b2, \b2, 7 + rotlwi \b3, \b3, 7 + rotlwi \b4, \b4, 7 +.endm + +#define QUARTERROUND4(a1,b1,c1,d1,a2,b2,c2,d2,a3,b3,c3,d3,a4,b4,c4,d4) \ + quarterround4 16+a1 16+b1 16+c1 16+d1 16+a2 16+b2 16+c2 16+d2 \ + 16+a3 16+b3 16+c3 16+d3 16+a4 16+b4 16+c4 16+d4 + +/* + * Very basic 32 bits implementation of ChaCha20. Produces a given positive number + * of blocks of output with a nonce of 0, taking an input key and 8-byte + * counter. Importantly does not spill to the stack. Its arguments are: + * + * r3: output bytes + * r4: 32-byte key input + * r5: 8-byte counter input/output + * r6: number of 64-byte blocks to write to output + * + * r0: counter of blocks (initialised with r6) + * r4: Value '4' after key has been read. + * r6-r13: key + * r14-r15 : counter + * r16-r31 : state + */ +SYM_FUNC_START(__arch_chacha20_blocks_nostack) +#ifdef __powerpc64__ + std r14,-144(r1) + std r15,-136(r1) + std r16,-128(r1) + std r17,-120(r1) + std r18,-112(r1) + std r19,-104(r1) + std r20,-96(r1) + std r21,-88(r1) + std r22,-80(r1) + std r23,-72(r1) + std r24,-64(r1) + std r25,-56(r1) + std r26,-48(r1) + std r27,-40(r1) + std r28,-32(r1) + std r29,-24(r1) + std r30,-16(r1) + std r31,-8(r1) +#else + stwu r1, -96(r1) +#if defined(CONFIG_CPU_LITTLE_ENDIAN) + stw r14,24(r1) + stw r15,28(r1) + stw r16,32(r1) + stw r17,36(r1) + stw r18,40(r1) + stw r19,44(r1) + stw r20,48(r1) + stw r21,52(r1) + stw r22,56(r1) + stw r23,60(r1) + stw r24,64(r1) + stw r25,68(r1) + stw r26,72(r1) + stw r27,76(r1) + stw r28,80(r1) + stw r29,84(r1) + stw r30,88(r1) + stw r31,92(r1) +#else + stmw r14, 24(r1) +#endif +#endif + mr r0, r6 + + li r31, 4 + + LWZX_LE r6, 0, r4 + LWZX_LE r7, r31, r4 + addi r4, r4, 8 + LWZX_LE r8, 0, r4 + LWZX_LE r9, r31, r4 + addi r4, r4, 8 + LWZX_LE r10, 0, r4 + LWZX_LE r11, r31, r4 + addi r4, r4, 8 + LWZX_LE r12, 0, r4 + LWZX_LE r13, r31, r4 + + li r4, 4 + + LWZX_LE r14, 0, r5 + LWZX_LE r15, r4, r5 +#ifdef __powerpc64__ + rldimi r14, r15, 32, 0 +#endif +.Lblock: + li r31, 10 + + lis r16, 0x6170 + lis r17, 0x3320 + lis r18, 0x7962 + lis r19, 0x6b20 + addi r16, r16, 0x7865 + addi r17, r17, 0x646e + addi r18, r18, 0x2d32 + addi r19, r19, 0x6574 + + mtctr r31 + + mr r20, r6 + mr r21, r7 + mr r22, r8 + mr r23, r9 + mr r24, r10 + mr r25, r11 + mr r26, r12 + mr r27, r13 + + mr r28, r14 + mr r29, r15 + li r30, 0 + li r31, 0 + +.Lpermute: + QUARTERROUND4( 0, 4, 8,12, 1, 5, 9,13, 2, 6,10,14, 3, 7,11,15) + QUARTERROUND4( 0, 5,10,15, 1, 6,11,12, 2, 7, 8,13, 3, 4, 9,14) + + bdnz .Lpermute + + addis r16, r16, 0x6170 + addis r17, r17, 0x3320 + addis r18, r18, 0x7962 + addis r19, r19, 0x6b20 + addi r16, r16, 0x7865 + addi r17, r17, 0x646e + addi r18, r18, 0x2d32 + addi r19, r19, 0x6574 + + add r20, r20, r6 + add r21, r21, r7 + add r22, r22, r8 + add r23, r23, r9 + add r24, r24, r10 + add r25, r25, r11 + add r26, r26, r12 + add r27, r27, r13 + + add r28, r28, r14 + add r29, r29, r15 + + STWX_LE r16, 0, r3 + STWX_LE r17, r4, r3 + addi r3, r3, 8 + STWX_LE r18, 0, r3 + STWX_LE r19, r4, r3 + addi r3, r3, 8 + STWX_LE r20, 0, r3 + STWX_LE r21, r4, r3 + addi r3, r3, 8 + STWX_LE r22, 0, r3 + STWX_LE r23, r4, r3 + addi r3, r3, 8 + STWX_LE r24, 0, r3 + STWX_LE r25, r4, r3 + addi r3, r3, 8 + STWX_LE r26, 0, r3 + STWX_LE r27, r4, r3 + addi r3, r3, 8 + STWX_LE r28, 0, r3 + STWX_LE r29, r4, r3 + addi r3, r3, 8 + STWX_LE r30, 0, r3 + STWX_LE r31, r4, r3 + addi r3, r3, 8 + +#ifdef __powerpc64__ + addi r14, r14, 1 + srdi r15, r14, 32 +#else + addic r14, r14, 1 + addze r15, r15 +#endif + + subic. r0, r0, 1 /* subi. can't use r0 as source */ + bne .Lblock + + STWX_LE r14, 0, r5 + STWX_LE r15, r4, r5 + + li r6, 0 + li r7, 0 + li r8, 0 + li r9, 0 + li r10, 0 + li r11, 0 + li r12, 0 + li r13, 0 + +#ifdef __powerpc64__ + ld r14,-144(r1) + ld r15,-136(r1) + ld r16,-128(r1) + ld r17,-120(r1) + ld r18,-112(r1) + ld r19,-104(r1) + ld r20,-96(r1) + ld r21,-88(r1) + ld r22,-80(r1) + ld r23,-72(r1) + ld r24,-64(r1) + ld r25,-56(r1) + ld r26,-48(r1) + ld r27,-40(r1) + ld r28,-32(r1) + ld r29,-24(r1) + ld r30,-16(r1) + ld r31,-8(r1) +#else +#if defined(CONFIG_CPU_LITTLE_ENDIAN) + lwz r14,24(r1) + lwz r15,28(r1) + lwz r16,32(r1) + lwz r17,36(r1) + lwz r18,40(r1) + lwz r19,44(r1) + lwz r20,48(r1) + lwz r21,52(r1) + lwz r22,56(r1) + lwz r23,60(r1) + lwz r24,64(r1) + lwz r25,68(r1) + lwz r26,72(r1) + lwz r27,76(r1) + lwz r28,80(r1) + lwz r29,84(r1) + lwz r30,88(r1) + lwz r31,92(r1) +#else + lmw r14, 24(r1) +#endif + addi r1, r1, 96 +#endif + blr +SYM_FUNC_END(__arch_chacha20_blocks_nostack) diff --git a/arch/powerpc/kernel/vdso/vgetrandom.c b/arch/powerpc/kernel/vdso/vgetrandom.c new file mode 100644 index 000000000000..5f855d45fb7b --- /dev/null +++ b/arch/powerpc/kernel/vdso/vgetrandom.c @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Powerpc userspace implementation of getrandom() + * + * Copyright (C) 2024 Christophe Leroy , CS GROUP France + */ +#include +#include + +ssize_t __c_kernel_getrandom(void *buffer, size_t len, unsigned int flags, void *opaque_state, + size_t opaque_len, const struct vdso_rng_data *vd) +{ + return __cvdso_getrandom_data(vd, buffer, len, flags, opaque_state, opaque_len); +} From patchwork Thu Aug 22 07:13:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 13772830 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id D4245C3DA4A for ; Thu, 22 Aug 2024 07:14:34 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DFFCD8000E; Thu, 22 Aug 2024 03:14:28 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D890380009; Thu, 22 Aug 2024 03:14:28 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BDAF98000E; Thu, 22 Aug 2024 03:14:28 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 98A0280009 for ; Thu, 22 Aug 2024 03:14:28 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 5700FC130F for ; Thu, 22 Aug 2024 07:14:28 +0000 (UTC) X-FDA: 82479018216.25.33B1816 Received: from pegase2.c-s.fr (pegase2.c-s.fr [93.17.235.10]) by imf30.hostedemail.com (Postfix) with ESMTP id 4AE8080004 for ; Thu, 22 Aug 2024 07:14:26 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=csgroup.eu; spf=pass (imf30.hostedemail.com: domain of christophe.leroy@csgroup.eu designates 93.17.235.10 as permitted sender) smtp.mailfrom=christophe.leroy@csgroup.eu ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1724310806; a=rsa-sha256; cv=none; b=ghHszY35U1zNUcUf8cFt7/FE9XWboD/4SAL/iMcSNdKkcIvqR+5NmYYSm7PkePkshmSO8I PVEuFBH9n590/TPsPLFVGPyrihPLKcsKFdbiq1dqEN1THFo42d0Y4JkG4IfNFgFoOqFhnS tFtjkCf7zsC1KrJTf4/7RTuAFO8tAA0= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=csgroup.eu; spf=pass (imf30.hostedemail.com: domain of christophe.leroy@csgroup.eu designates 93.17.235.10 as permitted sender) smtp.mailfrom=christophe.leroy@csgroup.eu ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1724310806; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=PrP1BjEZTK/Lz4R61qlKovMdIhf9B8wwWxW6ci28Ec8=; b=oFeVAUy/cfX5gjMOcDSH5FJ/q9hpn46qPodeYJkDN+aXr8aqpZzl8ZqEqhi+NDVZzz0Ipf KP9ASK+lyKPict5/Bk5Td+pD9/emFCAsgmwNnaeheVXhTZ9wYsmQRxYHSKdR51FnDE3KD3 jyuayvKQGYVM5BmEMid1MKr/eZDmwZw= Received: from localhost (mailhub3.si.c-s.fr [172.26.127.67]) by localhost (Postfix) with ESMTP id 4WqDvM3bmJz9sSf; Thu, 22 Aug 2024 09:13:35 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from pegase2.c-s.fr ([172.26.127.65]) by localhost (pegase2.c-s.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 3zbc0PqHC6BM; Thu, 22 Aug 2024 09:13:35 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase2.c-s.fr (Postfix) with ESMTP id 4WqDvM2pDGz9sSH; Thu, 22 Aug 2024 09:13:35 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 4E20F8B763; Thu, 22 Aug 2024 09:13:35 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id Bo4ZQu0kswTZ; Thu, 22 Aug 2024 09:13:35 +0200 (CEST) Received: from PO20335.idsi0.si.c-s.fr (PO16920.IDSI0.si.c-s.fr [192.168.232.181]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 414F98B77E; Thu, 22 Aug 2024 09:13:34 +0200 (CEST) From: Christophe Leroy To: Michael Ellerman , Nicholas Piggin , Christophe Leroy , Naveen N Rao , Andy Lutomirski , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , "Theodore Ts'o" , "Jason A. Donenfeld" , Arnd Bergmann , Andrew Morton , Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , Vincenzo Frascino , Shuah Khan Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-arch@vger.kernel.org, linux-mm@kvack.org, linux-trace-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: [PATCH v2 12/17] selftests: vdso: Fix powerpc64 vdso_config Date: Thu, 22 Aug 2024 09:13:20 +0200 Message-ID: <88431f094c8f24774a19edd345bd4dc0d8cd796a.1724309198.git.christophe.leroy@csgroup.eu> X-Mailer: git-send-email 2.44.0 In-Reply-To: References: MIME-Version: 1.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1724310794; l=1023; i=christophe.leroy@csgroup.eu; s=20211009; h=from:subject:message-id; bh=o2dSOswubvHE1lTeEuhUcTWvANfg8RAkUzFIjloHUmw=; b=wG3pcxgAF1nbLi883TF7wQztwOLE/+CaiSBYH0QtsYn5HKn8tYwGt+5GosKqV1s5WX1rcxSTR /yezMLtor2zCaWboyDvcqO9YS6XW1oWXuQjs1rrvQU5ZvPpo08igpT8 X-Developer-Key: i=christophe.leroy@csgroup.eu; a=ed25519; pk=HIzTzUj91asvincQGOFx6+ZF5AoUuP9GdOtQChs7Mm0= X-Rspamd-Queue-Id: 4AE8080004 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: ho8qrbyr46ja38a3szp9y9biuefrd3eh X-HE-Tag: 1724310866-365509 X-HE-Meta: U2FsdGVkX19ofHSIo4VISEarr5dCgv1WWW1zQL3jkYrwpDlSRfMjcHu1X5s/H+L1EJKtjIqUx8TKOp7CD2mrpR7t/eO6HvW2zwyFqpfZoFMeuKHNFN7UP4lRDEXXPrRVbQzJ6ld4nVsGwmgxRCVIn2iHIR+7lA+jyk1sZPsYTE5eApww9qHa8EOLPlflSWzPZ4oq9bceaJrCWe5L1wpl3aDwpv1T6R8us/e9l3bYcmT1cv9eBaGTKpNLqFJaBQWoJTqEk8qCL7FE2hgW17reGXXF9nvjIZ0Ml62vmO9YZPhktsyk4e9jGfwF8zhuHQ9IXJ9lY7okilRmKrOZhcl98jw/UY/xovRop/rSCrpj+fgVgYz6Owj9jp26E3LCEQaxvskw1MSmb84hZXQZ2fD4J8MWE2U4GGt/UoHV+XwRQ5niU7d7yKyVn3wjSc6F8NVv3NAJ3qB2/3OgxPQmVLOy6TVg76luClFofLQEMFMRdpGY7tRb0iCEs2UforhW6nzPHmnSKWWWbdNuaTi4kjE2VzImUJzanuxZvgVHudSaoDYCjmAY9+eFmu66lEom2qA2rwnPy5u+ocRXbhQ7cSSdDnb5a3IEecUJO08rZzAXPuLMBRn7lpDlEDvoa4uvkmla5UzwkRFmnROK4ogTZXkG8dXgNSDqmgU0D845iJaYMPWKZ+SYab/OAzAF5fdwCT1CErnmmMT2fOt99JH76ClXom0i1ergoqG7zeuOXoqD1pk43ZlOjaLy6rRJRvbflTswU8z1aOwf89GIEC6ckQlFBcvWfQt/VDI8wd22IH9ytWYR2MzMXasnsLoJxNaZ+6jg39+wtJeYpnGZC+IFMZpBDoYhnAKAJOfYCpF7nzOxNrW5qwOtgEXXl2Wo1Spz+kTwimW78x7Qb22MaRU9wnX3DNZCaZeasEKfclVqwUZ2xRKiBQ2wiGa9Eup+C110TJBT+Rp3Dt2sc/IjAlz4baM HD6zzx9b ufM76qamIf8ONRXnP8y/u5nhaz9Zxr7XjpKvTfnPjS2QpfWbBHKIFep7ochvJX+DZ5m5MxardJ8EeGuYeJ0jc4Jltgu/qYXE2hTgHsHIxLiT417Z2zss4FXrFm/C8/1MpEybLNsy3th8WH5T4v9ZRV+dFHWYms8wzfFvqw134mRYj6w0= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: __powerpc__ is also defined on powerpc64 so __powerpc64__ needs to be checked first. Fixes: 693f5ca08ca0 ("kselftest: Extend vDSO selftest") Signed-off-by: Christophe Leroy --- tools/testing/selftests/vDSO/vdso_config.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/testing/selftests/vDSO/vdso_config.h b/tools/testing/selftests/vDSO/vdso_config.h index 7b543e7f04d7..00bfed6e4922 100644 --- a/tools/testing/selftests/vDSO/vdso_config.h +++ b/tools/testing/selftests/vDSO/vdso_config.h @@ -18,13 +18,13 @@ #elif defined(__aarch64__) #define VDSO_VERSION 3 #define VDSO_NAMES 0 -#elif defined(__powerpc__) +#elif defined(__powerpc64__) #define VDSO_VERSION 1 #define VDSO_NAMES 0 -#define VDSO_32BIT 1 -#elif defined(__powerpc64__) +#elif defined(__powerpc__) #define VDSO_VERSION 1 #define VDSO_NAMES 0 +#define VDSO_32BIT 1 #elif defined (__s390__) #define VDSO_VERSION 2 #define VDSO_NAMES 0 From patchwork Thu Aug 22 07:13:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 13772834 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id CBFF8C3DA4A for ; Thu, 22 Aug 2024 07:14:49 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8839B80010; Thu, 22 Aug 2024 03:14:43 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8308580012; Thu, 22 Aug 2024 03:14:43 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6349280010; Thu, 22 Aug 2024 03:14:43 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 3C82680012 for ; Thu, 22 Aug 2024 03:14:43 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id F123012140F for ; Thu, 22 Aug 2024 07:14:42 +0000 (UTC) X-FDA: 82479018804.15.9786FC9 Received: from pegase2.c-s.fr (pegase2.c-s.fr [93.17.235.10]) by imf13.hostedemail.com (Postfix) with ESMTP id BE79120016 for ; Thu, 22 Aug 2024 07:14:40 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=none; spf=pass (imf13.hostedemail.com: domain of christophe.leroy@csgroup.eu designates 93.17.235.10 as permitted sender) smtp.mailfrom=christophe.leroy@csgroup.eu; dmarc=pass (policy=quarantine) header.from=csgroup.eu ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1724310864; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=loXoZn2g6FquTJVnjqsw92ocF3Tl8V5nyKWfkRagQWw=; b=8UaIpyzskWgc/y2EfiiMRUVJW2GcSx24IInEOLqt5Z5LecOQn+EQdnJR8Edgp0sc95WCgP DpKjVUk09Z1KquKmKnAuxG0jtEPSEOvFJ3F1G1HKlH5c+gmeps+/09VGegN7xBHax6L5PA 8uwz18J/zxeFNK/HWjv3cQ6knks64yQ= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=none; spf=pass (imf13.hostedemail.com: domain of christophe.leroy@csgroup.eu designates 93.17.235.10 as permitted sender) smtp.mailfrom=christophe.leroy@csgroup.eu; dmarc=pass (policy=quarantine) header.from=csgroup.eu ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1724310864; a=rsa-sha256; cv=none; b=GUr7qJ++fGOVJjtl8cDm1bqIi2Rb8VWfx2YppbjS+2hcdRBo29cvkRw6Jak/9UbapsVqbl GrWQKYafWbtFoXYeGE+oi+aYhAETTVOTuyRXjBbyYtn7pBTTq8GhB8FbdvScepTCbPK02L Exud4gTXn9LhhOqnDtXRHUt85xTLKLY= Received: from localhost (mailhub3.si.c-s.fr [172.26.127.67]) by localhost (Postfix) with ESMTP id 4WqDvN3xV2z9sT0; Thu, 22 Aug 2024 09:13:36 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from pegase2.c-s.fr ([172.26.127.65]) by localhost (pegase2.c-s.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id x1TLfFxSNw26; Thu, 22 Aug 2024 09:13:36 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase2.c-s.fr (Postfix) with ESMTP id 4WqDvN33L7z9sSy; Thu, 22 Aug 2024 09:13:36 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 581FF8B77E; Thu, 22 Aug 2024 09:13:36 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id 7wUGeZI3I6WA; Thu, 22 Aug 2024 09:13:36 +0200 (CEST) Received: from PO20335.idsi0.si.c-s.fr (PO16920.IDSI0.si.c-s.fr [192.168.232.181]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 4FFC78B77D; Thu, 22 Aug 2024 09:13:35 +0200 (CEST) From: Christophe Leroy To: Michael Ellerman , Nicholas Piggin , Christophe Leroy , Naveen N Rao , Andy Lutomirski , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , "Theodore Ts'o" , "Jason A. Donenfeld" , Arnd Bergmann , Andrew Morton , Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , Vincenzo Frascino , Shuah Khan Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-arch@vger.kernel.org, linux-mm@kvack.org, linux-trace-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: [PATCH v2 13/17] selftests: vdso: Don't hard-code location of vDSO sources Date: Thu, 22 Aug 2024 09:13:21 +0200 Message-ID: X-Mailer: git-send-email 2.44.0 In-Reply-To: References: MIME-Version: 1.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1724310794; l=1792; i=christophe.leroy@csgroup.eu; s=20211009; h=from:subject:message-id; bh=5h3KLlzEytDPiSde0fgrOqrQ+VHGwL8x+UTMWMemKqA=; b=52c+474v8h2re77BqeSjmwGjfxeWNjA9JNg5DuQ62lSQwt3zIwXGDzTZYrzUEJRgw6cHNO+Iw rQyliGCUE71CPHt6eiUIZGbf2GQ3Zpk6iL8sVydNdOYcLKgGcfx+LkJ X-Developer-Key: i=christophe.leroy@csgroup.eu; a=ed25519; pk=HIzTzUj91asvincQGOFx6+ZF5AoUuP9GdOtQChs7Mm0= X-Rspam-User: X-Stat-Signature: 6bmy7f9z585hnfgdwp9eci4ybtb6kz56 X-Rspamd-Queue-Id: BE79120016 X-Rspamd-Server: rspam11 X-HE-Tag: 1724310880-542024 X-HE-Meta: U2FsdGVkX1/9IFfgz8NIlJ+H1vuF8N2ZIoMn81oGvGMPTi9W8HSu+FAZsoqRI24mXgqAFdEc1L2Hh1Oi6ArUzzczmGK1uVVX29UFFzpJjRFZ+U3wrI4VpNbb6T1KVrqaEdIYl0Emim9bRDph7+f8PSW2BijM2yv/cDhf8/nBj1IwmkpY7nNP3HQcobiUMIVPhqtqMX+0/UHplc2XkF1NM2ohLO5pcm3eW5LMJx/wGJ7YRdCowYEoMek2iB8WUQLOMv8Zc8kBxcXKK9pQjdaXduFffLYvX0duXdIN3GQMV/uQon/jgz9cpAeeBeCU5Tyed82Tz/uhPflY8Y6qJddglYthIK8rFsgwrI04BdnXwUpp9B+daNSHo1sAJ0vnL2SIl+dT24ui7rl2DSnua+XQUdeB1MOXiYWBFu7ykE3Yac0jwp6e9t8GdRfHI1iECWBOFfLm4+k6v3RRoEXWHhjrhqnCeh1joR0HhR6N7DoU14VOaIaF36ew/qCvmXaJvH1w6vyND5CRFVJw2XXEG30a2l17rrDrBH4VRrmdXPB4MUVF3X5cYg2nWxCOSrPOt/tzzvVRij3drSB7LRPM5Nspt26BZ50kaVOmZkYo0agp7LICUpEJDcJf+4JuL26OliIIN+4HC3So8IOSL1gEpwOmveaUz2LHCKagTXvrbpOSsNGmCHFXrNUzhSSsfEY5S+REIIiMZxcz5gHfPAn7lDvwd/JCJuXW98TpLl7/Wx6SDk9/Rrl3m6j/4lE7FzOymr99UY6J7wtz2xEhI1zM9xq72pS/ggIgdce0zwuB57ktNUdajK6heJOf+lTuryJUX+B6A9jr+muZmo9AHNSiu0KYudFEknCEJDgRuS8/FVJeJnb0PqZOSLBVPaGVOyRKaQAm/c69/AiJA/DBkvsqXjgvR/CX9aq9lGon53U9k8uvVB9lQsD8G2Vp8R13f9tSBdJf9SvXl8G9nZiOZoDAHbO eR+KtuvR oKg0N52yRmjZbt+osxAlDYCnCpWROl8S/svr9LwOLotDX9IXDkWNE8KBRgtQYgtRxwu0u7FlT5tKkzQzCMD/24nIyytoFq3lgXaK+Muz17CQelc+hZslYfQ/DsyzlMY4csoux X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Architectures use different location for vDSO sources: arch/mips/vdso arch/sparc/vdso arch/arm64/kernel/vdso arch/riscv/kernel/vdso arch/csky/kernel/vdso arch/x86/um/vdso arch/x86/entry/vdso arch/powerpc/kernel/vdso arch/arm/vdso arch/loongarch/vdso Don't hard-code vdso sources location in selftest Makefile, instead create a vdso/ symbolic link in tools/arch/$arch/ and update Makefile accordingly. Signed-off-by: Christophe Leroy --- tools/arch/x86/vdso | 1 + tools/testing/selftests/vDSO/Makefile | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 120000 tools/arch/x86/vdso diff --git a/tools/arch/x86/vdso b/tools/arch/x86/vdso new file mode 120000 index 000000000000..7eb962fd3454 --- /dev/null +++ b/tools/arch/x86/vdso @@ -0,0 +1 @@ +../../../arch/x86/entry/vdso/ \ No newline at end of file diff --git a/tools/testing/selftests/vDSO/Makefile b/tools/testing/selftests/vDSO/Makefile index 3de8e7e052ae..c9a819cacbf2 100644 --- a/tools/testing/selftests/vDSO/Makefile +++ b/tools/testing/selftests/vDSO/Makefile @@ -40,7 +40,7 @@ $(OUTPUT)/vdso_test_getrandom: parse_vdso.c $(OUTPUT)/vdso_test_getrandom: CFLAGS += -isystem $(top_srcdir)/tools/include \ -isystem $(top_srcdir)/include/uapi -$(OUTPUT)/vdso_test_chacha: $(top_srcdir)/arch/$(ARCH)/entry/vdso/vgetrandom-chacha.S +$(OUTPUT)/vdso_test_chacha: $(top_srcdir)/tools/arch/$(ARCH)/vdso/vgetrandom-chacha.S $(OUTPUT)/vdso_test_chacha: CFLAGS += -idirafter $(top_srcdir)/tools/include \ -isystem $(top_srcdir)/arch/$(ARCH)/include \ -isystem $(top_srcdir)/include \ From patchwork Thu Aug 22 07:13:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 13772837 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id D09F2C3DA4A for ; Thu, 22 Aug 2024 07:14:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D3C8880014; Thu, 22 Aug 2024 03:14:57 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C9F1380012; Thu, 22 Aug 2024 03:14:57 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id ACB8C80014; Thu, 22 Aug 2024 03:14:57 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 855D280012 for ; Thu, 22 Aug 2024 03:14:57 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 4F6EF1613A4 for ; Thu, 22 Aug 2024 07:14:57 +0000 (UTC) X-FDA: 82479019434.20.3B8667B Received: from pegase2.c-s.fr (pegase2.c-s.fr [93.17.235.10]) by imf04.hostedemail.com (Postfix) with ESMTP id 3424E40019 for ; Thu, 22 Aug 2024 07:14:54 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=csgroup.eu; spf=pass (imf04.hostedemail.com: domain of christophe.leroy@csgroup.eu designates 93.17.235.10 as permitted sender) smtp.mailfrom=christophe.leroy@csgroup.eu ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1724310805; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=X9eQxluLDiPLeH9ltVew3qYuePl2JQJJyf/L9RkRD5I=; b=JtI2rUbO/ha8ZJMZU3Mz+xVClbbZtLudiq5L+nMvMQygslUbcxDjd8rmSBGEb77DRcOvvi o3s9YiWXchAIA/pPI3kOY0Jb27Ujthr1rM4NvPgGsxleImGmf9z0L0/hoPkKwWCli7hsMx K/ZBVxvIPypLSxi+BcIAbB+n0wcnyso= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1724310805; a=rsa-sha256; cv=none; b=nHEAo09Jw00Exs/or2K8ZOSzJDHeBECJO2BaJ9gxgAYSDDpPhBK4Hq47svH0jxjNrMg4vV +9gMo44PJiS5S5QpvgE2NeK+94WrUAj8vUyzD+VacUrvSw9mU7OzlT9bJBJQdFafUozbak 8JL5NxPMm5P7FEfkBLACf3tI3OgeXck= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=csgroup.eu; spf=pass (imf04.hostedemail.com: domain of christophe.leroy@csgroup.eu designates 93.17.235.10 as permitted sender) smtp.mailfrom=christophe.leroy@csgroup.eu Received: from localhost (mailhub3.si.c-s.fr [172.26.127.67]) by localhost (Postfix) with ESMTP id 4WqDvP4Td1z9sT1; Thu, 22 Aug 2024 09:13:37 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from pegase2.c-s.fr ([172.26.127.65]) by localhost (pegase2.c-s.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 09leES4wh1IT; Thu, 22 Aug 2024 09:13:37 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase2.c-s.fr (Postfix) with ESMTP id 4WqDvP3ZyDz9sSy; Thu, 22 Aug 2024 09:13:37 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 677238B77E; Thu, 22 Aug 2024 09:13:37 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id RlobwgkX-7ZS; Thu, 22 Aug 2024 09:13:37 +0200 (CEST) Received: from PO20335.idsi0.si.c-s.fr (PO16920.IDSI0.si.c-s.fr [192.168.232.181]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 57A568B763; Thu, 22 Aug 2024 09:13:36 +0200 (CEST) From: Christophe Leroy To: Michael Ellerman , Nicholas Piggin , Christophe Leroy , Naveen N Rao , Andy Lutomirski , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , "Theodore Ts'o" , "Jason A. Donenfeld" , Arnd Bergmann , Andrew Morton , Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , Vincenzo Frascino , Shuah Khan Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-arch@vger.kernel.org, linux-mm@kvack.org, linux-trace-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: [PATCH v2 14/17] selftests: vdso: Make test_vdso_getrandom look for the right vDSO function Date: Thu, 22 Aug 2024 09:13:22 +0200 Message-ID: <04d1de23a2ff14e2709edd8b75e27b81d703bc57.1724309198.git.christophe.leroy@csgroup.eu> X-Mailer: git-send-email 2.44.0 In-Reply-To: References: MIME-Version: 1.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1724310794; l=2750; i=christophe.leroy@csgroup.eu; s=20211009; h=from:subject:message-id; bh=XmrEpCsMzE9+kz6qQUG5kHUCZS2KlgNDovuZDzi1tW8=; b=OQ+cTCj7yV9Xo8q0GnJliOhCQVzFZ+ijay4M06NYygaEBLMtMi7pCe4Q4I/Ci+O/oMyq9e4UF iUvY6HCYUMlDrWIesk4eenuoXEY5x27+R68IZY9KDwMCYTEXHBIsX+v X-Developer-Key: i=christophe.leroy@csgroup.eu; a=ed25519; pk=HIzTzUj91asvincQGOFx6+ZF5AoUuP9GdOtQChs7Mm0= X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 3424E40019 X-Stat-Signature: kkquxt8zgwea5tcsk9adgjr4o1p11e13 X-Rspam-User: X-HE-Tag: 1724310894-138110 X-HE-Meta: U2FsdGVkX1/kd0PuWmIDHPLJlunbPoCjFFA85NDbvL41h85FXv4h6p5pfB4+fK0PTXU/ma+B1CNn3ci94IzbUl9kOJE4ppZzpEyssg/JU+ZRsIajTVzIvMyDERhHBzwziAbPHfg0YTNWFlPOnVkkaNSw2vgbVZzg5pUKDvgQg68THYl7bauHbeatthXiOMdxbyh4w6hiJwoGYz6JW+fOIjvUQlHNhWdVSJ649dkiyWPWLK4WmfaNdmCd/ey3d3y69Ppyg/kzu9NAjo6P+cPd9eDzkGVeAEwrV0kgDvEtTkYX6RuSXs6wBRe/rijDBWQLVUJF770j4IcjwjoIraxVfkUegzUD10N+Xs5KBWcX9HMZdxTFj3hrbjWB7rKFLmxUPKqnrSTpLjhNuMZiL+vIs0GWrVWwkLpUuvzOYFLeZqeu9vrN/0dPzxd4M6OpzmwIq3yd0o6zLBe3Av3SOL7vefeIisl+KviDvkQw3ztmJiUpm7/D25vkqNb7RqovnvUD8Kep14m17q1/G+LGPw/yBMhCfJkTBU3nbJCBbYKFfXYGv1tRp16LwCyNvTPm8e08VAO0GK99qVZTqY/MSxdvzioXePR3rvtjbfHK9OE6DAuk0CWpY8F/rI6Ka0y/z4XvExmFWTDTxZaAvrnWhkUhkrPtg6vUd/KHGlZS11z+SamDbD7Qg9YKYGA3q7+KSKzl4OBqqb/8VF6Lbl9Rtmv9ZOU/VZNYTffA9FCovMa5rhse0jBJtrCc5LZLYJpuVnlUogr7UGB/d9OjwvpEINIeI7NJXbJtmYC3td1o9YwPvJDkcpE+nPRY6N9NyLqmn8jU50pJH7NQH6FjlVMHuml+absa/Ny3hP/o65V4M+AiHHPxFvrHGH3Vaw5Ehr875XDe0A2pLKhhYSvtnH7onHtYvH6ff3SHxuMp1biIvLU2EhhlDO5yzSWgfNhA7uFBNv1ex+R7vgRdg2cZMx4O1un +pzFg2bB 2fXquQDWCbr4IuEsjGncnBriFymGUtXU0ylAZG9VR1dIj77WJH8nuikF+XKXgQaEZaq+oi75oWEhlRAMOCM1Ti1K9pOF5f4dG1jrINZt35KV7cUSD3PGBTY24bZbglY0UNgkBSPN2UPaJSLsd8CtfHY6xvatUg1i8HSiDzdIV8kLPLnU= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Don't hard-code x86 specific names, use vdso_config definitions to find the correct function matching the architecture. Add random VDSO function names in names[][]. Remove the #ifdef CONFIG_VDSO32, having the name there all the time is harmless and guaranties a steady index for following strings. Signed-off-by: Christophe Leroy --- tools/testing/selftests/vDSO/vdso_config.h | 8 +++----- tools/testing/selftests/vDSO/vdso_test_getrandom.c | 8 ++++++-- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/tools/testing/selftests/vDSO/vdso_config.h b/tools/testing/selftests/vDSO/vdso_config.h index 00bfed6e4922..740ce8c98d2e 100644 --- a/tools/testing/selftests/vDSO/vdso_config.h +++ b/tools/testing/selftests/vDSO/vdso_config.h @@ -68,16 +68,15 @@ static const char *versions[7] = { "LINUX_5.10" }; -static const char *names[2][6] = { +static const char *names[2][7] = { { "__kernel_gettimeofday", "__kernel_clock_gettime", "__kernel_time", "__kernel_clock_getres", "__kernel_getcpu", -#if defined(VDSO_32BIT) "__kernel_clock_gettime64", -#endif + "__kernel_getrandom", }, { "__vdso_gettimeofday", @@ -85,9 +84,8 @@ static const char *names[2][6] = { "__vdso_time", "__vdso_clock_getres", "__vdso_getcpu", -#if defined(VDSO_32BIT) "__vdso_clock_gettime64", -#endif + "__vdso_getrandom", }, }; diff --git a/tools/testing/selftests/vDSO/vdso_test_getrandom.c b/tools/testing/selftests/vDSO/vdso_test_getrandom.c index 05122425a873..02bcffc23e0c 100644 --- a/tools/testing/selftests/vDSO/vdso_test_getrandom.c +++ b/tools/testing/selftests/vDSO/vdso_test_getrandom.c @@ -21,6 +21,7 @@ #include "../kselftest.h" #include "parse_vdso.h" +#include "vdso_config.h" #ifndef timespecsub #define timespecsub(tsp, usp, vsp) \ @@ -107,6 +108,9 @@ static void vgetrandom_put_state(void *state) static void vgetrandom_init(void) { + const char *version = versions[VDSO_VERSION]; + const char **name = (const char **)&names[VDSO_NAMES]; + if (pthread_key_create(&grnd_ctx.key, vgetrandom_put_state) != 0) return; unsigned long sysinfo_ehdr = getauxval(AT_SYSINFO_EHDR); @@ -115,9 +119,9 @@ static void vgetrandom_init(void) exit(KSFT_SKIP); } vdso_init_from_sysinfo_ehdr(sysinfo_ehdr); - grnd_ctx.fn = (__typeof__(grnd_ctx.fn))vdso_sym("LINUX_2.6", "__vdso_getrandom"); + grnd_ctx.fn = (__typeof__(grnd_ctx.fn))vdso_sym(version, name[6]); if (!grnd_ctx.fn) { - printf("__vdso_getrandom is missing!\n"); + printf("%s is missing!\n", name[6]); exit(KSFT_FAIL); } if (grnd_ctx.fn(NULL, 0, 0, &grnd_ctx.params, ~0UL) != 0) { From patchwork Thu Aug 22 07:13:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 13772839 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 825C9C3DA4A for ; Thu, 22 Aug 2024 07:15:04 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 810B680016; Thu, 22 Aug 2024 03:15:02 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7962580012; Thu, 22 Aug 2024 03:15:02 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5E86380016; Thu, 22 Aug 2024 03:15:02 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 3751C80012 for ; Thu, 22 Aug 2024 03:15:02 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id EB51112141D for ; Thu, 22 Aug 2024 07:15:01 +0000 (UTC) X-FDA: 82479019602.03.F518EE4 Received: from pegase2.c-s.fr (pegase2.c-s.fr [93.17.235.10]) by imf06.hostedemail.com (Postfix) with ESMTP id A2F12180004 for ; Thu, 22 Aug 2024 07:14:59 +0000 (UTC) Authentication-Results: imf06.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=csgroup.eu; spf=pass (imf06.hostedemail.com: domain of christophe.leroy@csgroup.eu designates 93.17.235.10 as permitted sender) smtp.mailfrom=christophe.leroy@csgroup.eu ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1724310809; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=tWKrp512V31tWku8K/xJg7PzthyMYDtDCWjizHCsvmU=; b=mSFNQao7yeWWNbi/HigWcmdQjxOse1JrsFTgquE4b4ZV+0dF2X5DyFWghrMBZDcLCpefVG K5h2vA7ng9WCpgirAicGh9Q4Ilz+mqD4B4c2G3Oc1f/5xdATJZY6F2quNfs7PmpTn5LCP8 2YZrOgksIzbq6bjVbaGQQIy7RvipIvI= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1724310810; a=rsa-sha256; cv=none; b=YKq/G4Vl07RpNUj0/SkJ2O9HTnRjifCz9pUAp/RUyUKasHjj3kUFElacORHKr0ZucoL7Do 1hZ43P47D3D2KddreBsoSvd+hPMjP1+FbmWOU+lHKCrSSt5XJExyvCILEtfnooG5Dg0FS/ U3pLcBRpjQD+YSW73LqKGS4LVvvzY0U= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=csgroup.eu; spf=pass (imf06.hostedemail.com: domain of christophe.leroy@csgroup.eu designates 93.17.235.10 as permitted sender) smtp.mailfrom=christophe.leroy@csgroup.eu Received: from localhost (mailhub3.si.c-s.fr [172.26.127.67]) by localhost (Postfix) with ESMTP id 4WqDvQ4rYFz9sT7; Thu, 22 Aug 2024 09:13:38 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from pegase2.c-s.fr ([172.26.127.65]) by localhost (pegase2.c-s.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id n4SVLNdodNdx; Thu, 22 Aug 2024 09:13:38 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase2.c-s.fr (Postfix) with ESMTP id 4WqDvQ3xMdz9sSy; Thu, 22 Aug 2024 09:13:38 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 73F9A8B77E; Thu, 22 Aug 2024 09:13:38 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id HFEB0Yp4iArX; Thu, 22 Aug 2024 09:13:38 +0200 (CEST) Received: from PO20335.idsi0.si.c-s.fr (PO16920.IDSI0.si.c-s.fr [192.168.232.181]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 6065C8B77D; Thu, 22 Aug 2024 09:13:37 +0200 (CEST) From: Christophe Leroy To: Michael Ellerman , Nicholas Piggin , Christophe Leroy , Naveen N Rao , Andy Lutomirski , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , "Theodore Ts'o" , "Jason A. Donenfeld" , Arnd Bergmann , Andrew Morton , Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , Vincenzo Frascino , Shuah Khan Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-arch@vger.kernel.org, linux-mm@kvack.org, linux-trace-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: [PATCH v2 15/17] selftests: vdso: Fix build of test_vdso_chacha Date: Thu, 22 Aug 2024 09:13:23 +0200 Message-ID: <50cc36936b310d8dd6d7539c552cc8dd84052020.1724309198.git.christophe.leroy@csgroup.eu> X-Mailer: git-send-email 2.44.0 In-Reply-To: References: MIME-Version: 1.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1724310795; l=3948; i=christophe.leroy@csgroup.eu; s=20211009; h=from:subject:message-id; bh=myEwghlIo0VFEa/kCbUR8jkMcaOa8Dz8PO/V1GnGZDU=; b=3pzQ86+owF0quZVMNfNkNt1pF9agoztEqTpacb3+y5tzmYnNz4M7kg6ndA6tudWCTTaQ+v5Ls uth/LEL3EsrDJl98Nr2BREqhGR2wN0QN52ZMiThEVDzt+0TzB1GKIi/ X-Developer-Key: i=christophe.leroy@csgroup.eu; a=ed25519; pk=HIzTzUj91asvincQGOFx6+ZF5AoUuP9GdOtQChs7Mm0= X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: A2F12180004 X-Stat-Signature: 1njdrnnix1hokbfd616y696tgnpe3pjd X-Rspam-User: X-HE-Tag: 1724310899-835222 X-HE-Meta: U2FsdGVkX1/ACE2x/+/VAR3eopQVpAdQJ0i6gzpC3ulkymobfEPiPNDVqpBSl7n42UT0SyEmuyO7fBswddZxzuBmSRX/9vM8rqgyZGu2OogBjXN56AXEDGeOb/W3HL2bnchGfCXL0KjlJ6Y7AeUpX6YlLGfdfsYgFoMMFcXsgZBql64IBJDm5Gg9pW0YcEZVdrTlawKi+OHih9M6uMeoSmmg9Jao4W1r8F3eMBu9UCAAW5qtrvmaCnJ4LbJVlelLxkYMLqMHPJ9xI2g3eaxSNrOIQWTFvhV+atNRqBzhoYTE/kUlymXnnkAF3P1xZrwlAAMlP6GSZfiWRqdDBmWVDnr1NmMQm2MMsjDUgYcufnjy7fjiTDjcjt+HYSsMnK3GQUZ4wH+J9kdGukZV2yIJMm6rzZgOL71h8H/OVBZ1S+ShEKWFX4fEpM3o9SaEOm4JsRYTP+BzTpW7uGoI4Wwe2cgcbDsWN5WQru+/W3H9jSuKTvTaUexYpsUxMK51VurW0R5y9ZguXsB5GSYngBaI+niA5UIIbF8XDLgerJbFzwaVRzLb0390OQ9bzEmDBCZ5L5cJprlSxlNsFNslgdSGm8ssp3eKwqe1f/BWDLsGyBXJly2CiGjEBmUBU6OMKcDDzvmSs75o2wEh4Yckitm+/LBEK+/wQ4pN6uSDHh22130ywciRdZIqtUX/6NhKSizoDfD5IWXu8Te7MQrN+pEG3aXWiiSyoA7LmROS4boLXfT1ti6dytCVrJT1TXxnZJ6pO1jb4cfs8nEYQv2DLaz3bXU8trDad+GdVZqviGXo6v8yF3hiU5WJWCFMgP0SXt/8HqOWwSr8wXUVcPDiyVL4+ytoy3zKaVyLi+uTWtMOGrawMIo/ihqCoWpeGyGhoERCxd5tQqEZ1hjQ8bf76ugxs7AU4KKpAUOaMIxl39G8BVztdQSFFcm9H1INIyEeF/8EO26lXQEIVpM+AUuumpB BPvVkIaN chUWnBIZ7A5/TouMFMzQk9wDwuTc1T5akbZKoRZrX1+raR+AngYv5L01ChOOR60DUrOr8w9nf3I1LMl2+yhK7LI7OG+G42If55xMEZQop6+VsW0S8Ew1lVk1o9vI8R/llOkRPx1f/Zrwn/wUYA0uGRRCfyHeU1VoN2pUC8I4R2Y4Y4S8= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Building test_vdso_chacha on powerpc leads to following issue: In file included from /home/chleroy/linux-powerpc/include/linux/limits.h:7, from /opt/powerpc64-e5500--glibc--stable-2024.02-1/powerpc64-buildroot-linux-gnu/sysroot/usr/include/bits/local_lim.h:38, from /opt/powerpc64-e5500--glibc--stable-2024.02-1/powerpc64-buildroot-linux-gnu/sysroot/usr/include/bits/posix1_lim.h:161, from /opt/powerpc64-e5500--glibc--stable-2024.02-1/powerpc64-buildroot-linux-gnu/sysroot/usr/include/limits.h:195, from /opt/powerpc64-e5500--glibc--stable-2024.02-1/lib/gcc/powerpc64-buildroot-linux-gnu/12.3.0/include-fixed/limits.h:203, from /opt/powerpc64-e5500--glibc--stable-2024.02-1/lib/gcc/powerpc64-buildroot-linux-gnu/12.3.0/include-fixed/syslimits.h:7, from /opt/powerpc64-e5500--glibc--stable-2024.02-1/lib/gcc/powerpc64-buildroot-linux-gnu/12.3.0/include-fixed/limits.h:34, from /tmp/sodium/usr/local/include/sodium/export.h:7, from /tmp/sodium/usr/local/include/sodium/crypto_stream_chacha20.h:14, from vdso_test_chacha.c:6: /opt/powerpc64-e5500--glibc--stable-2024.02-1/powerpc64-buildroot-linux-gnu/sysroot/usr/include/bits/xopen_lim.h:99:6: error: missing binary operator before token "(" 99 | # if INT_MAX == 32767 | ^~~~~~~ /opt/powerpc64-e5500--glibc--stable-2024.02-1/powerpc64-buildroot-linux-gnu/sysroot/usr/include/bits/xopen_lim.h:102:7: error: missing binary operator before token "(" 102 | # if INT_MAX == 2147483647 | ^~~~~~~ /opt/powerpc64-e5500--glibc--stable-2024.02-1/powerpc64-buildroot-linux-gnu/sysroot/usr/include/bits/xopen_lim.h:126:6: error: missing binary operator before token "(" 126 | # if LONG_MAX == 2147483647 | ^~~~~~~~ This is due to kernel include/linux/limits.h being included instead of libc's limits.h This is because directory include/ is added through option -isystem so it goes prior to glibc's include directory. Replace -isystem by -idirafter But this implies that now tools/include/linux/linkage.h is included instead of include/linux/linkage.h, so define a stub for SYM_FUNC_START() and SYM_FUNC_END(). Signed-off-by: Christophe Leroy --- tools/include/linux/linkage.h | 4 ++++ tools/testing/selftests/vDSO/Makefile | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/tools/include/linux/linkage.h b/tools/include/linux/linkage.h index bc763d500262..a48ff086899c 100644 --- a/tools/include/linux/linkage.h +++ b/tools/include/linux/linkage.h @@ -1,4 +1,8 @@ #ifndef _TOOLS_INCLUDE_LINUX_LINKAGE_H #define _TOOLS_INCLUDE_LINUX_LINKAGE_H +#define SYM_FUNC_START(x) .globl x; x: + +#define SYM_FUNC_END(x) + #endif /* _TOOLS_INCLUDE_LINUX_LINKAGE_H */ diff --git a/tools/testing/selftests/vDSO/Makefile b/tools/testing/selftests/vDSO/Makefile index c9a819cacbf2..10ffdda3f2fa 100644 --- a/tools/testing/selftests/vDSO/Makefile +++ b/tools/testing/selftests/vDSO/Makefile @@ -42,7 +42,7 @@ $(OUTPUT)/vdso_test_getrandom: CFLAGS += -isystem $(top_srcdir)/tools/include \ $(OUTPUT)/vdso_test_chacha: $(top_srcdir)/tools/arch/$(ARCH)/vdso/vgetrandom-chacha.S $(OUTPUT)/vdso_test_chacha: CFLAGS += -idirafter $(top_srcdir)/tools/include \ - -isystem $(top_srcdir)/arch/$(ARCH)/include \ - -isystem $(top_srcdir)/include \ + -idirafter $(top_srcdir)/arch/$(ARCH)/include \ + -idirafter $(top_srcdir)/include \ -D__ASSEMBLY__ -DBULID_VDSO -DCONFIG_FUNCTION_ALIGNMENT=0 \ -Wa,--noexecstack $(SODIUM) From patchwork Thu Aug 22 07:13:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 13772840 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id D7DF6C531DF for ; Thu, 22 Aug 2024 07:15:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 63D236B00CE; Thu, 22 Aug 2024 03:15:06 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5C5D86B028E; Thu, 22 Aug 2024 03:15:06 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 39E6480012; Thu, 22 Aug 2024 03:15:06 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 0532C6B00A5 for ; Thu, 22 Aug 2024 03:15:05 -0400 (EDT) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id AC510C1312 for ; Thu, 22 Aug 2024 07:15:05 +0000 (UTC) X-FDA: 82479019770.07.E8E30E8 Received: from pegase2.c-s.fr (pegase2.c-s.fr [93.17.235.10]) by imf14.hostedemail.com (Postfix) with ESMTP id 621A9100013 for ; Thu, 22 Aug 2024 07:15:03 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=none; spf=pass (imf14.hostedemail.com: domain of christophe.leroy@csgroup.eu designates 93.17.235.10 as permitted sender) smtp.mailfrom=christophe.leroy@csgroup.eu; dmarc=pass (policy=quarantine) header.from=csgroup.eu ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1724310796; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MBHjqvqS12fvfjM8mveRKfh8AAQohzBoDZ0PbKlPNL8=; b=ccih+jSbFBNu1dVwhqqhfYFgvwXxkFlk5mkYAh3aL4/hL4RnO51EaXdL1vEW6OiU2Rd9aA 67NYGrC1ne5/REnaPbWxu64gp3IPBYHa1gqmtaaCwRrgwtS+ZShPA/pVCskexgnXFMgtLf w18bhu4o/7aUEvgZVscbNBCULBE2fxs= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=none; spf=pass (imf14.hostedemail.com: domain of christophe.leroy@csgroup.eu designates 93.17.235.10 as permitted sender) smtp.mailfrom=christophe.leroy@csgroup.eu; dmarc=pass (policy=quarantine) header.from=csgroup.eu ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1724310796; a=rsa-sha256; cv=none; b=n9irBdU40D22F6yIPg4nekAqG6rLi6/ljeonoOEfHdGGsU4OAbyVdWplbpg45TBXGIffXi wLqxs9apCljzG60JZMJ79tmq4NCZWkNu8L/e9BQqiENF74saTia/JtRT6n7wRQa7Iyl4Yc JFsKmsqy+rHN9Jnpo84ovTv1WbElMFA= Received: from localhost (mailhub3.si.c-s.fr [172.26.127.67]) by localhost (Postfix) with ESMTP id 4WqDvR5CX1z9sT8; Thu, 22 Aug 2024 09:13:39 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from pegase2.c-s.fr ([172.26.127.65]) by localhost (pegase2.c-s.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 21DgOl8Lk8Ri; Thu, 22 Aug 2024 09:13:39 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase2.c-s.fr (Postfix) with ESMTP id 4WqDvR4LvYz9sSy; Thu, 22 Aug 2024 09:13:39 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 83ED38B77E; Thu, 22 Aug 2024 09:13:39 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id WGcMRiOmQSwe; Thu, 22 Aug 2024 09:13:39 +0200 (CEST) Received: from PO20335.idsi0.si.c-s.fr (PO16920.IDSI0.si.c-s.fr [192.168.232.181]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 6F6158B763; Thu, 22 Aug 2024 09:13:38 +0200 (CEST) From: Christophe Leroy To: Michael Ellerman , Nicholas Piggin , Christophe Leroy , Naveen N Rao , Andy Lutomirski , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , "Theodore Ts'o" , "Jason A. Donenfeld" , Arnd Bergmann , Andrew Morton , Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , Vincenzo Frascino , Shuah Khan Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-arch@vger.kernel.org, linux-mm@kvack.org, linux-trace-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: [PATCH v2 16/17] selftests: vdso: Make VDSO function call more generic Date: Thu, 22 Aug 2024 09:13:24 +0200 Message-ID: X-Mailer: git-send-email 2.44.0 In-Reply-To: References: MIME-Version: 1.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1724310795; l=2025; i=christophe.leroy@csgroup.eu; s=20211009; h=from:subject:message-id; bh=Rn9d/ML2os7fiyWcUOGlavHd5OPzN/t1RfDUsN+0Qrg=; b=4ocv1Gynupmkdok/Yucd3J51RkIKkwAAgn+EGWRtuZhZI5J46ZOVIQ7c0ay2qC0zGA01fJtbr LHl2STYwXzSBtCp1j1FM7keZHQwVVi86v7ufMShJDfdkWwIamam+Wbi X-Developer-Key: i=christophe.leroy@csgroup.eu; a=ed25519; pk=HIzTzUj91asvincQGOFx6+ZF5AoUuP9GdOtQChs7Mm0= X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 621A9100013 X-Stat-Signature: hap8kwdo5tczgezfp3meagy7apuipgjr X-Rspam-User: X-HE-Tag: 1724310903-655639 X-HE-Meta: U2FsdGVkX18l45vTUzKE00hjSUCbOTGO9Qu9EpIiEm385P2z3aHmzWhYrc7xUR0ZglCEfiwesONRoFsUEx6VJllCzN2SSHPTY8w2IhleKjFXq3PVMvKkFNITt1lWy1JaFflv4RlKZQsNpUgbSDR7y2QupbEsDQs62BsNOJq58MThv3vwgGA4sqFAPikgN3O2ClCgD/ByedFzJp/pkmNBXIcZkrFu7oS3CObhxrnMkuwELEYlXnxaDdpwQ2CXnVJjqsDzF9V5uzNOLsd4cFHKdcDZv+RAiN/66tUbevfBkboqMfK05MR33ec3PtaA0dmItMySwfsqMtFdLzzdtdfKg5vCauPWH/AFOKsRqhvok/YBlrgbCq1vhmH5UZ38ftN7+v2zYdprwwTvuHqPeSZdXwp3JihkzeKONQ8Y3YUfWKLvgl1XzHGRTAmJiUCGZxIhjm48mCEC+EWgMi8X4X1UfHObFQdSoo5eMx+ctJrUcNlKB6LBT4jMVId0BY88pNA6z6TjMDgJ3iEK1c98wq2sDhEX0xeDbmxkz12rlUYkH1KI4iZEYAmdra3uabF58iwxFEqN21G1bzRes8g6kifspnh5NBi9lhOCji8otH7NadCte8gvbAcKZ2XF/z8Zg4Cm6AfLNwMgWx7T5h7u3GpzAXv0XAb5DfhUeerbPCXVM4nemUoxmLRffKyfZnw3SrotkalCZCLy/etRro8PQZdEBxzPse1m6iL41xw0i67OYV3wpTsze0p6tgfs0+jkFmk11duYIMryhM9e7A9LNCDnvo5+0/RmHE+gNhMD5wSuWDiCv9ffcLbGlCUfs7jtS76l6r1DSA2bGuuI6sMe8ml1efvepOnceVragqqXPDcHfjO8gMb7hsxnLA/3tQqew38yruz0VB0+2O84lzxFmy+klJyvUUhXxYnJDaAD5TrFz64QNRn3vwwlQHf28im+rbrfNZdyDqJ/5DvQATj6QRF lfQX30JU LR0rdERDqDV/CVug+bbd3tQh+vGFwA2iZzWkQuigDidahNo8l9USGFrQFPLk1VySs9n0Ou8MhrmHO/+sYM1/rH89vatYyKy6jKG2CRes6+LK4QaVkxOuPf9R6+Bi/jC2Cdaz1 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On powerpc, a call to a VDSO function is not a standard C function call. Unlike x86 that returns a negated error code in case of an error, powerpc sets CR[SO] and returns the error code as a positive value. So use a macro called VDSO_CALL() which takes a pointer to the function to call, the number of arguments and the arguments. Signed-off-by: Christophe Leroy --- tools/testing/selftests/vDSO/vdso_call.h | 12 ++++++++++++ tools/testing/selftests/vDSO/vdso_test_getrandom.c | 3 ++- 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 tools/testing/selftests/vDSO/vdso_call.h diff --git a/tools/testing/selftests/vDSO/vdso_call.h b/tools/testing/selftests/vDSO/vdso_call.h new file mode 100644 index 000000000000..ca5db2220925 --- /dev/null +++ b/tools/testing/selftests/vDSO/vdso_call.h @@ -0,0 +1,12 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Macro to call vDSO functions + * + * Copyright (C) 2024 Christophe Leroy , CS GROUP France + */ +#ifndef __VDSO_CALL_H__ +#define __VDSO_CALL_H__ + +#define VDSO_CALL(fn, nr, args...) fn(args) + +#endif diff --git a/tools/testing/selftests/vDSO/vdso_test_getrandom.c b/tools/testing/selftests/vDSO/vdso_test_getrandom.c index 02bcffc23e0c..16ad400721c3 100644 --- a/tools/testing/selftests/vDSO/vdso_test_getrandom.c +++ b/tools/testing/selftests/vDSO/vdso_test_getrandom.c @@ -22,6 +22,7 @@ #include "../kselftest.h" #include "parse_vdso.h" #include "vdso_config.h" +#include "vdso_call.h" #ifndef timespecsub #define timespecsub(tsp, usp, vsp) \ @@ -147,7 +148,7 @@ static ssize_t vgetrandom(void *buf, size_t len, unsigned long flags) exit(KSFT_FAIL); } } - return grnd_ctx.fn(buf, len, flags, state, grnd_ctx.params.size_of_opaque_state); + return VDSO_CALL(grnd_ctx.fn, 5, buf, len, flags, state, grnd_ctx.params.size_of_opaque_state); } enum { TRIALS = 25000000, THREADS = 256 }; From patchwork Thu Aug 22 07:13:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 13772842 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 874EDC531DF for ; Thu, 22 Aug 2024 07:15:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 68AAF80018; Thu, 22 Aug 2024 03:15:10 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 60DE480017; Thu, 22 Aug 2024 03:15:10 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4620080018; Thu, 22 Aug 2024 03:15:10 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 2224F80017 for ; Thu, 22 Aug 2024 03:15:10 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id D59C3140558 for ; Thu, 22 Aug 2024 07:15:09 +0000 (UTC) X-FDA: 82479019938.15.9CE0040 Received: from pegase2.c-s.fr (pegase2.c-s.fr [93.17.235.10]) by imf06.hostedemail.com (Postfix) with ESMTP id A590518002C for ; Thu, 22 Aug 2024 07:15:07 +0000 (UTC) Authentication-Results: imf06.hostedemail.com; dkim=none; spf=pass (imf06.hostedemail.com: domain of christophe.leroy@csgroup.eu designates 93.17.235.10 as permitted sender) smtp.mailfrom=christophe.leroy@csgroup.eu; dmarc=pass (policy=quarantine) header.from=csgroup.eu ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1724310827; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sZGsX/eQOLr/fZ79f0S/sX6lLhFKgJ8hlWo2Id87YPg=; b=x3gTZUs4e49vLNYblfNruHO464CQ06aadKISio7IP8rgIFmSG8gHKfAJiC2ChnaOBZLPTx oxfjDtB/Tk8oRPs6e4l0aUcdqIJYRLzM1CEzvrODVhwtNAJleAa7QLKu16abIhIXqCJzso qN5a+a9RyWgnLe3QNc7Fgh7kSz14+QE= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1724310827; a=rsa-sha256; cv=none; b=vjulgKC6Yp+nH9wzehpFtQx/LaqKSGc0pibaE1nTyaH6gXeab4A/zSpfFS2PPh2UgVEjPN cTZ4cAL0NhEjy1vbB/qGrXp1mTCAM9/8ibY+cX0l01H+bzm4kGVXBWw+/WGSMNvTIVt75P 0iMTyAB/UIt9Yd1azmdkK1kJK/7ogGU= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=none; spf=pass (imf06.hostedemail.com: domain of christophe.leroy@csgroup.eu designates 93.17.235.10 as permitted sender) smtp.mailfrom=christophe.leroy@csgroup.eu; dmarc=pass (policy=quarantine) header.from=csgroup.eu Received: from localhost (mailhub3.si.c-s.fr [172.26.127.67]) by localhost (Postfix) with ESMTP id 4WqDvS5M5gz9sTD; Thu, 22 Aug 2024 09:13:40 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from pegase2.c-s.fr ([172.26.127.65]) by localhost (pegase2.c-s.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 5BXvRolJCPmB; Thu, 22 Aug 2024 09:13:40 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase2.c-s.fr (Postfix) with ESMTP id 4WqDvS4Ts4z9sSy; Thu, 22 Aug 2024 09:13:40 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 898D68B763; Thu, 22 Aug 2024 09:13:40 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id M06ncktVG1Is; Thu, 22 Aug 2024 09:13:40 +0200 (CEST) Received: from PO20335.idsi0.si.c-s.fr (PO16920.IDSI0.si.c-s.fr [192.168.232.181]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 7999F8B77D; Thu, 22 Aug 2024 09:13:39 +0200 (CEST) From: Christophe Leroy To: Michael Ellerman , Nicholas Piggin , Christophe Leroy , Naveen N Rao , Andy Lutomirski , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , "Theodore Ts'o" , "Jason A. Donenfeld" , Arnd Bergmann , Andrew Morton , Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , Vincenzo Frascino , Shuah Khan Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-arch@vger.kernel.org, linux-mm@kvack.org, linux-trace-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: [PATCH v2 17/17] selftests: vdso: Add support for vdso_test_random for powerpc Date: Thu, 22 Aug 2024 09:13:25 +0200 Message-ID: <7a612370f645d6f8defd4dc8c1ebf31ee39dfb1f.1724309198.git.christophe.leroy@csgroup.eu> X-Mailer: git-send-email 2.44.0 In-Reply-To: References: MIME-Version: 1.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1724310795; l=2831; i=christophe.leroy@csgroup.eu; s=20211009; h=from:subject:message-id; bh=yXWU/vOrVCh1tH6IvVskRabYNHCoI2MUD+0kW8f8BRY=; b=KS6Wqd4DIG71241Ra4HKWqyJqfA08PcnWHdqJqXSzHx1GQ2rQRMw4i3n5nKIJ8DUdMbYpgKlH PcZJDDWZcGgD4/4e4J7ugbtDnH9tX2JYCnkXxsBKExFDkk4hm1KeDA9 X-Developer-Key: i=christophe.leroy@csgroup.eu; a=ed25519; pk=HIzTzUj91asvincQGOFx6+ZF5AoUuP9GdOtQChs7Mm0= X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: A590518002C X-Stat-Signature: 1qs1o3tf4ehy36udtx1ywkhmozyibtci X-HE-Tag: 1724310907-876422 X-HE-Meta: U2FsdGVkX1+EhysMRQfvDRy6bfTL5h43CRrXsusZNQX8B+xAU977bBz8B7kIwlwnZtaLt3ZrB0/r4uNEtLErLmsk77hvuvk/q9hxe4iKexnFxeRNxTad5TEoXTALGVPV4vWY/prSYasqvkicxP5YphtuMbmCv/wg+Krwtsf2ozWNtuwgGMyNFY1tdLYmWkl60i3G36mPVD9c7d1gV6+6HA/Etgm8thaC7rIzlRlszoBtuhcGDR3hT9s/4ZuoLte8ZRhYgZ+axmD7vLPQG5I3dSMNJtBCNq2552jzNLkXwT3Udnh9xTFLzmX3mKUpqniHxh0u5BFk/4PgvxSvPwoWUqxKtIZAGhngXpD+SoxdXSgmcJvXVMuRkvzmTRldtpQtlfMDMcfpUnrjkxXd/0G3BRH+gmMb6NmMPBfIeHDnftuUSnYhMnNeW120jrwO0/lJcrDH65ZHmiQPUk5ICu5Qd8gBMdSUr0uqnOlCb8oNT6+SK0VUOHTTl7HUjd7gF0hw0McHlDg6FVYgFAheop7iU/qwdZochV1DPWVPmjHqI2QRdGbnNipCLn5BP/m5z2FA14ZqCg5C9FVvlE3GzfkLfiiMN2bzIHNMyOrtRAKcpyr2a3p1MGa+KeiIL7th+6DjScp8kPALH3nvTABQWbsXHcHnWggpdpdZoycCFOJsG7TI/Bkm8lMJdMZAhgrWTG24JI94I26ZsNcH9907O7EXPPHW93GxVXw0g/mAoieiILZm/QbKvOOuAL60RntsjiSmmiB8A26+FERpJ3SUJ0bvXjkLA2bz+s8//upEsHF/a4L/9j45J9r2jv6d84paDBejYIwe8XX4L1dHHTPstP+8wTl+x5fgXm7rvCiM8uKTg8ZKmthACluxUw6B0lR6I9vJfBT7VlNvg7jmUS8SzGiwh9ZcVZ7YwU0OZbe5U3trMj5vLrLCAR4ZT2h9nC6xQyjk3mVcnflT5dSYeM+d3V1 I1oMite7 R2ZXWjlU9UhtMWp1Yy7uMOzzfCB7V+UEhZL/urWDHHBUO72YVAlcAbP0PoJV+l/WCqUmIaELc65XfNe/4G/zwsaXlvc74ceYO4kC5b3Ja1I++xbGEDLL5K4e1zM2akQphDzIuZHGwYN29ZuV8DrhleWTBs1zY41q0vBRzF2xZjlOjUx0= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Add the necessary symbolic link and tell Makefile to build vdso_test_random for powerpc. In makefile, don't use $(uname_M) which is wrong when cross-building for powerpc on an x86_64. Implement the required VDSO_CALL macro to correctly handle errors. Signed-off-by: Christophe Leroy --- tools/arch/powerpc/vdso | 1 + tools/testing/selftests/vDSO/Makefile | 6 ++++ tools/testing/selftests/vDSO/vdso_call.h | 40 ++++++++++++++++++++++++ 3 files changed, 47 insertions(+) create mode 120000 tools/arch/powerpc/vdso diff --git a/tools/arch/powerpc/vdso b/tools/arch/powerpc/vdso new file mode 120000 index 000000000000..d31004bf8f55 --- /dev/null +++ b/tools/arch/powerpc/vdso @@ -0,0 +1 @@ +../../../arch/powerpc/kernel/vdso/ \ No newline at end of file diff --git a/tools/testing/selftests/vDSO/Makefile b/tools/testing/selftests/vDSO/Makefile index 10ffdda3f2fa..7e7c9fd200d3 100644 --- a/tools/testing/selftests/vDSO/Makefile +++ b/tools/testing/selftests/vDSO/Makefile @@ -17,6 +17,12 @@ ifneq ($(SODIUM),) TEST_GEN_PROGS += vdso_test_chacha endif endif +ifeq ($(ARCH),powerpc) +TEST_GEN_PROGS += vdso_test_getrandom +ifneq ($(SODIUM),) +TEST_GEN_PROGS += vdso_test_chacha +endif +endif CFLAGS := -std=gnu99 diff --git a/tools/testing/selftests/vDSO/vdso_call.h b/tools/testing/selftests/vDSO/vdso_call.h index ca5db2220925..2a33c25756dc 100644 --- a/tools/testing/selftests/vDSO/vdso_call.h +++ b/tools/testing/selftests/vDSO/vdso_call.h @@ -7,6 +7,46 @@ #ifndef __VDSO_CALL_H__ #define __VDSO_CALL_H__ +#ifdef __powerpc__ + +#define LOADARGS_5(fn, __arg1, __arg2, __arg3, __arg4, __arg5) do { \ + _r0 = fn; \ + _r3 = (long)__arg1; \ + _r4 = (long)__arg2; \ + _r5 = (long)__arg3; \ + _r6 = (long)__arg4; \ + _r7 = (long)__arg5; \ +} while (0) + +#define VDSO_CALL(fn, nr, args...) ({ \ + register void *_r0 asm ("r0"); \ + register long _r3 asm ("r3"); \ + register long _r4 asm ("r4"); \ + register long _r5 asm ("r5"); \ + register long _r6 asm ("r6"); \ + register long _r7 asm ("r7"); \ + register long _r8 asm ("r8"); \ + register long _rval asm ("r3"); \ + \ + LOADARGS_##nr(fn, args); \ + \ + asm volatile( \ + " mtctr %0\n" \ + " bctrl\n" \ + " bns+ 1f\n" \ + " neg 3, 3\n" \ + "1:" \ + : "+r" (_r0), "=r" (_r3), "+r" (_r4), "+r" (_r5), \ + "+r" (_r6), "+r" (_r7), "+r" (_r8) \ + : "r" (_rval) \ + : "r9", "r10", "r11", "r12", "cr0", "cr1", "cr5", \ + "cr6", "cr7", "xer", "lr", "ctr", "memory" \ + ); \ + _rval; \ +}) + +#else #define VDSO_CALL(fn, nr, args...) fn(args) +#endif #endif