From patchwork Mon Sep 23 14:19:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincenzo Frascino X-Patchwork-Id: 13809663 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 84687CF9C70 for ; Mon, 23 Sep 2024 14:19:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 176ED6B0083; Mon, 23 Sep 2024 10:19:56 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1290E6B0085; Mon, 23 Sep 2024 10:19:56 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F31B76B0088; Mon, 23 Sep 2024 10:19:55 -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 D4F346B0083 for ; Mon, 23 Sep 2024 10:19:55 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 5C9071212CC for ; Mon, 23 Sep 2024 14:19:55 +0000 (UTC) X-FDA: 82596211950.15.091039E Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf26.hostedemail.com (Postfix) with ESMTP id B9907140010 for ; Mon, 23 Sep 2024 14:19:53 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf26.hostedemail.com: domain of vincenzo.frascino@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=vincenzo.frascino@arm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1727101107; a=rsa-sha256; cv=none; b=JQGftFUpk4dm5PWUGd9SRnvoWBCYSdemJs0pfGdN0lVxKsFZ4HNsnKwLwwrmPABKsajaLZ g5QyWL5/UvIf3QH8pkAkFUx9uqpTiXeIRzgtknO25mE8+LdSCyzJjZ5YhFr7QTDCXHYWUd KCFcEqH4twceLT/P206/rpd/MiSIpyw= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf26.hostedemail.com: domain of vincenzo.frascino@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=vincenzo.frascino@arm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1727101107; 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=mFyRD62lBvZVQAlhbGspUIuSgrAAOVOzZzpdKiV2GGw=; b=SgjQtUYMHK9l1fUtat5m2pNgM2ZVLRLz1lvzQXlBWKocY7V4zCJdHGFUhPvIZ2JJ8YurHX 04f2xY4BbdluoGUAiVC6ZBd9JroBOcP5znWoeLb+U4lvZJFT0a0E09pxtAE0Hq9v0DdudA qYKppof5DAVbgkUdQ4cFx63EUmvNL0c= Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 2BC111007; Mon, 23 Sep 2024 07:20:22 -0700 (PDT) Received: from e119884-lin.cambridge.arm.com (e119884-lin.cambridge.arm.com [10.1.196.72]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 426CC3F64C; Mon, 23 Sep 2024 07:19:50 -0700 (PDT) From: Vincenzo Frascino To: linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linux-mm@kvack.org Cc: Vincenzo Frascino , Andy Lutomirski , Thomas Gleixner , "Jason A . Donenfeld" , Christophe Leroy , Michael Ellerman , Nicholas Piggin , Naveen N Rao , Ingo Molnar , Borislav Petkov , Dave Hansen , "H . Peter Anvin" , Theodore Ts'o , Arnd Bergmann , Andrew Morton , Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers Subject: [PATCH v2 1/8] x86: vdso: Introduce asm/vdso/mman.h Date: Mon, 23 Sep 2024 15:19:36 +0100 Message-Id: <20240923141943.133551-2-vincenzo.frascino@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240923141943.133551-1-vincenzo.frascino@arm.com> References: <20240923141943.133551-1-vincenzo.frascino@arm.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: B9907140010 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: 84m898psbukwrynm7agff4qn95gew849 X-HE-Tag: 1727101193-543070 X-HE-Meta: U2FsdGVkX1+65rrsfMBXrA/+yyrtFD5O5ZecrRhaNvMCgwm07GDfPCZ88dr0jPMQHr4n8xiwJgUhDwwh5GLZ4EANbQ7DRuwqM6gezlvOhjeUK0HLFfhtcZkA4JQ39HO1rJocjVfeHkaQArx9ddAickgWrqVzX4rcLEFOLBCOaAGdZ3Lu3T4DxkCvxex2N87fjgBzybpGq2r+zBTlhvPKqOXlB0J2oHSGpw3i0lGLxicEBNvE/wTDJFIa5PaUPkQhNq+Rep9CKzDxh+12Vxn7c09xMMXYroPFuXdY5kJBjZHcR18nJ1fyPX/hfwmA2dcZYa66MjzF6XhelZh8Vc3AaKYEArvekUsz7zKe5UDl7xa+hDBWYBDpy1PdVJAxJNFCWiy9ESFjCG3UkZsRVJkNzMeayAcMP0FrqurjCarIygtJX8lbhmoVqefwtyH3fwK3Q52BKc5Vite9+pcu3TamKyqznB4bkkyOxr0sDypocSGj5LpjshFzsKysiPwaHZKi7P4XVNWK55c/gYEwG5rskH+lC3CHLyptr5qob1DspRAhZ3hAwPo1alIR6me1+kr65ucqqO9+21852yWaRaS0M0fSxwV7F32XAV3ZQ6psOuB/K01oHMafjFSmh/fxtdBURZF0c6epHNzt8G3O7xwrW+sVZ0qvIsPYBiDqGLKsL2F0RHM7TjEa68zCDrrn/YpqzbTD4Jx646qhJjBoKyC4uhw2a6ywIwLZc9Q7koQcdffDTElN9YSOxoq7QRDcV2Di8MnX2e/ITGjh6Cot3OQc44kM2IsTmxNm1+dn0kujvTw/w910BnkiyakIiDnhPsMd1bV3q0WR/yIds/RjVSBorTmEC6674V48zEh7QQ038e/vFsOgL/l6Zf0W/+t3QqbODK4aM7NcQIwfnh31VQZs0Gpd66Ncrpd0C8cAMkXOv8oGYmUxOroxwS0lkg07BS4ABW5XxFUF6se+u2yhmcn jRpDZMon 5Y/3zrudV3+GZgN9hzOePBJHnba4KwVSlhZskPxyX56p0rLFUF088JytVzY0rURXIvSCXXATrpwEczAX6h6Ek2dot5qye3/NzrbeWaRBZjSbH7F4BY7XcA2BHI9+kYYdVsnKtdHpHzD6qcH1qLFEv8ljvEyHXe1aF0SLwdYmToCIrL2wDDO4MSKC+eKzOzZfpooR/5cmGeTbUP19KNkgV9LtNDZmiMr8ccSxoUVWJksX6Zz0= 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: The VDSO implementation includes headers from outside of the vdso/ namespace. Introduce asm/vdso/mman.h to make sure that the generic library uses only the allowed namespace. Cc: Andy Lutomirski Cc: Thomas Gleixner Cc: Jason A. Donenfeld Signed-off-by: Vincenzo Frascino --- arch/x86/include/asm/vdso/mman.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 arch/x86/include/asm/vdso/mman.h diff --git a/arch/x86/include/asm/vdso/mman.h b/arch/x86/include/asm/vdso/mman.h new file mode 100644 index 000000000000..4c936c9d11ab --- /dev/null +++ b/arch/x86/include/asm/vdso/mman.h @@ -0,0 +1,15 @@ + +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __ASM_VDSO_MMAN_H +#define __ASM_VDSO_MMAN_H + +#ifndef __ASSEMBLY__ + +#include + +#define VDSO_MMAP_PROT PROT_READ | PROT_WRITE +#define VDSO_MMAP_FLAGS MAP_DROPPABLE | MAP_ANONYMOUS + +#endif /* !__ASSEMBLY__ */ + +#endif /* __ASM_VDSO_MMAN_H */ From patchwork Mon Sep 23 14:19:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincenzo Frascino X-Patchwork-Id: 13809664 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 0BA87CF9C72 for ; Mon, 23 Sep 2024 14:19:59 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9197A6B0085; Mon, 23 Sep 2024 10:19:58 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8A0D36B0088; Mon, 23 Sep 2024 10:19:58 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6CF316B0089; Mon, 23 Sep 2024 10:19:58 -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 525B46B0085 for ; Mon, 23 Sep 2024 10:19:58 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id D238481360 for ; Mon, 23 Sep 2024 14:19:57 +0000 (UTC) X-FDA: 82596212034.09.1DE95B3 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf18.hostedemail.com (Postfix) with ESMTP id 311221C0018 for ; Mon, 23 Sep 2024 14:19:56 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf18.hostedemail.com: domain of vincenzo.frascino@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=vincenzo.frascino@arm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1727101100; a=rsa-sha256; cv=none; b=JrpMKEvxiq8UJtxsJcXX4ARkV70gpIhenA6wGxXoZj1IcE5n/hHj7xCLv+C37588Ei5Tfc Ac29LaRHZbcUnQpNJO3u6uOobVhceXs3CS0tHrhI+oeOqc+LtKYrHcXCIvpXZ4HXK0lBJq NotGOzcPu5uNtfpbrR2kTXduPajtCmc= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf18.hostedemail.com: domain of vincenzo.frascino@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=vincenzo.frascino@arm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1727101100; 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=jXzKDHq6h6LNaexpMiKdZ8nDPcV8u6WvA5EoJpJAJXE=; b=A6AD+CSEQ32S4pzRIVXeebTzMYtotXJc70cCboLnAfrGc5uWFz3yvs+WxRgvFkHRTxR7QI g5sOXqq/+67Md0t8YaMK5WN7VillQjyZ3x9yIZBe0Sg0lnSA2XOoK/gjZer2cgHSRskJ03 7wUqeAJycEj6y139W9C8cNVDbjuBW+Q= Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id D48CA11FB; Mon, 23 Sep 2024 07:20:24 -0700 (PDT) Received: from e119884-lin.cambridge.arm.com (e119884-lin.cambridge.arm.com [10.1.196.72]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id EB8593F64C; Mon, 23 Sep 2024 07:19:52 -0700 (PDT) From: Vincenzo Frascino To: linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linux-mm@kvack.org Cc: Vincenzo Frascino , Andy Lutomirski , Thomas Gleixner , "Jason A . Donenfeld" , Christophe Leroy , Michael Ellerman , Nicholas Piggin , Naveen N Rao , Ingo Molnar , Borislav Petkov , Dave Hansen , "H . Peter Anvin" , Theodore Ts'o , Arnd Bergmann , Andrew Morton , Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers Subject: [PATCH v2 2/8] arm64: vdso: Introduce asm/vdso/mman.h Date: Mon, 23 Sep 2024 15:19:37 +0100 Message-Id: <20240923141943.133551-3-vincenzo.frascino@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240923141943.133551-1-vincenzo.frascino@arm.com> References: <20240923141943.133551-1-vincenzo.frascino@arm.com> MIME-Version: 1.0 X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 311221C0018 X-Stat-Signature: itc6fyghi8g61u4iui8qbs77dgss3pic X-Rspam-User: X-HE-Tag: 1727101196-811431 X-HE-Meta: U2FsdGVkX1+WdFJ8NUW7VYYJCjqfY70F/K3gSz7vGRJn7DRg+Na88p2s6k0gUCpmauoPi232ouQZomM2sE/9QTk88bvA/1KuvZWA5VfGmkqH98MiYGCtQU2fpzFOvTNg8vrNoKRQDMguioYA/GzmHB6j4rFulDbayFHfUtNfy4reC/H4mecClEc3cGIKTPLFCZOOjJojemDIeHpwRFRl42Q/6x+e7wYuO8P5zWHZWVYThsrzBvjIksMIv493QPvqrFB6jDS4NJ1KTKB0fYRzLQbjfv8NPaIAI0qN8t1Ajiu880WAEKW74kcBlCxZnVRmbbWjqgK3QJVanMF1xPs+eN/YM1rf2mpd9PWHCBX3WL0jRKxcA7nCJBsV4mzkmHSOP6vzOdlWkmjg1MB6gZb1+JD5z9ZOnUuM4riC8tmM4hAlIzUYCx3R2MuKkgNPHIKJgkaeig4QWQrB3I8eGf0/YyjUIX8TG2cx0jKoWzTDpc3peKHl9OE9Y/9HtbAWQ8qGL3taoEz8KZw/Bx/O3b17AeFwYt+2az6IBe39d1MIzMTAi+A9/jSbNQxIP+h0uMcKE3HXzIB6t3EScbIhS6kS9lq/5bKJq2wQlureNsi1c7uIZC/uZpTBQWE2BuPUXvUVwGKWH/No5cD3QotICtyaJznTl6jabRCe35rAKPumdn0xuMedSAOceCG29N1coMKHvmwWY1cNPmoD0qZHBCbMREHj2R5ATHt4WggXDRKt6ZcCvFUeGtD0waAo863S3ljIhHz4SCk5IfnyAxHhMdg0tMqkB8Iubtd1BSBLa9LlWMfVt7g0Zr/d7u23PxWmEqltMiCfo9kdr4fLSQfHntZs913A4N3dHC2jy2UM+hV/ujHFlJ6BIYojF4axanuKs0psXbRD7at459HZfnO7nt5Sb6itUBKTVXWyuS0oemQ7j43c59DDo/ilEiqxzklNlWaadaAL09cSy+1m4XlsESi UDHn2CBZ xIGhOO8xQS/sZbNkonY06fowKmGf56G56IpNVyHfBHWc3Nf05k7yhueXhGDyN8hzhEKFH67vV8PLsURkS8iTZYYIRg2VyenzBKG/uHwdszROcKzh5kief1nHmUYowjNO1EVctGCO0h0DFP5ngHLPQaOBkaEXJT0yWtvFz4TThOt/k8dtnMXdiHpuvsk4mGkVD+l4uUT21AJ6o4CZOQVhMnhgH7Wu5ZQJ2QFgO7mUk9bYCQec= 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: The VDSO implementation includes headers from outside of the vdso/ namespace. Introduce asm/vdso/mman.h to make sure that the generic library uses only the allowed namespace. Cc: Andy Lutomirski Cc: Thomas Gleixner Cc: Jason A. Donenfeld Signed-off-by: Vincenzo Frascino --- arch/arm64/include/asm/vdso/mman.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 arch/arm64/include/asm/vdso/mman.h diff --git a/arch/arm64/include/asm/vdso/mman.h b/arch/arm64/include/asm/vdso/mman.h new file mode 100644 index 000000000000..4c936c9d11ab --- /dev/null +++ b/arch/arm64/include/asm/vdso/mman.h @@ -0,0 +1,15 @@ + +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __ASM_VDSO_MMAN_H +#define __ASM_VDSO_MMAN_H + +#ifndef __ASSEMBLY__ + +#include + +#define VDSO_MMAP_PROT PROT_READ | PROT_WRITE +#define VDSO_MMAP_FLAGS MAP_DROPPABLE | MAP_ANONYMOUS + +#endif /* !__ASSEMBLY__ */ + +#endif /* __ASM_VDSO_MMAN_H */ From patchwork Mon Sep 23 14:19:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincenzo Frascino X-Patchwork-Id: 13809665 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 D93EECF9C70 for ; Mon, 23 Sep 2024 14:20:01 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 488E96B0088; Mon, 23 Sep 2024 10:20:01 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3C1296B0089; Mon, 23 Sep 2024 10:20:01 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1786A6B008A; Mon, 23 Sep 2024 10:20:00 -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 DCD786B0088 for ; Mon, 23 Sep 2024 10:20:00 -0400 (EDT) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 8743C1C6A43 for ; Mon, 23 Sep 2024 14:20:00 +0000 (UTC) X-FDA: 82596212160.17.45A0745 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf19.hostedemail.com (Postfix) with ESMTP id E0CD61A0007 for ; Mon, 23 Sep 2024 14:19:58 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=none; spf=pass (imf19.hostedemail.com: domain of vincenzo.frascino@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=vincenzo.frascino@arm.com; dmarc=pass (policy=none) header.from=arm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1727101164; 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=dyrFQn1IHO6P3qtvTV+7BOKE3DwB1hqbcpjwjJ/hKVc=; b=a5lkoXeOYFMAccksRC/49uZ1x4LYns7U4qxeSLrh1SXb8hvh+cs+lLDuqqUYYfsrGOXO4M 4/b+24+lRYiLpW60TwtM6sPf9K1VASrYb8gLee55vKrz/QZZOIfQe7T6tjoOqcQ4HSzogV T7LkatD5azFSELqmlz3FcKMcdWAw9wA= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=none; spf=pass (imf19.hostedemail.com: domain of vincenzo.frascino@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=vincenzo.frascino@arm.com; dmarc=pass (policy=none) header.from=arm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1727101164; a=rsa-sha256; cv=none; b=wgDRK+ukoFRgiUZyx67BkwL15IHg5ylIhyobwiwQlKpVI6aoc09oCBwjMhagK81GaJv2xc 0UHkc3RYxS9g2NBnsmdooqAqJ7Pfz8yWG5aR+ToRNDp6d6+Krk3a2rlUDG+miHUiFELfX3 WIU/Tjwy+Bel7IbzInV5MOCrZUpjo88= Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 897AC12FC; Mon, 23 Sep 2024 07:20:27 -0700 (PDT) Received: from e119884-lin.cambridge.arm.com (e119884-lin.cambridge.arm.com [10.1.196.72]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id A024D3F64C; Mon, 23 Sep 2024 07:19:55 -0700 (PDT) From: Vincenzo Frascino To: linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linux-mm@kvack.org Cc: Vincenzo Frascino , Andy Lutomirski , Thomas Gleixner , "Jason A . Donenfeld" , Christophe Leroy , Michael Ellerman , Nicholas Piggin , Naveen N Rao , Ingo Molnar , Borislav Petkov , Dave Hansen , "H . Peter Anvin" , Theodore Ts'o , Arnd Bergmann , Andrew Morton , Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers Subject: [PATCH v2 3/8] vdso: Introduce vdso/mman.h Date: Mon, 23 Sep 2024 15:19:38 +0100 Message-Id: <20240923141943.133551-4-vincenzo.frascino@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240923141943.133551-1-vincenzo.frascino@arm.com> References: <20240923141943.133551-1-vincenzo.frascino@arm.com> MIME-Version: 1.0 X-Rspam-User: X-Stat-Signature: rrd7fp9qsyiexq88xbhfrwfxd1forr5e X-Rspamd-Queue-Id: E0CD61A0007 X-Rspamd-Server: rspam11 X-HE-Tag: 1727101198-26024 X-HE-Meta: U2FsdGVkX1+4ghI3HPWtmtOMAQQbIH2/19ssu1Dwrtjnseo6B9jkCfvaDw2UL+GPw4paV86Agh8ju8Frb4gK8tkymZBDQX5/EyHn2eETm35LtMTSSW6FfxbfEmNq7QxxSZ2QMc43tS6bIQNn54IgWc2KZe5lXOBVv0sUOeXw/Iow6rBXxca6cZomif1quUhp1RN4Msg19UxqAqQfp2tbDlfcv7SL3t8f/+w4F0tNOTAhuyY8gRFvfAN8z3V6qXIAJY2Wh8qp5H+An4zvdX02y6h6ZpRr3LzBgYirNRGXZDcJlHVYJzrDcJcrpg8UOZdQsPqSloswWiqdzTTWlN4CH6gWvFPUu2PWR9BsAaPOI8+kCSj228gEdAt9QncsD0HgX4Zz9vxfwkHZpp1W+o0QlcQdXgbIwAEAA7fm9bu1bPVnf8vT3BS0ZEDifYLRCPebNnSlBAdXQu5mUqXDubA62YYmSfhL9YeFzUuJblThcha5lO6biVA75cdYZ0svyl1tjywK+47u25E07NeuL+KlzxQvuABBpiXtrez1W2YpMt4TSBziOA7rKVVG/+m0apA87OLSu6t9AR0VPd4e7buui81suIj4NoujJ/acBoS2nAeqbhFJKMkoCbc9e0lRa7CgAV7Vt3pGyNidLTaHea2bKn+nppM9mOonJMPKLHWDmEFTzYaUQ+GHbkqimeCGheLL4uSX9oeyhfbCFoW24wcdnGoevwXasgjqPBf1nA/X2nCESeDdq/JsO23cQddN/lSOhLWhz9T60qwfiKryVdEieGbhsYZxDhg51LqKqIy+DhmksaTiMu5ymyh7nAmMHGMrQaoQrSUdutmYDI2qbBMCSdGaIpLJ+jG1bAVuVc94141nQKh1O27Zj5bDiL7OiWMEQjR87nB8HTmf7pSM9EPlzrE3Dkn4fOr4ij689WLVhlMuMnWZF+8Lo8FoOp+pEAx7vRuSeya3T/hyJ5fmXYf P/ph4sV9 P8EfkL6s0IvohhwSAD0gEO98WrqTwX+pY821A7IY6EAu3aRMV5uKYAMV4Y2sQ4Pt/4VnFC5+yBJ4kQ5Oa15gSj6bnbHChUtbyFhP1MZnaXG5KIVD0apZNRwtq9Ju82MHaj1hJbx9KE5aJ5jcevTg1PyfGos1PGiJYOEPTEgCICj+vAmJygwtvFgZ9T/Ntzv2BSmnKuGVt9b9qdtyXIzYsnFsg/7ThuI0WAaAWXH4xdoP5NhrV6+wflfRhvu1nXk9A3lzpwsh+hNJoc2c= 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: The VDSO implementation includes headers from outside of the vdso/ namespace. Introduce vdso/mman.h to make sure that the generic library uses only the allowed namespace. Cc: Andy Lutomirski Cc: Thomas Gleixner Cc: Jason A. Donenfeld Signed-off-by: Vincenzo Frascino --- include/vdso/mman.h | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 include/vdso/mman.h diff --git a/include/vdso/mman.h b/include/vdso/mman.h new file mode 100644 index 000000000000..95e3da714c64 --- /dev/null +++ b/include/vdso/mman.h @@ -0,0 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __VDSO_MMAN_H +#define __VDSO_MMAN_H + +#include + +#endif /* __VDSO_MMAN_H */ From patchwork Mon Sep 23 14:19:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincenzo Frascino X-Patchwork-Id: 13809666 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 599A1CF9C69 for ; Mon, 23 Sep 2024 14:20:04 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DFB5D6B0089; Mon, 23 Sep 2024 10:20:03 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DAB206B008A; Mon, 23 Sep 2024 10:20:03 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BFDBA6B008C; Mon, 23 Sep 2024 10:20:03 -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 9BFBA6B0089 for ; Mon, 23 Sep 2024 10:20:03 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 4CA14ABCB8 for ; Mon, 23 Sep 2024 14:20:03 +0000 (UTC) X-FDA: 82596212286.25.957C741 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf23.hostedemail.com (Postfix) with ESMTP id 868A814000E for ; Mon, 23 Sep 2024 14:20:01 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=none; spf=pass (imf23.hostedemail.com: domain of vincenzo.frascino@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=vincenzo.frascino@arm.com; dmarc=pass (policy=none) header.from=arm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1727101083; 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=2NBRiRLF7F1dHEwYLK8ctNUH9+5bNe1aa+MHudLnGs0=; b=pc3ebez5esGBo0zgyRIhVJYIymEkSniyFMQLvOYV1un8RAOVhu+e5bEdwOM+mTpEqsMMt7 LK9SETyoxi6excYmgrGzQdW9Un1ZVlvqzp0ifdJAhZ0IIIaG+acV/zOm+wPKEdA7+DhByt dNjIxLTfSZPLWMLbFmADn6B+MP6Mwe0= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1727101083; a=rsa-sha256; cv=none; b=ZnxE0HlX7fJgtjdk1gRCrnDNYLoYVcEAUAG4cao5zSgmsQeeeM9I8vFB9IJd1ywn2qS14W R49nC/2qBgigWwEYCo7QEiEc2Fhq5h4Wmq1+Qq7twSyPt3RXR7fCe7AURKkRQXpPFBm6Eh lTFB6TZ4hOGImpiPcCwOkW6Y0kTQmVQ= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=none; spf=pass (imf23.hostedemail.com: domain of vincenzo.frascino@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=vincenzo.frascino@arm.com; dmarc=pass (policy=none) header.from=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 59382143D; Mon, 23 Sep 2024 07:20:30 -0700 (PDT) Received: from e119884-lin.cambridge.arm.com (e119884-lin.cambridge.arm.com [10.1.196.72]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 551AF3F64C; Mon, 23 Sep 2024 07:19:58 -0700 (PDT) From: Vincenzo Frascino To: linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linux-mm@kvack.org Cc: Vincenzo Frascino , Andy Lutomirski , Thomas Gleixner , "Jason A . Donenfeld" , Christophe Leroy , Michael Ellerman , Nicholas Piggin , Naveen N Rao , Ingo Molnar , Borislav Petkov , Dave Hansen , "H . Peter Anvin" , Theodore Ts'o , Arnd Bergmann , Andrew Morton , Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers Subject: [PATCH v2 4/8] vdso: Introduce vdso/page.h Date: Mon, 23 Sep 2024 15:19:39 +0100 Message-Id: <20240923141943.133551-5-vincenzo.frascino@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240923141943.133551-1-vincenzo.frascino@arm.com> References: <20240923141943.133551-1-vincenzo.frascino@arm.com> MIME-Version: 1.0 X-Stat-Signature: fybcsek8sou8ff1qkp1r6snjfnbpuax4 X-Rspamd-Queue-Id: 868A814000E X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1727101201-114278 X-HE-Meta: U2FsdGVkX1+NCA65XgvYGS8irxm7T8TXkIbWxBFvQrzmAUVoBOXgGw0OkqAum75U9uzKre6TC8xP8H7BKJoYF2AJ9LTngAw4RnyEK308jGGKOtDyb4aaN7EWjoCqINtwAvBDSox36Ft5esfu3ksvxv9g4u03Q6jQveSqn9VLBR7J9Y26cwg/dx55bAAW0vY6RM4oWZHb998BQPZsNHm1p824QrU0DKajVOAEw4XqLbPnQ4yaSBNluCuioLmxEClU53lcrcsa4dzSBv0jHm98SR5k0izO6Su6K2UwfILpfVa5YmT6+jxFB23wEQoOpjyd9bAX7zbohZTqxPVSNijshKWR6208vm81zu2OdENQd4MWBMpUSpA8yZizkSXgkMb2pfPVaH+WDM/mZ9vTJv8VaIUgiX/LC38tWxTvBJs/5pyfWZJUCljgG31O6zePRpdgRj64N9v8ifZVRG0OPUzIqqvpPt4a66u0BvDWlamx0PTAdTOrQtHFHdIvpZoPS1qNep4K6upaDY9dllDGPgkOJIEo6Xbp/uGk1ioUcIBU53ZMI3Lg6t05zHT8q9lKUuA+Pq3NWGqOp8TK1ZS7Bqv2Q+mLugVDZJRSqaQ9weO4NMsxJufCFyMYqgYBuGbn3nSUDDiaqxrosEr0EVR9cBotMahFGig+s/uvisbDGPiPW1iEQGhk5eNCKGqZ+opPeQ7m8/HH/fhL351xNSTLSNs2j0SBDnTv8lewduPdDJbPeU1NbvD1I2vA2q07ot4v/z+BOkN8R6Bc92dfZwNqP2tBqcKjM347KrGLsGxLEm1H72qym9uV7oRprgLfLG3eX88DG31FGEr58k+oziO/k2fQJfDlt8plZMjV+9nRpre+DjIwwoFtTBuNRNfA1f9OOXnzOu8tzD1C6zcenMFu4DTbIu3k4FbmKOvNciO4kkbX2LFyBhH3R+0t/ApB8N+r3za/5VZBc71hH8BcvFcMyIC j0KH3ZGT q2s8HgMBinkPoSiWtO0LiIMVoqLyyDpnrT4qocrZZ4CX8eqUZMtkd4KuyeCgHZ3gHwoNnfRUbNV/EWLnaE13Tec5hYAKnjKB1CDMIf/WP9UhOIgIxCkg8yzBnHranHouH2N0xTxx/bUtivLb1miMnTVyQ6+OI7kbz6B1svhKUchkF6gt/CZO9FpMRJUaEoCojSwMjG8gteg6ki9PiQaBE+DCo+cDUk17rWH4NKxVXSgEGth8= 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: The VDSO implementation includes headers from outside of the vdso/ namespace. Introduce vdso/page.h to make sure that the generic library uses only the allowed namespace. Cc: Andy Lutomirski Cc: Thomas Gleixner Cc: Jason A. Donenfeld Signed-off-by: Vincenzo Frascino --- arch/alpha/include/asm/page.h | 6 +----- arch/arc/include/uapi/asm/page.h | 7 +++---- arch/arm/include/asm/page.h | 5 +---- arch/arm64/include/asm/page-def.h | 5 +---- arch/csky/include/asm/page.h | 8 ++------ arch/hexagon/include/asm/page.h | 4 +--- arch/loongarch/include/asm/page.h | 7 +------ arch/m68k/include/asm/page.h | 6 ++---- arch/microblaze/include/asm/page.h | 5 +---- arch/mips/include/asm/page.h | 7 +------ arch/nios2/include/asm/page.h | 7 +------ arch/openrisc/include/asm/page.h | 11 +---------- arch/parisc/include/asm/page.h | 4 +--- arch/powerpc/include/asm/page.h | 10 +--------- arch/riscv/include/asm/page.h | 4 +--- arch/s390/include/asm/page.h | 4 +--- arch/sh/include/asm/page.h | 6 ++---- arch/sparc/include/asm/page_32.h | 4 +--- arch/sparc/include/asm/page_64.h | 4 +--- arch/um/include/asm/page.h | 5 +---- arch/x86/include/asm/page_types.h | 5 +---- arch/xtensa/include/asm/page.h | 8 +------- include/vdso/page.h | 18 ++++++++++++++++++ 23 files changed, 45 insertions(+), 105 deletions(-) create mode 100644 include/vdso/page.h diff --git a/arch/alpha/include/asm/page.h b/arch/alpha/include/asm/page.h index 70419e6be1a3..261af54fd601 100644 --- a/arch/alpha/include/asm/page.h +++ b/arch/alpha/include/asm/page.h @@ -4,11 +4,7 @@ #include #include - -/* PAGE_SHIFT determines the page size */ -#define PAGE_SHIFT CONFIG_PAGE_SHIFT -#define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT) -#define PAGE_MASK (~(PAGE_SIZE-1)) +#include #ifndef __ASSEMBLY__ diff --git a/arch/arc/include/uapi/asm/page.h b/arch/arc/include/uapi/asm/page.h index 7fd9e741b527..4606a326af5c 100644 --- a/arch/arc/include/uapi/asm/page.h +++ b/arch/arc/include/uapi/asm/page.h @@ -14,7 +14,7 @@ /* PAGE_SHIFT determines the page size */ #ifdef __KERNEL__ -#define PAGE_SHIFT CONFIG_PAGE_SHIFT +#include #else /* * Default 8k @@ -24,11 +24,10 @@ * not available */ #define PAGE_SHIFT 13 +#define PAGE_SIZE _BITUL(PAGE_SHIFT) /* Default 8K */ +#define PAGE_MASK (~(PAGE_SIZE-1)) #endif -#define PAGE_SIZE _BITUL(PAGE_SHIFT) /* Default 8K */ #define PAGE_OFFSET _AC(0x80000000, UL) /* Kernel starts at 2G onwrds */ -#define PAGE_MASK (~(PAGE_SIZE-1)) - #endif /* _UAPI__ASM_ARC_PAGE_H */ diff --git a/arch/arm/include/asm/page.h b/arch/arm/include/asm/page.h index 62af9f7f9e96..ef11b721230e 100644 --- a/arch/arm/include/asm/page.h +++ b/arch/arm/include/asm/page.h @@ -7,10 +7,7 @@ #ifndef _ASMARM_PAGE_H #define _ASMARM_PAGE_H -/* PAGE_SHIFT determines the page size */ -#define PAGE_SHIFT CONFIG_PAGE_SHIFT -#define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT) -#define PAGE_MASK (~((1 << PAGE_SHIFT) - 1)) +#include #ifndef __ASSEMBLY__ diff --git a/arch/arm64/include/asm/page-def.h b/arch/arm64/include/asm/page-def.h index 792e9fe881dc..d402e08442ee 100644 --- a/arch/arm64/include/asm/page-def.h +++ b/arch/arm64/include/asm/page-def.h @@ -10,9 +10,6 @@ #include -/* PAGE_SHIFT determines the page size */ -#define PAGE_SHIFT CONFIG_PAGE_SHIFT -#define PAGE_SIZE (_AC(1, UL) << PAGE_SHIFT) -#define PAGE_MASK (~(PAGE_SIZE-1)) +#include #endif /* __ASM_PAGE_DEF_H */ diff --git a/arch/csky/include/asm/page.h b/arch/csky/include/asm/page.h index 0ca6c408c07f..f8beae295afb 100644 --- a/arch/csky/include/asm/page.h +++ b/arch/csky/include/asm/page.h @@ -7,12 +7,8 @@ #include #include -/* - * PAGE_SHIFT determines the page size: 4KB - */ -#define PAGE_SHIFT CONFIG_PAGE_SHIFT -#define PAGE_SIZE (_AC(1, UL) << PAGE_SHIFT) -#define PAGE_MASK (~(PAGE_SIZE - 1)) +#include + #define THREAD_SIZE (PAGE_SIZE * 2) #define THREAD_MASK (~(THREAD_SIZE - 1)) #define THREAD_SHIFT (PAGE_SHIFT + 1) diff --git a/arch/hexagon/include/asm/page.h b/arch/hexagon/include/asm/page.h index 8a6af57274c2..b01f8df69dd4 100644 --- a/arch/hexagon/include/asm/page.h +++ b/arch/hexagon/include/asm/page.h @@ -45,9 +45,7 @@ #define HVM_HUGEPAGE_SIZE 0x5 #endif -#define PAGE_SHIFT CONFIG_PAGE_SHIFT -#define PAGE_SIZE (1UL << PAGE_SHIFT) -#define PAGE_MASK (~((1 << PAGE_SHIFT) - 1)) +#include #ifdef __KERNEL__ #ifndef __ASSEMBLY__ diff --git a/arch/loongarch/include/asm/page.h b/arch/loongarch/include/asm/page.h index e85df33f11c7..83f3533e31a4 100644 --- a/arch/loongarch/include/asm/page.h +++ b/arch/loongarch/include/asm/page.h @@ -8,12 +8,7 @@ #include #include -/* - * PAGE_SHIFT determines the page size - */ -#define PAGE_SHIFT CONFIG_PAGE_SHIFT -#define PAGE_SIZE (_AC(1, UL) << PAGE_SHIFT) -#define PAGE_MASK (~(PAGE_SIZE - 1)) +#include #define HPAGE_SHIFT (PAGE_SHIFT + PAGE_SHIFT - 3) #define HPAGE_SIZE (_AC(1, UL) << HPAGE_SHIFT) diff --git a/arch/m68k/include/asm/page.h b/arch/m68k/include/asm/page.h index 8cfb84b49975..b173ba27d36f 100644 --- a/arch/m68k/include/asm/page.h +++ b/arch/m68k/include/asm/page.h @@ -6,10 +6,8 @@ #include #include -/* PAGE_SHIFT determines the page size */ -#define PAGE_SHIFT CONFIG_PAGE_SHIFT -#define PAGE_SIZE (_AC(1, UL) << PAGE_SHIFT) -#define PAGE_MASK (~(PAGE_SIZE-1)) +#include + #define PAGE_OFFSET (PAGE_OFFSET_RAW) #ifndef __ASSEMBLY__ diff --git a/arch/microblaze/include/asm/page.h b/arch/microblaze/include/asm/page.h index 8810f4f1c3b0..d1ec3806edab 100644 --- a/arch/microblaze/include/asm/page.h +++ b/arch/microblaze/include/asm/page.h @@ -19,10 +19,7 @@ #ifdef __KERNEL__ -/* PAGE_SHIFT determines the page size */ -#define PAGE_SHIFT CONFIG_PAGE_SHIFT -#define PAGE_SIZE (ASM_CONST(1) << PAGE_SHIFT) -#define PAGE_MASK (~(PAGE_SIZE-1)) +#include #define LOAD_OFFSET ASM_CONST((CONFIG_KERNEL_START-CONFIG_KERNEL_BASE_ADDR)) diff --git a/arch/mips/include/asm/page.h b/arch/mips/include/asm/page.h index 4609cb0326cf..bc3e3484c1bf 100644 --- a/arch/mips/include/asm/page.h +++ b/arch/mips/include/asm/page.h @@ -14,12 +14,7 @@ #include #include -/* - * PAGE_SHIFT determines the page size - */ -#define PAGE_SHIFT CONFIG_PAGE_SHIFT -#define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT) -#define PAGE_MASK (~((1 << PAGE_SHIFT) - 1)) +#include /* * This is used for calculating the real page sizes diff --git a/arch/nios2/include/asm/page.h b/arch/nios2/include/asm/page.h index 0722f88e63cc..2897ec1b74f6 100644 --- a/arch/nios2/include/asm/page.h +++ b/arch/nios2/include/asm/page.h @@ -18,12 +18,7 @@ #include #include -/* - * PAGE_SHIFT determines the page size - */ -#define PAGE_SHIFT CONFIG_PAGE_SHIFT -#define PAGE_SIZE (_AC(1, UL) << PAGE_SHIFT) -#define PAGE_MASK (~(PAGE_SIZE - 1)) +#include /* * PAGE_OFFSET -- the first address of the first page of memory. diff --git a/arch/openrisc/include/asm/page.h b/arch/openrisc/include/asm/page.h index 1d5913f67c31..124a2db4b160 100644 --- a/arch/openrisc/include/asm/page.h +++ b/arch/openrisc/include/asm/page.h @@ -15,16 +15,7 @@ #ifndef __ASM_OPENRISC_PAGE_H #define __ASM_OPENRISC_PAGE_H - -/* PAGE_SHIFT determines the page size */ - -#define PAGE_SHIFT CONFIG_PAGE_SHIFT -#ifdef __ASSEMBLY__ -#define PAGE_SIZE (1 << PAGE_SHIFT) -#else -#define PAGE_SIZE (1UL << PAGE_SHIFT) -#endif -#define PAGE_MASK (~(PAGE_SIZE-1)) +#include #define PAGE_OFFSET 0xc0000000 #define KERNELBASE PAGE_OFFSET diff --git a/arch/parisc/include/asm/page.h b/arch/parisc/include/asm/page.h index 4bea2e95798f..6c4836fb5407 100644 --- a/arch/parisc/include/asm/page.h +++ b/arch/parisc/include/asm/page.h @@ -4,9 +4,7 @@ #include -#define PAGE_SHIFT CONFIG_PAGE_SHIFT -#define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT) -#define PAGE_MASK (~(PAGE_SIZE-1)) +#include #define HAVE_ARCH_HUGETLB_UNMAPPED_AREA diff --git a/arch/powerpc/include/asm/page.h b/arch/powerpc/include/asm/page.h index 83d0a4fc5f75..af9a2628d1df 100644 --- a/arch/powerpc/include/asm/page.h +++ b/arch/powerpc/include/asm/page.h @@ -21,8 +21,7 @@ * page size. When using 64K pages however, whether we are really supporting * 64K pages in HW or not is irrelevant to those definitions. */ -#define PAGE_SHIFT CONFIG_PAGE_SHIFT -#define PAGE_SIZE (ASM_CONST(1) << PAGE_SHIFT) +#include #ifndef __ASSEMBLY__ #ifndef CONFIG_HUGETLB_PAGE @@ -41,13 +40,6 @@ extern unsigned int hpage_shift; #define HUGE_MAX_HSTATE (MMU_PAGE_COUNT-1) #endif -/* - * Subtle: (1 << PAGE_SHIFT) is an int, not an unsigned long. So if we - * assign PAGE_MASK to a larger type it gets extended the way we want - * (i.e. with 1s in the high bits) - */ -#define PAGE_MASK (~((1 << PAGE_SHIFT) - 1)) - /* * KERNELBASE is the virtual address of the start of the kernel, it's often * the same as PAGE_OFFSET, but _might not be_. diff --git a/arch/riscv/include/asm/page.h b/arch/riscv/include/asm/page.h index 7ede2111c591..1b685896340a 100644 --- a/arch/riscv/include/asm/page.h +++ b/arch/riscv/include/asm/page.h @@ -12,9 +12,7 @@ #include #include -#define PAGE_SHIFT CONFIG_PAGE_SHIFT -#define PAGE_SIZE (_AC(1, UL) << PAGE_SHIFT) -#define PAGE_MASK (~(PAGE_SIZE - 1)) +#include #define HPAGE_SHIFT PMD_SHIFT #define HPAGE_SIZE (_AC(1, UL) << HPAGE_SHIFT) diff --git a/arch/s390/include/asm/page.h b/arch/s390/include/asm/page.h index 16e4caa931f1..773e0aee8ce3 100644 --- a/arch/s390/include/asm/page.h +++ b/arch/s390/include/asm/page.h @@ -11,9 +11,7 @@ #include #include -#define _PAGE_SHIFT CONFIG_PAGE_SHIFT -#define _PAGE_SIZE (_AC(1, UL) << _PAGE_SHIFT) -#define _PAGE_MASK (~(_PAGE_SIZE - 1)) +#include /* PAGE_SHIFT determines the page size */ #define PAGE_SHIFT _PAGE_SHIFT diff --git a/arch/sh/include/asm/page.h b/arch/sh/include/asm/page.h index f780b467e75d..fc39b8171bfb 100644 --- a/arch/sh/include/asm/page.h +++ b/arch/sh/include/asm/page.h @@ -8,10 +8,8 @@ #include -/* PAGE_SHIFT determines the page size */ -#define PAGE_SHIFT CONFIG_PAGE_SHIFT -#define PAGE_SIZE (_AC(1, UL) << PAGE_SHIFT) -#define PAGE_MASK (~(PAGE_SIZE-1)) +#include + #define PTE_MASK PAGE_MASK #if defined(CONFIG_HUGETLB_PAGE_SIZE_64K) diff --git a/arch/sparc/include/asm/page_32.h b/arch/sparc/include/asm/page_32.h index 9977c77374cd..9954254ea569 100644 --- a/arch/sparc/include/asm/page_32.h +++ b/arch/sparc/include/asm/page_32.h @@ -11,9 +11,7 @@ #include -#define PAGE_SHIFT CONFIG_PAGE_SHIFT -#define PAGE_SIZE (_AC(1, UL) << PAGE_SHIFT) -#define PAGE_MASK (~(PAGE_SIZE-1)) +#include #ifndef __ASSEMBLY__ diff --git a/arch/sparc/include/asm/page_64.h b/arch/sparc/include/asm/page_64.h index e9bd24821c93..2a68ff5b6eab 100644 --- a/arch/sparc/include/asm/page_64.h +++ b/arch/sparc/include/asm/page_64.h @@ -4,9 +4,7 @@ #include -#define PAGE_SHIFT CONFIG_PAGE_SHIFT -#define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT) -#define PAGE_MASK (~(PAGE_SIZE-1)) +#include /* Flushing for D-cache alias handling is only needed if * the page size is smaller than 16K. diff --git a/arch/um/include/asm/page.h b/arch/um/include/asm/page.h index 9ef9a8aedfa6..834313ecd3d6 100644 --- a/arch/um/include/asm/page.h +++ b/arch/um/include/asm/page.h @@ -9,10 +9,7 @@ #include -/* PAGE_SHIFT determines the page size */ -#define PAGE_SHIFT CONFIG_PAGE_SHIFT -#define PAGE_SIZE (_AC(1, UL) << PAGE_SHIFT) -#define PAGE_MASK (~(PAGE_SIZE-1)) +#include #ifndef __ASSEMBLY__ diff --git a/arch/x86/include/asm/page_types.h b/arch/x86/include/asm/page_types.h index 52f1b4ff0cc1..974688973cf6 100644 --- a/arch/x86/include/asm/page_types.h +++ b/arch/x86/include/asm/page_types.h @@ -6,10 +6,7 @@ #include #include -/* PAGE_SHIFT determines the page size */ -#define PAGE_SHIFT CONFIG_PAGE_SHIFT -#define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT) -#define PAGE_MASK (~(PAGE_SIZE-1)) +#include #define __VIRTUAL_MASK ((1UL << __VIRTUAL_MASK_SHIFT) - 1) diff --git a/arch/xtensa/include/asm/page.h b/arch/xtensa/include/asm/page.h index 4db56ef052d2..595c1037b738 100644 --- a/arch/xtensa/include/asm/page.h +++ b/arch/xtensa/include/asm/page.h @@ -18,13 +18,7 @@ #include #include -/* - * PAGE_SHIFT determines the page size - */ - -#define PAGE_SHIFT CONFIG_PAGE_SHIFT -#define PAGE_SIZE (__XTENSA_UL_CONST(1) << PAGE_SHIFT) -#define PAGE_MASK (~(PAGE_SIZE-1)) +#include #ifdef CONFIG_MMU #define PAGE_OFFSET XCHAL_KSEG_CACHED_VADDR diff --git a/include/vdso/page.h b/include/vdso/page.h new file mode 100644 index 000000000000..df8d307f38cd --- /dev/null +++ b/include/vdso/page.h @@ -0,0 +1,18 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __VDSO_PAGE_H +#define __VDSO_PAGE_H + +#include + +/* PAGE_SHIFT determines the page size */ +#define PAGE_SHIFT CONFIG_PAGE_SHIFT + +#define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT) + +#if defined(CONFIG_PHYS_ADDR_T_64BIT) && !defined(CONFIG_X86_64) +#define PAGE_MASK (~((1 << PAGE_SHIFT) - 1)) +#else +#define PAGE_MASK (~(PAGE_SIZE-1)) +#endif + +#endif /* __VDSO_PAGE_H */ From patchwork Mon Sep 23 14:19:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincenzo Frascino X-Patchwork-Id: 13809667 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 2B635CF9C70 for ; Mon, 23 Sep 2024 14:20:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8A43A6B008A; Mon, 23 Sep 2024 10:20:06 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 838306B008C; Mon, 23 Sep 2024 10:20:06 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5E4486B0092; Mon, 23 Sep 2024 10:20:06 -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 3A6CC6B008A for ; Mon, 23 Sep 2024 10:20:06 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id E4DF2413A9 for ; Mon, 23 Sep 2024 14:20:05 +0000 (UTC) X-FDA: 82596212370.18.322965B Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf27.hostedemail.com (Postfix) with ESMTP id 4346A40010 for ; Mon, 23 Sep 2024 14:20:04 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=none; spf=pass (imf27.hostedemail.com: domain of vincenzo.frascino@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=vincenzo.frascino@arm.com; dmarc=pass (policy=none) header.from=arm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1727101169; 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=ME/06rBWJWCtiTm5FPRXUJj42FK9dFCN3ZjoS10xJfs=; b=sIaoJ32P8QWwAn8ts9DvHgHkLtPZ61K3zA75k+SSMPKdJxNFItiXs2qa8NQ8nWIpxJBA9A e0IBEwVhftFb8DPLo6q0UHNj12OMLbu44YpNA8TcURh7P2fvrG0qBpkopYtgds4wYlgA8e qvg1U3SdGnr9KwQ4f1vYUaOPRNi2uy4= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=none; spf=pass (imf27.hostedemail.com: domain of vincenzo.frascino@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=vincenzo.frascino@arm.com; dmarc=pass (policy=none) header.from=arm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1727101169; a=rsa-sha256; cv=none; b=uFIQdO0MVuIUN+hvMesuuJt8xYWmmkM9l1Olyvqxpt2zcwtLSPDeQzu4OrTthSSlXtxGJa SiDNg5zd4EzC7nSPjGOBG2iyB48RKd1Ulh6X75TH/feP2oCNza8RKZAtcQ0JfNr01dNFup F61K1+ZH/BNLB7m4RE7LyolyknFAmZU= Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 0DB0F1007; Mon, 23 Sep 2024 07:20:33 -0700 (PDT) Received: from e119884-lin.cambridge.arm.com (e119884-lin.cambridge.arm.com [10.1.196.72]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 24BE43F64C; Mon, 23 Sep 2024 07:20:01 -0700 (PDT) From: Vincenzo Frascino To: linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linux-mm@kvack.org Cc: Vincenzo Frascino , Andy Lutomirski , Thomas Gleixner , "Jason A . Donenfeld" , Christophe Leroy , Michael Ellerman , Nicholas Piggin , Naveen N Rao , Ingo Molnar , Borislav Petkov , Dave Hansen , "H . Peter Anvin" , Theodore Ts'o , Arnd Bergmann , Andrew Morton , Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers Subject: [PATCH v2 5/8] x86: vdso: Modify asm/vdso/getrandom.h to include datapage Date: Mon, 23 Sep 2024 15:19:40 +0100 Message-Id: <20240923141943.133551-6-vincenzo.frascino@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240923141943.133551-1-vincenzo.frascino@arm.com> References: <20240923141943.133551-1-vincenzo.frascino@arm.com> MIME-Version: 1.0 X-Rspam-User: X-Stat-Signature: 4fuikuxhokywmajk3o3uhnhhbpp8b1zp X-Rspamd-Queue-Id: 4346A40010 X-Rspamd-Server: rspam11 X-HE-Tag: 1727101204-802766 X-HE-Meta: U2FsdGVkX19a5NU+GZUs6+y0YSwEpCrpENE0X3sckh3wszpFwzWfKBFuNyoqpmtMHN1fw9/1JRqxhNnIJnqOVBYMXYMAgqd/QJplkjSyiUtUoZa0CzpKlBYuZcaTJgxuwvv+Ln4BZ74Q+oeCA6RUB1/UoLGaSwN+HEmzGjM5Q1lpY8q1DY31ty8IcUAuABBLid8sQOoYb5+WjPO2o7wGxQP7qXdROUNeqHrddlxOCS1ZRaglIq09CjHQlS7BNiXYIfjbOwnqOon5UGkwO18UDzkDQB2M5BEOqYmWnnDaQZK9Z+trKABrexctPuWfcjBzdI9eakbR6Y3B2Nzg0dCz5vKUVV5iTBU+gh0XRKlZsrcir87WCKxBMIsQdHja3IVCi9tW1t+hFjaunwlO1I4oUe8rIritvj37A7x7HPYpfLce7/S+4qEVB8ei3dtFNwvHzaqgWeLPXm+Bo5xH/v4FFugHBbIPvS5/FaV3MuqWgRiMJYy8/lsmmt+HvegzeybRGIifJ8M7FZ8xQ4FbQTgLWYi6/JSQYAYF4XoKjiJMkNNI83U0JjmnNuhFI0OvdiVl6hEVkAQCJK0i9JYgxJmAwj2s6SQ8gXo3qmPmxcskTaS3v+gD0X5jZhPrfmm0Q+GWVzFhso1bh8hZ9EALmj5Pk/psYju862ttT69vlLf8PIV2mWdzawK4C9o77C+Nxbre9kvhNNb0KJbSSZUmKD5FymijkRw+DSQ/iHUZLRxAjyIYVvGPMCrZPhr4Kh7D3Vdgs7Cifbn2jiPy6tyRQZe0XY4yy97rrZX4GmNxnda0ZYV6It88PSxCq3OPSgEbZPhnEof1m127A5HgrdJHp9q5mYLMYCtg6q3V2rmfrKt+qy5uUcGQKsSHFu+d6ggBv3gO8ISGXgufAFdsMx4lE/M06xK8IJNYbWFOurgsvVSkHW4FWxju4mVcJYeUzK7MynxiMZxRXAEI86MlfNB8lTJ 2KaFd0aa /iFM2nXLE8MIJJQkLzrdpu7sKz7uWPEx528GE38Ne125dNMHZpsNjQJJQM/fmVCWQV2siqYp5Uxf+zg1rClT9mWY+1rKieB2I2VL+J67H5Z0sy5WyzxjRgSOdKzO4iw7ucOSX91T+BpiBbdPBxONiBSN0mPYu3QldQZ/NiiT+XZjRsQAbvA4RxqJOjMlBruP5k4QurIhI0XNQXhuZwEt+i945treF0kmRt+Q0RA9xn+vqJQQ= 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: The VDSO implementation includes headers from outside of the vdso/ namespace. Modify asm/vdso/getrandom.h to include datapage. Cc: Andy Lutomirski Cc: Thomas Gleixner Cc: Jason A. Donenfeld Signed-off-by: Vincenzo Frascino --- arch/x86/include/asm/vdso/getrandom.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/x86/include/asm/vdso/getrandom.h b/arch/x86/include/asm/vdso/getrandom.h index ff5334ad32a0..4597d5a6f094 100644 --- a/arch/x86/include/asm/vdso/getrandom.h +++ b/arch/x86/include/asm/vdso/getrandom.h @@ -7,6 +7,8 @@ #ifndef __ASSEMBLY__ +#include + #include #include From patchwork Mon Sep 23 14:19:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincenzo Frascino X-Patchwork-Id: 13809668 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 DEAE4CF9C70 for ; Mon, 23 Sep 2024 14:20:09 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4FA056B008C; Mon, 23 Sep 2024 10:20:09 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4A9F06B0092; Mon, 23 Sep 2024 10:20:09 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 371246B0093; Mon, 23 Sep 2024 10:20:09 -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 1920E6B008C for ; Mon, 23 Sep 2024 10:20:09 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 88DC04138C for ; Mon, 23 Sep 2024 14:20:08 +0000 (UTC) X-FDA: 82596212496.13.EB22EE7 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf01.hostedemail.com (Postfix) with ESMTP id E520B4000C for ; Mon, 23 Sep 2024 14:20:06 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=none; spf=pass (imf01.hostedemail.com: domain of vincenzo.frascino@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=vincenzo.frascino@arm.com; dmarc=pass (policy=none) header.from=arm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1727101147; 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=zsNs11n69htr6UMzLaPpUXDs7ESsTM7Di0tsH6nHGQs=; b=P4Apub3Aq7aBGHKkGK4hTDonaylhVGrNol6SBTE+vlnIGxzxuwc28xAcjMHI26Feela/i5 7piRJgR0FrBK5hB5Fp5A3TVhwi2p4Lux1+7JSrLzg+xONCmEvAm4i9uUD6s+RgqbwIYGCz CHvA3m/sxM1ZS4yJ56Jwjq1laARg1AY= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=none; spf=pass (imf01.hostedemail.com: domain of vincenzo.frascino@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=vincenzo.frascino@arm.com; dmarc=pass (policy=none) header.from=arm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1727101147; a=rsa-sha256; cv=none; b=z7cJ44VwmnhTGYiDg16OojKc+3gDG7IdiXjlPnE+qGS0e086UmPx577wSWlSp6cLeL4zdq BSQD3ilf9tFsM4FmwkFm9F32nIeylhHpvObxNzMIvAPo3e/tS2NrwUwtp5Dk1ZctZFKVeh vsxXzygUs1/3M3e+zLsurgrW0dudMDY= Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id B6FACFEC; Mon, 23 Sep 2024 07:20:35 -0700 (PDT) Received: from e119884-lin.cambridge.arm.com (e119884-lin.cambridge.arm.com [10.1.196.72]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id CDBCE3F64C; Mon, 23 Sep 2024 07:20:03 -0700 (PDT) From: Vincenzo Frascino To: linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linux-mm@kvack.org Cc: Vincenzo Frascino , Andy Lutomirski , Thomas Gleixner , "Jason A . Donenfeld" , Christophe Leroy , Michael Ellerman , Nicholas Piggin , Naveen N Rao , Ingo Molnar , Borislav Petkov , Dave Hansen , "H . Peter Anvin" , Theodore Ts'o , Arnd Bergmann , Andrew Morton , Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers Subject: [PATCH v2 6/8] vdso: Modify vdso/getrandom.h to include the asm header Date: Mon, 23 Sep 2024 15:19:41 +0100 Message-Id: <20240923141943.133551-7-vincenzo.frascino@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240923141943.133551-1-vincenzo.frascino@arm.com> References: <20240923141943.133551-1-vincenzo.frascino@arm.com> MIME-Version: 1.0 X-Rspamd-Server: rspam03 X-Rspam-User: X-Rspamd-Queue-Id: E520B4000C X-Stat-Signature: xj57raraa9ksbmq1zy9k9yotwaeobk5n X-HE-Tag: 1727101206-452742 X-HE-Meta: U2FsdGVkX1+BuKfHEoQaNuubBr2OPGNWO73iVVDoF4A+18DF6wgTOL1ZVCfk/JRd06W722ly5OQ6YU8w1OLx59/rHTOK0NmHod30Yzh7vlBmwjc4Kl7aF717Jpf4r/LduupFtrktECkho0026wss9VEkXrPl/utcp1/385XTOmA3g2bmlpgKutwrGoifxRtW1YZaQLXJvHXZqD7wQF8EsMBRpyaM66YtxIaNTWnKUgv6/MkCrQF4g8ZhNLXQhGcWRNuyKUOV10qn2nZddigcFzdbm6MDJCbDP6jAkHxb/VfEAa4hm/X0HCleXKdW1amVJAka8KBrUZcMKeOE4ufaHciSfIsMa//uInLAVbFD/PmKkURpPPut/U/ORh8ew/q44L0bKfTBFMAcf3eAmsPrxu6rmto1uO8S3suxg0AjcMmT4eqtEGf3I9scaz2uZ6T5wTbeRxXEKovvwTmsta/4REv7A3p54JTe2HKZm2V/7GdbVWZk7f8bl7xX1dkql2qOivAIXrTZJqJ7rsG+gcsbvhf9NCnOSjRQgSfbgC2R1B5fpo9bTyo1lzB6VsQgpUu5q0+8TVpJ/glvdmQg0Rkr9WagdqH8a62H3NWUIK4qCG60g0ZSz2zLfHuIz/KTAmZvbjEoLrs+9xsJhx9C8K+uHGvtiTel3Fy1TOILqOxLDT2j6/gHxHDiBCbOE01HvUaVRCKFE7v0yhFFEvpylnVW9UM1ju1P0eSNkG69ymeU1JI8t113nrHPqG0Xp0ttm9IKBRLetnHDkM8x/7P5Q+YGItEAMAFQQTC3DDlZ7TnTgjjUpdoxdLIfD4OtxCV6NeCTf3HsUNV1C4a/q9Km2z1UeKrhvQuZmdRS0/BKH95zEQYG/6TpoUs+XzhvHCLi+ZETjCQ438g4dU3PdQaDLGsC0IOm295o6plcc+yBIf3yJah8g6lCcS3vzM0Ny/mft4mEYyphC9zqB1oQovZTOic /KhsD0sB CP5ttbfjCLy5WZ+NMciWEeM/rHwQ6aAYvZdUjrkpcyhyrBi2oI5nkdJdlcfHNzDo5mT3YsjtDjRh6X+3+ziy/bP1FEq+OCX0WSFtYOaN1/JBPCK8xNmAsL4JqnCWJ8kz3ytVuEYF+Us1vC1EzBBeLJSlCy6cUebEe2d2DVzMNgGRmysKXL8aDHMCW9x1rv4g0GaFc8xYtMxGitPGU1xduehdwe6/5qCkWLYIIQurICYo212E= 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: The VDSO implementation includes headers from outside of the vdso/ namespace. Modify vdso/getrandom.h to include the getrandom asm header. Cc: Andy Lutomirski Cc: Thomas Gleixner Cc: Jason A. Donenfeld Signed-off-by: Vincenzo Frascino --- include/vdso/getrandom.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/vdso/getrandom.h b/include/vdso/getrandom.h index 6ca4d6de9e46..5cf3f75d6fb6 100644 --- a/include/vdso/getrandom.h +++ b/include/vdso/getrandom.h @@ -7,6 +7,7 @@ #define _VDSO_GETRANDOM_H #include +#include #define CHACHA_KEY_SIZE 32 #define CHACHA_BLOCK_SIZE 64 From patchwork Mon Sep 23 14:19:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincenzo Frascino X-Patchwork-Id: 13809669 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 6D918CF9C69 for ; Mon, 23 Sep 2024 14:20:12 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id EE5C96B0092; Mon, 23 Sep 2024 10:20:11 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E96916B0093; Mon, 23 Sep 2024 10:20:11 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D361A6B0095; Mon, 23 Sep 2024 10:20:11 -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 B8F7B6B0092 for ; Mon, 23 Sep 2024 10:20:11 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 68AD81413AF for ; Mon, 23 Sep 2024 14:20:11 +0000 (UTC) X-FDA: 82596212622.03.588FEF5 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf08.hostedemail.com (Postfix) with ESMTP id A1A82160010 for ; Mon, 23 Sep 2024 14:20:09 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=none; spf=pass (imf08.hostedemail.com: domain of vincenzo.frascino@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=vincenzo.frascino@arm.com; dmarc=pass (policy=none) header.from=arm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1727101175; 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=WnOCHp36Q6JihrxxvZmj8QU5R2HrAmjfFlnctnQM/d8=; b=0e7VIi4myOyU5SxhvKSHeA2R1H5j2+U3/ceo4Y6ncjHhhIZLl3qdviE8ZdfF6SpHqD3mYG U+BUv3w9j4kZtCXtBBWuFauf2Zk9UNb80jwPw4etLKc+5Z9Ja0hL/eiMC6XpVBH9XVKCKo CPQhficZDFCPnwUpG3jC5whgK0P2Tt0= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=none; spf=pass (imf08.hostedemail.com: domain of vincenzo.frascino@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=vincenzo.frascino@arm.com; dmarc=pass (policy=none) header.from=arm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1727101175; a=rsa-sha256; cv=none; b=r37VU7sKuU1cEIegxJIDoC/qR0mc7jNSVjibZSVOha/cHdAaR1LlfPhlg9Pmc3G6w9fA4w lLwmrhg9vDCmD9gWqytBS7A4scltexrwZdGA4jnaQ9Mh+2lgJCQL/xj9KV54MKjJWVH4K/ 2cKWzfSq3BKXhks9VabOJJdLD56sLuw= Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 6BCCB11FB; Mon, 23 Sep 2024 07:20:38 -0700 (PDT) Received: from e119884-lin.cambridge.arm.com (e119884-lin.cambridge.arm.com [10.1.196.72]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 82CB13F64C; Mon, 23 Sep 2024 07:20:06 -0700 (PDT) From: Vincenzo Frascino To: linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linux-mm@kvack.org Cc: Vincenzo Frascino , Andy Lutomirski , Thomas Gleixner , "Jason A . Donenfeld" , Christophe Leroy , Michael Ellerman , Nicholas Piggin , Naveen N Rao , Ingo Molnar , Borislav Petkov , Dave Hansen , "H . Peter Anvin" , Theodore Ts'o , Arnd Bergmann , Andrew Morton , Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers Subject: [PATCH v2 7/8] vdso: Introduce uapi/vdso/random.h Date: Mon, 23 Sep 2024 15:19:42 +0100 Message-Id: <20240923141943.133551-8-vincenzo.frascino@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240923141943.133551-1-vincenzo.frascino@arm.com> References: <20240923141943.133551-1-vincenzo.frascino@arm.com> MIME-Version: 1.0 X-Rspam-User: X-Stat-Signature: 793z4kr5e4ky7bg4gtzutj9moxogky7s X-Rspamd-Queue-Id: A1A82160010 X-Rspamd-Server: rspam11 X-HE-Tag: 1727101209-844748 X-HE-Meta: U2FsdGVkX18CxZH/vd8Sq8yoeTyvz8qqQNLfckcZzPmJjQbLN78pJB0LE5LTigY4P1t60PAQ9LNMDahIJJLhTABEdFtESJ+eeVMIVAHUtpIR735ZhqXucwRh0D5YsGeeDY30rkMFDRe5+2G1TRkAb+4NqjHFrnaSe9j/ko/0+Jxpd7FLqIS06mf9jlW0QqM8ElM0lWapzMK3HiJfQg/gqQsn//kwdZTpc+VpKFpsmLaEKMbDl9tFnohVFU2CdwmREZPM0VZnakb0srXi8j3eDkJoYyssjeQLy1BHrZ1VDTpapebv8gP3VmaqJWRS26XQZkIb1HAcYmxcqjw2mZIDGhAmIKHFbqUwVLXieRK1FS1bv2M+aAEInxrWUC9ZyPVFB3C8CDpvpHnmWL8XBxdPSItuYCbK2Rj69yDnWsuUu8kKG2GjK5fVdmmRtooi2tl1rm4G14NP6lO5pWamgmF73npsX1Uz1QAIxBYQAwFDDjJiYasA4ZMHbbD5fKyFkXhE3S17520QZaPiGCN1ZqWiGREG/OnWXrlHxCpazxCCGmFMHZ8sgUjlRut+auVacL/HCwF5G6dUAM+VG2/DpCsBog/FeDyx/280zG1OTdn5+lH2lNTFrwZfK+E4PaFNUbEZZ78BaMXJrv1FHukQExSeFVI3eIpMnbSOKcrJN6rvFleJ+q/H4rQgFAdzOeDsboGgg93SXTvDptL67ckcsGaZJh1a70fT0lU3IJws67HqfqnnqRQjFxrg7cz8u3DMTyBaAwP75Yp9cYU+c3IGxqq7+oeSvtnaJsDe9xiUP1KigYUMwyxE/uw5eT+3Y2zID0OvJVRE22QkTdzSlhIvJZ6RItQBW0WBAezU9RqPzVNv3X4BgkrwP5gbrAymPsyl/jmyT+KkYzgL7WUFpygxWEo5STJWOUNUEnMv5RyhXeAmetLtHSxD8Q7KazGO1dlkVgH64hH8azdrM3WJO+kamFh Hqlm5c/S 3rZEYYbjsb4gVyZXaAxPGDpSfJD1N1X3LJv7ia8o0Qz4gzp2gB2RrQyOsdxaJ3ycrcq0IkuZ6OI7s34UgrPRgEzVJTfWCZa/a/B5xYVlmn1l7s704ymEJ+fwLdE0JO77EJ/R3Qy88o2OWmVc2PnQC4lu/zc58JSmmEzujamXiZbD9h1EtHtmsxA5KcG9euCEl6ku1+ZaMg/uDgxTHESr718RpZpeU3dG/k8NX6npnVCJEPsI= 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: The VDSO implementation includes headers from outside of the vdso/ namespace. Introduce uapi/vdso/random.h to make sure that the generic library uses only the allowed namespace. Cc: Andy Lutomirski Cc: Thomas Gleixner Cc: Jason A. Donenfeld Signed-off-by: Vincenzo Frascino --- include/uapi/linux/random.h | 26 +------------------------ include/uapi/vdso/random.h | 38 +++++++++++++++++++++++++++++++++++++ include/vdso/datapage.h | 1 + 3 files changed, 40 insertions(+), 25 deletions(-) create mode 100644 include/uapi/vdso/random.h diff --git a/include/uapi/linux/random.h b/include/uapi/linux/random.h index 1dd047ec98a1..dc43ed800212 100644 --- a/include/uapi/linux/random.h +++ b/include/uapi/linux/random.h @@ -44,30 +44,6 @@ struct rand_pool_info { __u32 buf[]; }; -/* - * Flags for getrandom(2) - * - * GRND_NONBLOCK Don't block and return EAGAIN instead - * GRND_RANDOM No effect - * GRND_INSECURE Return non-cryptographic random bytes - */ -#define GRND_NONBLOCK 0x0001 -#define GRND_RANDOM 0x0002 -#define GRND_INSECURE 0x0004 - -/** - * struct vgetrandom_opaque_params - arguments for allocating memory for vgetrandom - * - * @size_per_opaque_state: Size of each state that is to be passed to vgetrandom(). - * @mmap_prot: Value of the prot argument in mmap(2). - * @mmap_flags: Value of the flags argument in mmap(2). - * @reserved: Reserved for future use. - */ -struct vgetrandom_opaque_params { - __u32 size_of_opaque_state; - __u32 mmap_prot; - __u32 mmap_flags; - __u32 reserved[13]; -}; +#include #endif /* _UAPI_LINUX_RANDOM_H */ diff --git a/include/uapi/vdso/random.h b/include/uapi/vdso/random.h new file mode 100644 index 000000000000..5c80995129c2 --- /dev/null +++ b/include/uapi/vdso/random.h @@ -0,0 +1,38 @@ + +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +/* + * include/vdso/random.h + * + * Include file for the random number generator. + */ + +#ifndef _UAPI_VDSO_RANDOM_H +#define _UAPI_VDSO_RANDOM_H + +/* + * Flags for getrandom(2) + * + * GRND_NONBLOCK Don't block and return EAGAIN instead + * GRND_RANDOM No effect + * GRND_INSECURE Return non-cryptographic random bytes + */ +#define GRND_NONBLOCK 0x0001 +#define GRND_RANDOM 0x0002 +#define GRND_INSECURE 0x0004 + +/** + * struct vgetrandom_opaque_params - arguments for allocating memory for vgetrandom + * + * @size_per_opaque_state: Size of each state that is to be passed to vgetrandom(). + * @mmap_prot: Value of the prot argument in mmap(2). + * @mmap_flags: Value of the flags argument in mmap(2). + * @reserved: Reserved for future use. + */ +struct vgetrandom_opaque_params { + __u32 size_of_opaque_state; + __u32 mmap_prot; + __u32 mmap_flags; + __u32 reserved[13]; +}; + +#endif /* _UAPI_VDSO_RANDOM_H */ diff --git a/include/vdso/datapage.h b/include/vdso/datapage.h index b85f24cac3f5..b7d6c71f20c1 100644 --- a/include/vdso/datapage.h +++ b/include/vdso/datapage.h @@ -8,6 +8,7 @@ #include #include #include +#include #include #include From patchwork Mon Sep 23 14:19:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincenzo Frascino X-Patchwork-Id: 13809670 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 0EDB3CF9C72 for ; Mon, 23 Sep 2024 14:20:15 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 93F1B6B0093; Mon, 23 Sep 2024 10:20:14 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8F15A6B0095; Mon, 23 Sep 2024 10:20:14 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7B8346B0096; Mon, 23 Sep 2024 10:20:14 -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 6063A6B0093 for ; Mon, 23 Sep 2024 10:20:14 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 0922E1C6873 for ; Mon, 23 Sep 2024 14:20:14 +0000 (UTC) X-FDA: 82596212748.22.82B613A Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf12.hostedemail.com (Postfix) with ESMTP id 4F3734000B for ; Mon, 23 Sep 2024 14:20:12 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=none; spf=pass (imf12.hostedemail.com: domain of vincenzo.frascino@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=vincenzo.frascino@arm.com; dmarc=pass (policy=none) header.from=arm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1727101094; 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=kbveDqJoVu08CXYmp8kmYr5W1Ok5zBD419JjfEoW+L0=; b=5VW+N1VeJquXTGIs1NQ+LTv6rVrIcYrPw9iVukvL7JgE/V1Ig8Bu/1/WayKBcqr9ehpsyG CgsayjX9Dih2Ze/2vXpEqvs2+4F+M9yHcdRaiokXgtrhGPOMf5HsGcbwsoRygZkOQIG8n9 C5qU6OD/gAZosdtV49v2wqPJk49NUxI= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1727101094; a=rsa-sha256; cv=none; b=BgpPeGcig8aNvdqOffNGgVbb+I9GOmAeS6MFwLByALTBogNkzeISIVRAJZmPvUUKXSAmgi 0gt5+GerBHte5uZjzgV910CXx1BD1ZR/JgOCx0uE/lBYX1VOiM/RSuXYJJa5Lr7mOaOL39 pvuoRvotvSJ4a4asgO2ofdTL3l1Od3Q= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=none; spf=pass (imf12.hostedemail.com: domain of vincenzo.frascino@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=vincenzo.frascino@arm.com; dmarc=pass (policy=none) header.from=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 21AD6FEC; Mon, 23 Sep 2024 07:20:41 -0700 (PDT) Received: from e119884-lin.cambridge.arm.com (e119884-lin.cambridge.arm.com [10.1.196.72]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 37AEC3F64C; Mon, 23 Sep 2024 07:20:09 -0700 (PDT) From: Vincenzo Frascino To: linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linux-mm@kvack.org Cc: Vincenzo Frascino , Andy Lutomirski , Thomas Gleixner , "Jason A . Donenfeld" , Christophe Leroy , Michael Ellerman , Nicholas Piggin , Naveen N Rao , Ingo Molnar , Borislav Petkov , Dave Hansen , "H . Peter Anvin" , Theodore Ts'o , Arnd Bergmann , Andrew Morton , Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers Subject: [PATCH v2 8/8] vdso: Modify getrandom to include the correct namespace. Date: Mon, 23 Sep 2024 15:19:43 +0100 Message-Id: <20240923141943.133551-9-vincenzo.frascino@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240923141943.133551-1-vincenzo.frascino@arm.com> References: <20240923141943.133551-1-vincenzo.frascino@arm.com> MIME-Version: 1.0 X-Stat-Signature: 8f45e5obe43q4zendc8wh456dohs68z6 X-Rspamd-Queue-Id: 4F3734000B X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1727101212-175777 X-HE-Meta: U2FsdGVkX1+dFU2pa+dTwkuy/ufhSVsNRcYmuzOr7kwfBPKa+uKYPh1qSI8T1e+o7RCOwm3StQj54G/M8H0STiyAfUC5FMzOHXAWWAl5yfES1QvMkowQhiGZeqREgVUiS6VXF8nDOZSQ5T5y+PVbF4CC8e0UpOuZxy1QkhwKN/eRAp5kCq4rux9CklN4pgN3O7LmR+Tc9Ld60vLW5T2xuhQOybOJydAmKj3fTWtH9IPnMNYS2GGTbXWnmwGVYcckLGHiD+KTBFNvda3+pW2Tq1TCiQxJkFGA95CZwHEdPjqrha4ezFXOoEF/F+cMAWW20ZVDHpECm0BodJM2wdqjjXo1MFti+uofNCIUHIRbXyhTLGq+Rv4lcRzBydkHD1HhmbgboqhiJh9JiPHeNOol9VvS5o6gEP2VpaFUwbHd+r4LRpygadQCdOzd/jYauhLux6S5XLYc6OV2xYvKGNbAY/GyEoyt9BCJNMV2Ipru6FliR+k7P38rTKoLIl0eHpNjS9kvJyOj0iBcE0BbLAQ2SZf+hUT+ksckYqbc38qPkV+76V9EnXoQaWqPLUl3vjMl1OwGv2fY4b0RhMz/QpALo+w7G2nmS4SJMpJ9d0qOn0ErrnwHtngzDPcXE6zme6gVZ2IfvM1zeCcle280iX+g4hNWtqg9ZLpLPBeVmJaXy2nWdjOXiGww8Jkp6yZFai4ugS9WCfGQeP4rAhND+UApYQnuAPH258YHcy37SM+y7XWwMkNxC1qOEGa3ZbsWhNmy48uILWKFrSFEiZ+iHy4TmE53ZhKcUB8McSiQuC5WLiGafvzCneGIp+zYsPjv46wCGLFk0Og72NmItlCZ5wZFwGSZm5GGDwbcawc+DKmjmWymhSGmVRC+UirNTE4THiQLJabARXe4PVvb8Yp5WHp+bmip5/a+AGHEDwWM8oDNuTDxcEMr+Ok15UB2iA6ftTMhvRTTjmNH+9XU2ep+dvt gM/9aRPZ A7kkpdeA/JuC00tttk3Zb9/TfgggEqAH1kaj74C3MUpvuhUN7ZYWyyIfGnMiZwVWzLxDaPDQAsqNS2lYwkF9Uh0zt1wQ0JS/MXkKd0pyUuNQsZwbVz6UTamKk6JUwJse3HcjOFFz4Dx4mGrzRKE+ddM6gB2ehEF9BCo79KD2VoNuXu+4CDBUZW0XL1v73HVtdlP4Ueb+rNTgIpF6BVFL5tpKBh01aehlVuZQ24HQp7HAt5WQYiU1pc4jiRpdfUlWhREJXqSQWz5WaBNE= 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: The VDSO implementation includes headers from outside of the vdso/ namespace. Modify getrandom to take advantage of the refactoring done in the previous patches and to include only the vdso/ namespace. Cc: Andy Lutomirski Cc: Thomas Gleixner Cc: Jason A. Donenfeld Signed-off-by: Vincenzo Frascino --- include/vdso/datapage.h | 1 + lib/vdso/getrandom.c | 22 +++++++++++----------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/include/vdso/datapage.h b/include/vdso/datapage.h index b7d6c71f20c1..127f0c51bf01 100644 --- a/include/vdso/datapage.h +++ b/include/vdso/datapage.h @@ -5,6 +5,7 @@ #ifndef __ASSEMBLY__ #include +#include #include #include #include diff --git a/lib/vdso/getrandom.c b/lib/vdso/getrandom.c index 938ca539aaa6..e15d3cf768c9 100644 --- a/lib/vdso/getrandom.c +++ b/lib/vdso/getrandom.c @@ -3,19 +3,19 @@ * Copyright (C) 2022-2024 Jason A. Donenfeld . All Rights Reserved. */ -#include -#include #include #include #include -#include -#include -#include +#include +#include -#undef PAGE_SIZE -#undef PAGE_MASK -#define PAGE_SIZE (1UL << CONFIG_PAGE_SHIFT) -#define PAGE_MASK (~(PAGE_SIZE - 1)) +#ifndef ARRAY_SIZE +#define ARRAY_SIZE(x) (sizeof(x) / sizeof(*x)) +#endif + +#ifndef min_t +#define min_t(type,a,b) ((type)(a) < (type)(b) ? (type)(a) : (type)(b)) +#endif #define MEMCPY_AND_ZERO_SRC(type, dst, src, len) do { \ while (len >= sizeof(type)) { \ @@ -79,8 +79,8 @@ __cvdso_getrandom_data(const struct vdso_rng_data *rng_info, void *buffer, size_ if (unlikely(opaque_len == ~0UL && !buffer && !len && !flags)) { struct vgetrandom_opaque_params *params = opaque_state; params->size_of_opaque_state = sizeof(*state); - params->mmap_prot = PROT_READ | PROT_WRITE; - params->mmap_flags = MAP_DROPPABLE | MAP_ANONYMOUS; + params->mmap_prot = VDSO_MMAP_PROT; + params->mmap_flags = VDSO_MMAP_FLAGS; for (size_t i = 0; i < ARRAY_SIZE(params->reserved); ++i) params->reserved[i] = 0; return 0;