From patchwork Tue Sep 3 15:14:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincenzo Frascino X-Patchwork-Id: 13788870 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 387CFCD343E for ; Tue, 3 Sep 2024 15:15:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8D5F18D0190; Tue, 3 Sep 2024 11:15:00 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 885B28D016E; Tue, 3 Sep 2024 11:15:00 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 74D6A8D0190; Tue, 3 Sep 2024 11:15: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 4F39A8D016E for ; Tue, 3 Sep 2024 11:15:00 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id EE8A24058D for ; Tue, 3 Sep 2024 15:14:59 +0000 (UTC) X-FDA: 82523774718.01.3A8C1A4 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf08.hostedemail.com (Postfix) with ESMTP id 607C3160028 for ; Tue, 3 Sep 2024 15:14:58 +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=1725376451; 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=eLPi23NCssDW347bgKtantBj/qSiJtHKtzQPoxefRsI6Jl3G66M4vgdLq3i09UZJqBJIq/ 5lZvZuckXzrlOl5LA+VFJnUcw2sfZHDmw8PPgu/9Hmkx5UTPaE0d7r3creqNwcQLxhgEUm 5Z7VMNp+H10QKD7bEWB7lTK8ufT51PM= 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=1725376451; a=rsa-sha256; cv=none; b=xV8QuByP5fLSt6hnmx5axpGcyK3s4/CBdA2cDz4QcF1RIPKnpkWgOZc6B397bulFESPFhT HlH2u8WPLfvEw3rWdMSNEMR+7sy/SId/OqDaAff8beyBuJkaBRjDp4YjgGXQ6m4/ncs4iN ECb8R9Ar6sNSKNTkRYVmeHaH9E7OddQ= 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 1C42A1063; Tue, 3 Sep 2024 08:15: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 BAAB13F66E; Tue, 3 Sep 2024 08:14:54 -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 1/9] x86: vdso: Introduce asm/vdso/mman.h Date: Tue, 3 Sep 2024 16:14:29 +0100 Message-Id: <20240903151437.1002990-2-vincenzo.frascino@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240903151437.1002990-1-vincenzo.frascino@arm.com> References: <20240903151437.1002990-1-vincenzo.frascino@arm.com> MIME-Version: 1.0 X-Rspamd-Server: rspam03 X-Rspam-User: X-Rspamd-Queue-Id: 607C3160028 X-Stat-Signature: bi89kbajpzji4z3ijc5wnjk4poxgawbt X-HE-Tag: 1725376498-204377 X-HE-Meta: U2FsdGVkX1+AQZ00dkQMBx3B6PQie9OiPmU9GOvgugLb4nxd0dZJDoq3jKl2hu/ezvP1Qr787UcS1twVmOrY45r+Dj+0W79pZzS6WY/Q6cUafGkLh/8NhzOoIWbnkeyfkaYr/z8HwyDk19Z4UaWH7T46CQMdnERnF5tXM88FwTBN2i1FUkIDG3WkZ0ydUDAEwALN3Tl1PeodJXSV4+Yo8ICEZRLP10N/EO/flcpQ5Ym1nIq/7l1ljaSuIHWUi5IWNeYYy2wfD7hTkkxMUOUdhtHYHvZnxjX+wcT3hdvyi8nkHgAJmHcbOeFG60gNisjvhy1a8uwflBsVq0zkqarrt+GEqGT15qk+SaQXrMRrLmRw7miXK5UuKYIiLux/uAcxwf46yu1aNQtJhd8uT5xh2/7qoj/TCtFnAs2aP130Fz+W5Wq7PjqzR7qm0H9shukZkrNp0D54zOJF2w7BtpcV1hDWq/91SQGLx/+vutXs8t3EJKFX6/W6/ZzAaF2t+Q3tff8OVD18EWXrWGAosWz9hXkHCIVRPaQWU04cw3MlQrH5jB9guEKnZHKjjhgzw8p5c8Zo7xsVCYMJhDkgJ4IvVtgqhamlme9rocKOt14YuD8l7w41oFShUFfYAvg5PxHcpn7SiI9RPXEOVH4pIFDuQ1TgwFv8DtQ120JegTx4RG2wUJJJSz5mujvtmOESJGtVfOaVjAbsiBJta825yt+YhcOTYQrNhy2Z3zjNah7CkEFkNoHlcJWAv7cdpdmdmOw6cFthdSRx36mAwcaf7aRqxYIfW463UktO8//k/xH4dZ/JR2Y5mvcG1I+F2yAp2I+CLfwsQWkFU+oevQbzPc9adF1OO9lOKlXWAKZubI4G6lbZ/c3cEb2tjNW7++Tm4a0rb1a7Fvr0i+la45kAh7QQ2bUBmnLOA/H8L2B3zmxQ+hd4QPXu5hpDqVQWI1mlSvLQL1DOWcOMbi8ma/p/rBJ wfsrC8+M 7zmJaHKC+RpJFcs3NJPKR8tFPHO6mL2lM5wf3q5C60gbwcYzFPqEnZVoz3hBr8m9mzwcrKLxqgxjje6599ES+kkw/l/V+k8y5BnK56s0OgDmj38c22EA9dukMkpWyB8DAZMX2jONEjpIJdAHoAWKlVw+mpvr6U4BranaklJz7TDfWUXnjRGgniwIecq6jEqxOdpvJIP9a9bSgH39D+g/fBYVe/Yrl2auBcYOmwil36il9/dE= 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 Tue Sep 3 15:14:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincenzo Frascino X-Patchwork-Id: 13788871 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 41891CD342A for ; Tue, 3 Sep 2024 15:15:04 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B201E8D0191; Tue, 3 Sep 2024 11:15:03 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id AD0A68D016E; Tue, 3 Sep 2024 11:15:03 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 997228D0191; Tue, 3 Sep 2024 11:15:03 -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 7BF958D016E for ; Tue, 3 Sep 2024 11:15:03 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 35089C02E4 for ; Tue, 3 Sep 2024 15:15:03 +0000 (UTC) X-FDA: 82523774886.12.866E3E2 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf12.hostedemail.com (Postfix) with ESMTP id 8241540013 for ; Tue, 3 Sep 2024 15:15:01 +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=1725376406; 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=WaJX2lo2r5FjDSwz/+OOUHcyN7sMnDfQVy7SOiEKvVaI/J6Ixf59iJfw0HP9YAXet5tKAK 32ZxHxxsMfZVZt2a3K78ZVQ7tFthXsh/BPLAcwP7MY1QyGt/GKOkBjacdYHbOxwRPTNQPv Vw6t2wsmxg3kWl49bQVYJwSfzEyDcxw= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1725376406; a=rsa-sha256; cv=none; b=im5cE6YnAxPiQxS82ByT+yf5q8BnGc4Lz6q5SKRa/vW5iTSFt1O8BWCjR5vczbp8qaMkJG iboNbU6XacvNz4n3VfSaomPsFWBjIm99aVjEtvVFzO1itj+MH4GxN7Gzf7kn1QfXDg9Xrs 4t8Z07yu5mcp4MhrTsK+Gk9TZn9Hj54= 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 496971424; Tue, 3 Sep 2024 08:15: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 E8CFF3F66E; Tue, 3 Sep 2024 08:14:57 -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 2/9] vdso: Introduce vdso/mman.h Date: Tue, 3 Sep 2024 16:14:30 +0100 Message-Id: <20240903151437.1002990-3-vincenzo.frascino@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240903151437.1002990-1-vincenzo.frascino@arm.com> References: <20240903151437.1002990-1-vincenzo.frascino@arm.com> MIME-Version: 1.0 X-Stat-Signature: weknfwitrrk79phajismk5q81xm4brr5 X-Rspamd-Queue-Id: 8241540013 X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1725376501-711092 X-HE-Meta: U2FsdGVkX1/os14jIDPthpD9nb138fhiFiMLTynFuFbPe4rNQ539ZficyjcrDdIx6Xjfn61cxv0MoPa/OSLKGIUZ9CHtETopc8f4l4bVInFzb/KO2Y6i9Yz6ROa9+b/+nKO1Ex73qa3T4K40CEpz1hNVAZMjDIdAe53eSr8Es998msGYSbZQSCMttJSVjyg9JGGQGlKE23BiLmu0mkzBO3pwmG9XSPQ+72hDAYdEreCsgWgvW50s0JiNOQTXXXoQdyQN/D5dyN256enh1giWZ2Pu0LX8V5T66N8gHaTKLedeqY0sno3ibsm4G3n7Rdnh7X+gYBeRVLUI49v2BMrFySquGitxnDxyqBPKewmX5nuhowTFB6dfWZEQ+ywgTAE6mXhyKVvHRSBtLQp0k/NuaMd2O3KcOKYXGjB7P2KZ8uNvBIegehWkFo1ILifQX1FMsEnsnjRjy3zUTCi3tL+eY5f7guezaoS7LTADurhS1nSRUVTy+vWdTNoHesI428IjLI0C3czi34rgb+7kRrI90sQr2a2PyZxsgfp4GmD1La97oFuvZ/MOnV4oldIqI3XuDHMifjznrOJ9uuj8HbOudyLg7XKo7iz7xUVoOgW/SXh1DDIX8TZUGBuNryVqmD3/OEidqLf1wT7x7WZKbH8vLUkn6v35S7P+sQm2Cn0xU+8YtBsdr0nTD1Ae5eVze4/MyjmJOpi9lJHXQJAboNlllCBSycDUveU/s0ZW8xQgqbXd0c9yEdt71ixq6TOmWX47HwKcxh1+M+jFZXb/K73kB0G0xnqdFSQIUOYzkmM21TWvYVsX6UQEjNQ0KXxYEYXSegUdTk84V/dYgqMDCKk8L55IMOsfpWn29KLeYbierQzkCbUQ+7PsxJH1rNMDKyZjXgbWEEdXsx5Y3mla6i4XraZiekSduyPne2yQi4hkAeZI/QIyMh+x9ZgNkhGb+qYj3Fcxz7OnFLjpfyJV5+A FXabxFSr ZzIOxt9TKZEvdfgzQ2i+C7Du22LJrWUzOwhXx/3CcQ3EY/wTey0X7e3eh5WyA0MxzkJ5IEZVfJ9YO6tF1VBf5vYho+mk8/vbKz/4+5hAVHYsMaevr4qWCxJ1T6oiDntoJrnvpTNRtIw8yv6GZOMuwYxgc617u8mV3uRki9KT3aOcrSSzgyHY9F3JtLv8ve+FXIohdfaqUPd1+rwPfU2CrsIN5tcneSHNIstep4+3+3MuR72VLhs9T+vp7cY2FkAPQIQHBlhabMQ9aWZg= 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 Tue Sep 3 15:14:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincenzo Frascino X-Patchwork-Id: 13788872 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 BA540CD343E for ; Tue, 3 Sep 2024 15:15:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 505238D0192; Tue, 3 Sep 2024 11:15:07 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4B5958D016E; Tue, 3 Sep 2024 11:15:07 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 37E1A8D0192; Tue, 3 Sep 2024 11:15:07 -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 170298D016E for ; Tue, 3 Sep 2024 11:15:07 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id B28E240574 for ; Tue, 3 Sep 2024 15:15:06 +0000 (UTC) X-FDA: 82523775012.05.313CB50 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf19.hostedemail.com (Postfix) with ESMTP id 2D07E1A000C for ; Tue, 3 Sep 2024 15:15:04 +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=1725376457; 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=Gtd+KYbpRVq6Ifgb/TXYZWiFXelpqv+zL1XxSb/VLSQ=; b=s1q++lYB7/UO2EaPxOVNqZAWbjd+GR65tj8fqOujiAG61pmBCmZxh2zDA+I0lVDnmTaTVa phpRDrroSPmx8JNe0KZfrlWyaR0ZvAPyJh0iWJuM1ZgnSp49VdXbhVvXcX/VMYyVLVZVGZ izSA4CbvmhoDQvxTa5sEv01YdcyhvNE= 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=1725376457; a=rsa-sha256; cv=none; b=CCpyfYar2h7kakSmSxXx8k68aYLOtGWcll9yMaz6qTmt/8/EusH6SxraEwTZYArhNANoDm tYrYwW6JNAuRAH+cIp4FN3cmaoFCA3JL9wlhF3TO7E+uKr9wJpBUfgFCAnpm3SRnamc/+9 tuTZXS5AKROu5UUPFZzPkbBbS+CkyIM= 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 805B91474; Tue, 3 Sep 2024 08:15: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 2218F3F66E; Tue, 3 Sep 2024 08:15: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 3/9] x86: vdso: Introduce asm/vdso/page.h Date: Tue, 3 Sep 2024 16:14:31 +0100 Message-Id: <20240903151437.1002990-4-vincenzo.frascino@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240903151437.1002990-1-vincenzo.frascino@arm.com> References: <20240903151437.1002990-1-vincenzo.frascino@arm.com> MIME-Version: 1.0 X-Rspamd-Server: rspam03 X-Rspam-User: X-Rspamd-Queue-Id: 2D07E1A000C X-Stat-Signature: 84awoad5cj135b3phfkfgbrybrnbj4a7 X-HE-Tag: 1725376504-112621 X-HE-Meta: U2FsdGVkX18JST39YiGIXB7rYzfF/0fPQc5+PJfPzrBEnj+n8TUfRAP3UwGqEBu+8hAe4ICORylhbiPIj4zNtDAMVl4CHrbte93VSb5foMCF3UsxQFI74xQvhRUSTYu4zbJAc73QRlVC9DQjjqlGwgKqry7L/ImJCIYAPLi/noUbDVVTVZ24UvBaiO1nGVon1HWQe3ZKcL6diynoRLyFfSzOtaqjuEbPZMsxJWYhL8oyrMHzgzUpIh2x45viaenwfko5m7fXgD4hnKeorBzCpTxwQDnPg6RW0vtgI/VBankR1QVDqqVprA1ensbs3d3RkJsTSL+TOiLvXO9BH/4aEdypWaUY6vO7kFfneV9PnnGWaXocme5I7nvDe/QHMLs1i5srCbEimGYsNUvbqqfa8KcynQjO6ekzLGXPdBYMw7AcFK0i2r7ZtyhYeh179heBTMPr1RwL8LChgPrVm0d0/1aaupqTDPUpFo2twOEJFnkn8tzN67fHCAbrkUexoESYgz5ybO6DgW6kesHFsHo1ZIpiaXhMN8Cfhni4niugJaorYG6/mjiTb2KwRtkI8FZMYz85ksMVs1EB6lTmitY/DiiqrCWlyp96fNiRIjcW8IbAIm3kJSRh5bGOvL7z11gkME4feb0BjuKDmLu0jNPoLn1wx3HTud+nEsrfPeOmLSAPVfbJVg0J3KBeXU4ruYhuxvrQes8LqV2OE1NHjeLMyYBGvxv1D9GBH9IlFnh/d895GMGUv+KT4v+8efqQIP5HFmdKqUVCGJHfZ7+NBtc56tpLDcncROjr3gWYMBFLmxux+FL+a8hOfSyzeYf9rq+LZN5gL3KbUSspg/ncNP6VpY/ztHz8GruBE2Y8GNP6gtMenTA5bVrB5ghou+Lb5/YFDj3rR9VVp3l6ZvT2U/qFS5hn7AytHWqDhfBfVaiTveYvj5pBG0GUIFZJQK4QWvcfqQCtgiC3sgMZz9kd925 HqAn5cER CRCFTqO0HD42moRlJ1ZxY2vGoGBh8Kf99TggNENkhbaPC1nbVD4w1NW1BMmkyRl2mr8nnx7ILZm4yRGI0y6rHjNtySI/YhGSL2MZMAZxQgJvHME7ocd5cyhs/622Z1YYrw11Q99eE4KDuSHI00NocK2119tBS1rLRqq/gq91QrS4t+GdFgimqYodHb7AzZ2o+UnjI2tdmmmtvDM0WQGyElKcFYPXBrjZXnX+uV044VPObmnA= 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/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/x86/include/asm/vdso/page.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 arch/x86/include/asm/vdso/page.h diff --git a/arch/x86/include/asm/vdso/page.h b/arch/x86/include/asm/vdso/page.h new file mode 100644 index 000000000000..b0af8fbef27c --- /dev/null +++ b/arch/x86/include/asm/vdso/page.h @@ -0,0 +1,15 @@ + +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __ASM_VDSO_PAGE_H +#define __ASM_VDSO_PAGE_H + +#ifndef __ASSEMBLY__ + +#include + +#define VDSO_PAGE_MASK PAGE_MASK +#define VDSO_PAGE_SIZE PAGE_SIZE + +#endif /* !__ASSEMBLY__ */ + +#endif /* __ASM_VDSO_PAGE_H */ From patchwork Tue Sep 3 15:14:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincenzo Frascino X-Patchwork-Id: 13788873 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 04320CD343E for ; Tue, 3 Sep 2024 15:15:11 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 862308D0193; Tue, 3 Sep 2024 11:15:10 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 812388D016E; Tue, 3 Sep 2024 11:15:10 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 68BFC8D0193; Tue, 3 Sep 2024 11:15:10 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 45F548D016E for ; Tue, 3 Sep 2024 11:15:10 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id D094B140547 for ; Tue, 3 Sep 2024 15:15:09 +0000 (UTC) X-FDA: 82523775138.12.A5449A9 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf27.hostedemail.com (Postfix) with ESMTP id 026B14001C for ; Tue, 3 Sep 2024 15:15:07 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; 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 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1725376402; 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=9csaeOdq2aH+eR6j8IiHx8Ly0MCrnUlj3wQSt8Ht9F0=; b=omiCiJrZlZSe0qXDWj+Jy/7DP1EVzEbcHFgjKJU3XRhPj4ps7TESHwlcVXQHJdxrW2+Phi JM938G2v7zoc4O+2+Bp6KhQ/7llMU4p2cRkuP+VOZvFXKgmCvKu3Dbht+dcM6gBFl8fdev DB5P+foC5YTuviSnQ/J8Fyo6h11/NJ4= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1725376402; a=rsa-sha256; cv=none; b=hnoeqVTsuKNftonKQ2u3ZYHgVqHA5OVHdrv6urmrfGvSidWmVjZk3yDxyq7CnV17s40w/l Smb0apx5ZKM9AzdoffZj402lMyezGg2Ml6jeMR+ll5mTwJTJy5ITwYecFZxctZ5MwrUNq3 sgeP7grIAEp/mm8XYbtNTSdvfuZu/0E= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; 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 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 A63EEFEC; Tue, 3 Sep 2024 08:15: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 504DF3F66E; Tue, 3 Sep 2024 08:15:04 -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 4/9] vdso: Introduce vdso/page.h Date: Tue, 3 Sep 2024 16:14:32 +0100 Message-Id: <20240903151437.1002990-5-vincenzo.frascino@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240903151437.1002990-1-vincenzo.frascino@arm.com> References: <20240903151437.1002990-1-vincenzo.frascino@arm.com> MIME-Version: 1.0 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 026B14001C X-Stat-Signature: xiy9rh97mrdxg5payzmb5h5955bwspk8 X-Rspam-User: X-HE-Tag: 1725376507-906575 X-HE-Meta: U2FsdGVkX19xzX/62ahK20s5OiIlp7AG5fwsuufUY9lGpq3j40MM6BB/q0fdKES1yFo94iWEKRmTns9oCg2uhMPJtAoHDddLedl5jUQy2GFDyIupJqkX4DH6gQ6ZcmFmjWIPuC5h4JRvvnHuZjIozVvAZ4+bY0x2ddDWHKDuv/+FeqKc5YuOFgL+3bm0ScOuuYYdYKJf+T6Wx8GIvUf1PlG47WZED6pxK7sdwp+VZTMIJMXMaJN7Rs4nB/OmoOkAzkDzhfMA3i+F/LA+OISHUiT0AYr5g/UtcFLVLY7xSl8UsxQ4QAohqlrMR5gcbFQh3PbhnHzRrYuX5lt5CdihAz7VyTiBQKbRAciQbAUhS5fsnYQaouORXmvDnN9RnTWmTQTF1v2VcaQ/3CNXlx+gDGQ+G09Ht2TK2tnRr6pnwNIiycLQ2vIGa9TZwhL+PeTRWspJEJpjysZZ8zZ+ZG0+Sa8+bPSfeeuzvCviA038DuGq30McmXQtu9Xo36a9V0gfcnRW4m3mtwfME0e+DljSKlPX9moxHoDqKpFsdI/IaTKNZFBdTkNBOJ13mSyGpHAjXCPjzMgGWkTIvSnT+EZ5FgQTGr0lRi0fjks0KY0zsKcfqyCgBw5rqHogv/mHiXHceH+WHEGuuCJVPpcRzuTGqj8uAu2VwLE8DA777/Nqor5qx6D+nmsQfTqBqhK4uTlydG12KErk6lMnhp+qGxOngtK58QiNZ+NMrgEwPddrVmCYyIfGlUTj3w7Qx6sU7f+RLAqUmVz8m5kRVv5bdMU05H7rZTjeND4AzkJMgAXi7WW9BMKbOAIcsR1c7SDIKEwPaoLQau5Z08yLrWNfb5BQM+LHG13hxgy16Mzzx3IkkV9BwoLB1yKluPwepmZJ5fxLEi6uv7Joeb80tzyoTyKJPhmafzVvGZlqE+sPQnBmNsuDOC8R+8BJ/sRhQMNtI9/KSe8ZQN5UipuftWnyeWV 3HMMttFE IglqlptBRLlUsQURMnkMZSENRWNpXMC7pOiuab6T+JyEFFzJGSko3Ck5zt3ZVKUybSR9wM32CMt2Gb0SgTEyWP+xc4HZw3rB9dLxTHhXueEwds4uk5DXBfhCj+PHzsDMek6RNyYfzWlDlT5tdjAxTdMhQTEmWf9ZE2sBUPg0jI9Kn8OaMx2f5pyPfnX3Qusmdu/jyKuOm341uvlw4fbs5njuYaogqupkffUXBYzEGbQG9UuagHHRzLIOtX+LAtNM4RCt+hlTB0YCvVlY= 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 --- include/vdso/page.h | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 include/vdso/page.h diff --git a/include/vdso/page.h b/include/vdso/page.h new file mode 100644 index 000000000000..f18e304941cb --- /dev/null +++ b/include/vdso/page.h @@ -0,0 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __VDSO_PAGE_H +#define __VDSO_PAGE_H + +#include + +#endif /* __VDSO_PAGE_H */ From patchwork Tue Sep 3 15:14:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincenzo Frascino X-Patchwork-Id: 13788874 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 0520BCD342A for ; Tue, 3 Sep 2024 15:15:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 972388D0194; Tue, 3 Sep 2024 11:15:13 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9237D8D016E; Tue, 3 Sep 2024 11:15:13 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 74E3B8D0194; Tue, 3 Sep 2024 11:15:13 -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 4BE868D016E for ; Tue, 3 Sep 2024 11:15:13 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id F02F1A0543 for ; Tue, 3 Sep 2024 15:15:12 +0000 (UTC) X-FDA: 82523775264.02.C936337 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf09.hostedemail.com (Postfix) with ESMTP id 46DF5140037 for ; Tue, 3 Sep 2024 15:15:11 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf09.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=1725376441; a=rsa-sha256; cv=none; b=FZra+ArAxR4xb174gCm9JqxzeRGcS8rDDfReqtB5iPL6dpJcVtduNpMMPZ4gUfIOwkQ/m+ x4r88PxWHHYuv+BOz/nOlSMS5aqIlVZuroug4/9BSxwfMkwVP2KI10sw+rita14TZBTJiX BqRkGj3/xuDtr2Tvd6w/XT8RgbS0yr0= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf09.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=1725376441; 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=rC/iA80uwkvDwsKaNyrrlxed1oIdfzptoKFE7lCI1/A=; b=xMN+PCmy5oWpnlaNF8J7y5KEhA7sKthIWcBFT2y0COxxaSr3QbLnsbqx7zKVZZcpAZXQVe W1wuM2ipnioCz6SaShJyRH7X/wKdc3oneSfF9AqluJEY4YzVIlqLdHSqCw1DZzqjSenMK3 RjYbUraeBT3Gm7XxhahZIR457UVxCO0= 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 D484B1063; Tue, 3 Sep 2024 08:15:36 -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 7E6113F66E; Tue, 3 Sep 2024 08:15:07 -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 5/9] vdso: Split linux/minmax.h Date: Tue, 3 Sep 2024 16:14:33 +0100 Message-Id: <20240903151437.1002990-6-vincenzo.frascino@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240903151437.1002990-1-vincenzo.frascino@arm.com> References: <20240903151437.1002990-1-vincenzo.frascino@arm.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 46DF5140037 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: 4aakb1j6a955gigoow8ioridfibz9en3 X-HE-Tag: 1725376511-884244 X-HE-Meta: U2FsdGVkX1/Shmwj+Qz+bqP90R7FmqIHL1t7vTIIKEVsMzQTkAnF9p/lXxrYBi0AWdIU0tpBD15hWQJiRWtaBTD0ScN1guuXGKqLXNPI8ZN8PyHiUuKLdlJVvMSyaUY2x5g+exCQei+zZcU+Exj6lFaI3EB7X1vx3pUW7lGfP91zGlGprTRcBWbnE/Pwjvsu5pdemYiyEnwy3WE7FvVtt4zmc3vHUajKaL/H3872tfixWftgQqaP1UgwQ4Ez1O3iDrCoJPUq4G7nLu+Qb+CYzNPsY+Dzes4E3OUKNeu0wcvHc7npX3nRA+NS1T4a0ZlbaGD2ancSp5n+kSXUZBI2JJ0mhx5RSN7GPNWx9mvc6gpCyYQeubLLtncZxoCAirAq0vcDywefx+SkWYuJZXE7E7VzuLYZo7oepNn0QN+euKqqMn2iZP0J3DS00SYw9Mp2PhXLp+LR3eRVMLSUix3po6Na+8GVTqKo6b43y15WYO0ULfvNEMilK5T/9cpC3EacSYStVDV6wt6kOoDXwc5rUNxH94wm1swwK/F+YXiE9xho4IhkQHVvqNGzXpzuQDS7Zn9WCgoYWL19LswbpQqIIEHNms0Nuqb2o8uGYYXwIaXKg/CZcxA7etiMCXiJKLv6ybAMKt6WO49mAi3PTuxGsGDWJYb4jsVaOjp8uuFXucFL0b0CKFZSJsZnkVmks3827IFKP5QxbqaNpBYCEhEhHMZEE1d+dShmpkxUpWbCMq2m+wgx6WatSnFjneRHJNy0BC/tNUMl4CDNif2M7WMNbfLLXsLTrWng9il9x6ilDqINncWoI1AvlCf/Skpeep2Az13hBBw1D8ITx86TYeCp5PutJfWsAR/LEAFLLud19Hv1WgNmv3suLjv9O9NWKfiCJi9NPXjDgF2SU4GBQ7DcF1MSIy7Vf+Td07Bvd/ZogvZJW/c5flphqehihT7Q3tcHQXjGjLQyylvUVYryPMG 0kvBJT+7 GpCiOq8c86uMleQvATxWv37TeINfhZa2QsxgfPFMEi7hYHRsEeuA/0YKJJYZsX7OgQoBqRvOfzNorH/VD3GGyOHMISs5Gl6RiB3FZx9OTLe++1kjGoyFt3RG3W7AyhRwXstwchpSNsqtGqcz0PKGYtkeMI3eHQiBeWkPFOZovKhY7XoR92FiyES0yZSP+szbsKRm2Q9IyzQHUmtN5f9v/DAozQ6lWbGKDF3KACNBeXyx3P5o= 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. Split linux/minmax.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/linux/minmax.h | 28 +--------------------------- include/vdso/minmax.h | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 27 deletions(-) create mode 100644 include/vdso/minmax.h diff --git a/include/linux/minmax.h b/include/linux/minmax.h index 98008dd92153..846e3fa65c96 100644 --- a/include/linux/minmax.h +++ b/include/linux/minmax.h @@ -6,6 +6,7 @@ #include #include #include +#include /* * min()/max()/clamp() macros must accomplish three things: @@ -84,17 +85,6 @@ #define __types_ok3(x,y,z,ux,uy,uz) \ (__sign_use(x,ux) & __sign_use(y,uy) & __sign_use(z,uz)) -#define __cmp_op_min < -#define __cmp_op_max > - -#define __cmp(op, x, y) ((x) __cmp_op_##op (y) ? (x) : (y)) - -#define __cmp_once_unique(op, type, x, y, ux, uy) \ - ({ type ux = (x); type uy = (y); __cmp(op, ux, uy); }) - -#define __cmp_once(op, type, x, y) \ - __cmp_once_unique(op, type, x, y, __UNIQUE_ID(x_), __UNIQUE_ID(y_)) - #define __careful_cmp_once(op, x, y, ux, uy) ({ \ __auto_type ux = (x); __auto_type uy = (y); \ BUILD_BUG_ON_MSG(!__types_ok(x,y,ux,uy), \ @@ -204,22 +194,6 @@ * Or not use min/max/clamp at all, of course. */ -/** - * min_t - return minimum of two values, using the specified type - * @type: data type to use - * @x: first value - * @y: second value - */ -#define min_t(type, x, y) __cmp_once(min, type, x, y) - -/** - * max_t - return maximum of two values, using the specified type - * @type: data type to use - * @x: first value - * @y: second value - */ -#define max_t(type, x, y) __cmp_once(max, type, x, y) - /* * Do not check the array parameter using __must_be_array(). * In the following legit use-case where the "array" passed is a simple pointer, diff --git a/include/vdso/minmax.h b/include/vdso/minmax.h new file mode 100644 index 000000000000..26724f34c513 --- /dev/null +++ b/include/vdso/minmax.h @@ -0,0 +1,38 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __VDSO_MINMAX_H +#define __VDSO_MINMAX_H + +#ifndef __ASSEMBLY__ + +#include + +#define __cmp_op_min < +#define __cmp_op_max > + +#define __cmp(op, x, y) ((x) __cmp_op_##op (y) ? (x) : (y)) + +#define __cmp_once_unique(op, type, x, y, ux, uy) \ + ({ type ux = (x); type uy = (y); __cmp(op, ux, uy); }) + +#define __cmp_once(op, type, x, y) \ + __cmp_once_unique(op, type, x, y, __UNIQUE_ID(x_), __UNIQUE_ID(y_)) + +/** + * min_t - return minimum of two values, using the specified type + * @type: data type to use + * @x: first value + * @y: second value + */ +#define min_t(type, x, y) __cmp_once(min, type, x, y) + +/** + * max_t - return maximum of two values, using the specified type + * @type: data type to use + * @x: first value + * @y: second value + */ +#define max_t(type, x, y) __cmp_once(max, type, x, y) + +#endif /* !__ASSEMBLY__ */ + +#endif /* __VDSO_MINMAX_H */ From patchwork Tue Sep 3 15:14:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincenzo Frascino X-Patchwork-Id: 13788875 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 2AF1CCD342A for ; Tue, 3 Sep 2024 15:15:17 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B47728D0195; Tue, 3 Sep 2024 11:15:16 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id AD1008D016E; Tue, 3 Sep 2024 11:15:16 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8D4C08D0195; Tue, 3 Sep 2024 11:15:16 -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 6744B8D016E for ; Tue, 3 Sep 2024 11:15:16 -0400 (EDT) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 1AE77A5B38 for ; Tue, 3 Sep 2024 15:15:16 +0000 (UTC) X-FDA: 82523775432.07.0A9C0AF Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf14.hostedemail.com (Postfix) with ESMTP id 50A34100011 for ; Tue, 3 Sep 2024 15:15:14 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=none; spf=pass (imf14.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=1725376466; a=rsa-sha256; cv=none; b=aRW6JX04OPkrK2TwMDoHQQb2hGDMGMlEozKHJhU5+7e1W+wdOdi8Q3ZmZaaf3nAp4mmaUB CLaWc6IALHX6hXilm6GHsxTqjsxOc0pay/Yik0rVsvlthx71PekNKPforIE+HQf7JNCiki s3ktByEcAa7HjQCz6qt70qoe4CSPLcM= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=none; spf=pass (imf14.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=1725376466; 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=Yx4X/Nrn3xlPLbwhuHvmtSPmn4DI6UpA1lqALrJpDMg=; b=AwSvAlcTuSjwm5t01vajvO6tcgFQW1+8/j1kUdSinazlzLGh9tglpo+DNHrhqIXmoc7RjF 9Hf9kCWxffx5xy0BE45+aIlyjRo12RMrE3OqWCo3Jw/lZ+wVXC3hI3M3uZxW8vpzbkdkAl EzSfQIgBwVy94yJv3gqxdefD5fZ2uVw= 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 0F1961424; Tue, 3 Sep 2024 08:15:40 -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 AD1443F66E; Tue, 3 Sep 2024 08:15:10 -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 6/9] vdso: Split linux/array_size.h Date: Tue, 3 Sep 2024 16:14:34 +0100 Message-Id: <20240903151437.1002990-7-vincenzo.frascino@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240903151437.1002990-1-vincenzo.frascino@arm.com> References: <20240903151437.1002990-1-vincenzo.frascino@arm.com> MIME-Version: 1.0 X-Stat-Signature: kya4rq7p4ecs6w9dksszr97315ha8gq5 X-Rspamd-Queue-Id: 50A34100011 X-Rspam-User: X-Rspamd-Server: rspam10 X-HE-Tag: 1725376514-865224 X-HE-Meta: U2FsdGVkX19GuucTmtLiCRhoZxMplXZHeK/KugyyUDJAT63niSAXRPHd5FavrJAXWqoMi6sejRr7CVyCn0v3FqpN6Lln4oc4EzgAzuWiqdjDITVhFOYX9iAHjXcrrMCFTSxSN5FtBeiHgIIzxiCeVZ29jv++mScmQ1rHncHsplOrN5rbJ5FSv2kjYVsi2RlSs+iofJ4vj7z0yCceylUfv4RK5vNV1/W7QwAgYDC5JTK9cQxPzteIJr3znhYf/VpjvQtrBavp8MIvSUa7VQTV2vqoq2tUezdFf3Wbn5FQsIo+uqrCCOqHJJMFmSHaIehC5eWxeL4R99MUjw4UTCAeTg9Do+GHMQ7zh4UgOp33vvTdUcmXQ1jmVKfvF2hKcKqEEgcfEDPyN1QsV9E8Anl4jOii7vfoigsj4It5tlJrg2c50wLNiGJtARMkS6vx9fg6PdBv+Fv/tR6jcWbg5Pin6o0zTjZKLQ5v3TZ2R2np+oKrZnym2FwCX+xBGU+0xd6fUVzyKYDUUzG+U1N4Q16kpeNytW8k+paQCiCxTSBCb8FlhIdDbAeox5AWfu0k8o4dJfKtCXWIlTcivTHYvhlxxWuNfgfFbypYveWMpNXj2fXf5qlWEk4gOmNctILasvFIvIMoaLE+RC4QCEDv7zxIAZKlCFsFOLOKFPpBM8HOawisQJHo1B5SKlcoH7Xl1sdCdS/xGbFM6P2g+ZUaiX7JvqoWRw0DayEH/pLaa1ELDWnYgfdQSsX6z7psaUToRdhnmLKLLZ5xi98VZCgvAp/eQVhP1ZPTkhZfi1RNkoZj8T0oCHN7evloVY+s6JQG+KH3EaiEZ3FLC0AKF1cWEj3JuUzRC/Rt+05+eOZGBOqgbQhtGUa5qUl6dwCa9coJ6qlqOUbtQ4rYSb5tvaV6vsdecghetZ8iYxgw7TAQxQnReVxVReR9SGkVUxRpj1vWspJt/Jzjlo8C4f71sT0KvbD u1+9MjQr q0zad/0KDq0YSTbKIeTED5m3Z0es/XUESwH6vHMtl1F83IhwzTOu1pMR7dOK0o+6mB25cBZd2trvEQbkaVlIBsDqEHFH3wGUdLoswl1uSs8mRe9QeZAvkEYB86jL0qAhDw398B7ju3B50EvvSYk4FCG5b8z80p6UV3HyJyp8VPn0rIRe3CDNG3gaZknXrwpjdYpHRYqBkjHUoDGHgQoVRB21A306Xve9NC28Mq1R16Q/mcQtzxG0hhDFn5xKebqRmhALcbjRLZE80v//3gTY9keyV6KKMMLUvkMS1 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. Split linux/array_size.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/linux/array_size.h | 8 +------- include/vdso/array_size.h | 13 +++++++++++++ 2 files changed, 14 insertions(+), 7 deletions(-) create mode 100644 include/vdso/array_size.h diff --git a/include/linux/array_size.h b/include/linux/array_size.h index 06d7d83196ca..ca9e63b419c4 100644 --- a/include/linux/array_size.h +++ b/include/linux/array_size.h @@ -2,12 +2,6 @@ #ifndef _LINUX_ARRAY_SIZE_H #define _LINUX_ARRAY_SIZE_H -#include - -/** - * ARRAY_SIZE - get the number of elements in array @arr - * @arr: array to be sized - */ -#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr)) +#include #endif /* _LINUX_ARRAY_SIZE_H */ diff --git a/include/vdso/array_size.h b/include/vdso/array_size.h new file mode 100644 index 000000000000..4079f7a5f86e --- /dev/null +++ b/include/vdso/array_size.h @@ -0,0 +1,13 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _VDSO_ARRAY_SIZE_H +#define _VDSO_ARRAY_SIZE_H + +#include + +/** + * ARRAY_SIZE - get the number of elements in array @arr + * @arr: array to be sized + */ +#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr)) + +#endif /* _VDSO_ARRAY_SIZE_H */ From patchwork Tue Sep 3 15:14:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincenzo Frascino X-Patchwork-Id: 13788876 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 D983CCD343E for ; Tue, 3 Sep 2024 15:15:20 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 68C968D0196; Tue, 3 Sep 2024 11:15:20 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 63C6E8D016E; Tue, 3 Sep 2024 11:15:20 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4DC918D0196; Tue, 3 Sep 2024 11:15:20 -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 2D6F48D016E for ; Tue, 3 Sep 2024 11:15:20 -0400 (EDT) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id DC8FE1C1468 for ; Tue, 3 Sep 2024 15:15:19 +0000 (UTC) X-FDA: 82523775558.07.5AE071F Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf18.hostedemail.com (Postfix) with ESMTP id 01AA41C0019 for ; Tue, 3 Sep 2024 15:15:17 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=none; 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; 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=1725376471; 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=S7TKvuQSZyFQZNwV9WFQBJSwf3Spk7ANpr4GweyabZcqHY76nkgm5OFbI20g+kpMpak6vF PagLv1OlZbC3Nx/Z3jF8W0ee1rkdyzuEu6Q2jDFvghKzOdQdP23nA+FuffPqHPOfa5KE4M Oi1Ke0Ku/2NFSr/e5RBoPFK+HFEli3Q= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=none; 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; dmarc=pass (policy=none) header.from=arm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1725376471; a=rsa-sha256; cv=none; b=BitbVrcFBTOFNdYrkz9V0p0BvfXsUmU3VNPWC04KXpRk5I6Jb+Lp1DenXUkNV47MW+8vFX MBpzGEwKDngK+pd/Jyj/gZxKZLX9AQvRV2a4AytsfhgAhM/8XKfj/nL+ffhJ9NyDObwnRl zVybytvLOI7YDuviSLGF+bEAym1T6AI= 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 3CE85FEC; Tue, 3 Sep 2024 08:15:43 -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 DB2E13F66E; Tue, 3 Sep 2024 08:15:13 -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 7/9] x86: vdso: Modify asm/vdso/getrandom.h to include datapage Date: Tue, 3 Sep 2024 16:14:35 +0100 Message-Id: <20240903151437.1002990-8-vincenzo.frascino@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240903151437.1002990-1-vincenzo.frascino@arm.com> References: <20240903151437.1002990-1-vincenzo.frascino@arm.com> MIME-Version: 1.0 X-Rspamd-Server: rspam03 X-Rspam-User: X-Rspamd-Queue-Id: 01AA41C0019 X-Stat-Signature: 9hsucfpgdts1h8xaf3uzaac6e9xk81ns X-HE-Tag: 1725376517-764437 X-HE-Meta: U2FsdGVkX182rkV5M4yI/gZCcqr5uCn9tIrFIZsZX3eh2JZTyvYDiU9qE0be+pJ5fY05huyXi2oYd8lzQVLPQfv/9/EZooUuxFt7q17Zl41mWWy4pXZzHffunmbuK7Exf3xaoqY5dfH1YhAOUyyvDnMyD/+aRjWz5oTaVcirJJe0dCptZvaEn45pbgUBOgpNiTjMQxWeJEMML7RUHSe+UJ673hi9YNnoJJHQAjNOmS1mcdSPhG9ksW4iBzC/W/k+s97iOrlQSu6NmyXxo0JRVz/OJZOW+LuDYWgo1g/5nnct9K5DAxomdgqoBAw6znYZEBujn4tK8HVww+fOo/I3ETpLAUfCZf5Ohnzle5S9rSPcuyQuhxtH1qND3gHbwVyNNImcfI6sbzUUtNDgEskXa6hrvBveQvLnpk0o+VF5T56NGNu7q2OOyDgSrW+WWv2l5otKBdqITvLZdXP+s6TQdqJtncYzwG7FqIzLVcY5dEY183F56k683YHpCJMAmcsQBLBb/s8u5clEkvtpf4U3vMi9zwvciWbZStr/kjNyQzSWvunti7SqLQaLLJbyMIb1jsy4588kOUqAQXJncUZchig2tDZLc5wSA39/IkuaIgZpPOwHEYjRZsFCO2u83F8NKfXr3lELNEccCmWKqmi0d/pLK7zMJ7OhGLuuFv5HKz6XRXaltqwDO1FWSRHn7G43kFR3LDisQHcciDS21iMy6H3M/f5vKAgkAqZo+w/Od7mjOwhLkAUaSv9VaZ42e6bwQuOmMS6Un3sYRO0Rksnzg5ah9Jcs+3o5r8fL/8MYEGS+Yi93YOpcTPJuJFwuIIYQ/ecVNK8FBmqobOyw6acUk4snTreyXPU6dRffaUxmkZE0AT2ZwwqoXndfSCDB+MSej+QpaKgOhR0xnFnJ/FCcHATpW5kpvSA49I8jgYU2s9MI5CI86nVMFkVme/JxYDAhdF96oNyAWIvZdNKFzDm Bx1bqbic wlaCeRI0Wifk/XIuLFvPlBDVJdZq1Xu9qTCDL2LPMlx2Heod4uH1t4Szz+j9cfcolTcUkiokRi7mzJaP2JdsDuaOsKRKGKgGZqwcEXLZflpMtDMBywlmJavTCMsWyj+hi5h2SCo6OmfdipUMENl6IAjMHX+pfahtQylz1lnHhDHVcdf9+9P56dPPTvBf0b5dJ5G9MCAZdQfpBktiYMuixzP4O9gukknPL5CRxjT75bNdxCeI= 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 Tue Sep 3 15:14: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: 13788877 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 9072FCD343E for ; Tue, 3 Sep 2024 15:15:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1F8538D0197; Tue, 3 Sep 2024 11:15:23 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 15BE18D016E; Tue, 3 Sep 2024 11:15:23 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F16B78D0197; Tue, 3 Sep 2024 11:15:22 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id CA5228D016E for ; Tue, 3 Sep 2024 11:15:22 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 7E06E80582 for ; Tue, 3 Sep 2024 15:15:22 +0000 (UTC) X-FDA: 82523775684.19.8986B6B Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf21.hostedemail.com (Postfix) with ESMTP id A8E421C001E for ; Tue, 3 Sep 2024 15:15:20 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf21.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=1725376443; a=rsa-sha256; cv=none; b=0cyl3uVvcbYcFOv394ehLhmgjudgHYcwGB/++GFj6ythBmHDVUIkkLD2gXx+5t4iOFjn3k 0CApPZuoTFkfc0V6RC07RID1UeSnxWLkShJ7AkLMmmyui3X4lgRiCZaYj9JXyGdxljVtwP bjQrtYkd0F7gpDEe13my6DUInsxYshE= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf21.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=1725376443; 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=LB+mA4jt98X6nA+S1dt5b0JDYHX9IuYwJGz7B0epcO08IX05WefLCThXSfLGLA797Vj03w Y/wec9LDieyABnjO9c+GPNk528ArVB77Sn4fvRIV3vUOtD0ckjsc6lsUIA/2Zht2r7zehr LTdza9wDddGAFaWvPfWUfO8MuvbkBms= 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 6AF7E1063; Tue, 3 Sep 2024 08:15:46 -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 150153F66E; Tue, 3 Sep 2024 08:15:16 -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 8/9] vdso: Modify vdso/getrandom.h to include the asm header Date: Tue, 3 Sep 2024 16:14:36 +0100 Message-Id: <20240903151437.1002990-9-vincenzo.frascino@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240903151437.1002990-1-vincenzo.frascino@arm.com> References: <20240903151437.1002990-1-vincenzo.frascino@arm.com> MIME-Version: 1.0 X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: A8E421C001E X-Stat-Signature: qfqphg34sjre1u51cxh8chtpw1kmocmh X-Rspam-User: X-HE-Tag: 1725376520-829291 X-HE-Meta: U2FsdGVkX1+z32nCQCFqG+XstojJsaB4LmA98vz0BA6ZiJXAK/4puTwWZCPfg0ULXXTcc8aGcp7AFp71j7Rw2n96qyjThzwN7rjOm5d4fytb2sbabA7geHvgSHXCxmQVFmLs5b2b2YyBtTE4SuXYG2uKqnvTSG0ASztZps8NYjOtjvFP5UJ57CmaswLwEBFTVQ/XBehrb2j7g18Ct28835IkDhlXCIofKI1CVVsn4GPF9xEzPIVgLCe+wM8qlAnd7bIdB28Ad5A/lTO3kkvSxKJTtGdfmv/UFE2K6UJ7+Lm40kFleL/ix9maowbzMBJkvKsqhiXECplAwVkTCyEGiuubETNIWgndOay2zEOfDJdhYUhtZ3KptKj1UiSm7le8cRFWenAhLj40r0rgKhIwwo0wmwZEluxqaK18EcPJ+PdGA/CKacCN2BwTfKAKcV5kSeUobs19OdLJiAD0OPZUJYYh71GJDqGmTva2EdCDG1vxxDFgUHjLi/y2DKYWHi2ozF5/O7llNmE4v9pWzRAUd1e74sZrTQs/VouisFtARmZpHveZf8hX5AP7oxv5HYwLZyhkUT7tU02KMGyrkJ6brBLSHEndFnKVkJjvHAjO2Hc1pcr8OageAeE8B7EdXJmkLHXIcv2xbDuR5FxXuQUZDp0Dg9rdJ3d6lKHcSslH5Xi+p0oEtsyUPKuiIrAUETARwpdAus2RQXO1L69PHRVgQixGd4qeOSScsA+fUj+q3JQlh5/M/gdzXr0+tMpW57XOyoy2BdlMGOXBqNzzil365SkDyW+wJgAJgVzWosSsWJrhm+PpNCSsVmaxvSJUyJ1YQNmdCJHFxm82Js2Iz3mbaiekdMcuViTlFMG4GHhTwUePQNScAZdbU3TwDFEIYBmavTJWZb6WSP/Y4uk0Oq8Ck1sKC/Kgl/LnTaac60aGjhh+E5OB195feaVyOx1zx2QPCR1W7c1d9wvbJgVnXc5 89NH4xmN MkVqSclCgjRTRSINWbnkF6IeASyZl9rrSq0IBrrR+0pf9/XZ9SWRBZjjd055QynJ+kf91lESX7+HCOv8osqeSJqU4tFceA2mFArn9IRcbWF3AW5VWE5dPFTP3WBdPsmk03ZaauIjkNXV0Mz5pANslnVBQrDUaSwybRZ2/Zbr9PcKtZkXmyCcxXuSpDZn3hd5fCmv1dWsVwEvxiOcH7TmBTVAyGVGkNGIUEskbMzkow1U4DKs= 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 Tue Sep 3 15:14: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: 13788878 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 BB8E5CD342A for ; Tue, 3 Sep 2024 15:15:26 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4DF008D0198; Tue, 3 Sep 2024 11:15:26 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 46A228D016E; Tue, 3 Sep 2024 11:15:26 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 26F648D0198; Tue, 3 Sep 2024 11:15:26 -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 065768D016E for ; Tue, 3 Sep 2024 11:15:26 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id A4115C04F0 for ; Tue, 3 Sep 2024 15:15:25 +0000 (UTC) X-FDA: 82523775810.28.9B93265 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf15.hostedemail.com (Postfix) with ESMTP id EC2A5A0013 for ; Tue, 3 Sep 2024 15:15:23 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=none; spf=pass (imf15.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=1725376449; 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=y9tGsIPSXlxjajOzhEsQ4JyuSJv7MJdnh9u07mDndu8=; b=oBJKW0jEZFo6XJJaymDHhYL+YDbH2oHzuX//MVccfFzMW/6vFL7/bhAr6zOYA7zEmTOkSW xc0/8fcf8fBf6pY9LQdl9jtKIndr17fQba+xy8HIUUllNKqARBQImvlZ9n4rP2HobL0rMu OYrf7/+Q0xq48UgVw9wAagvPgRYI53M= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=none; spf=pass (imf15.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=1725376449; a=rsa-sha256; cv=none; b=lNo8VC+3EYNzYHBmnf8esdvsdbcH2gNSqAGuUpSc0AnYvMHkhEkPFEER5R0bAc8OVikQlT 4ZE8i/uHAp95APNjLelqaF+G31XVND0qk90MCutXMxLks7lwC3znT5OeRi2shw0B+QO3Rz uvobwTrp2tQ13LPwcmQ7tm6EUJctjqk= 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 99AED1424; Tue, 3 Sep 2024 08:15:49 -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 439333F66E; Tue, 3 Sep 2024 08:15:20 -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 9/9] vdso: Modify getrandom to include the correct namespace Date: Tue, 3 Sep 2024 16:14:37 +0100 Message-Id: <20240903151437.1002990-10-vincenzo.frascino@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240903151437.1002990-1-vincenzo.frascino@arm.com> References: <20240903151437.1002990-1-vincenzo.frascino@arm.com> MIME-Version: 1.0 X-Stat-Signature: qmib9698b5uofont46udg4zq1x9af4ry X-Rspam-User: X-Rspamd-Queue-Id: EC2A5A0013 X-Rspamd-Server: rspam02 X-HE-Tag: 1725376523-494009 X-HE-Meta: U2FsdGVkX1+7VD7ncR+bVbpL9RAELowkJ2qYTeINMwS069md6nULMfR31bCuEMFtN1unL4SobMYnyxL5OzhPeGHuZYFq5eZdOZUf5URKv0AujMlMizIw8HZIRnibwmjXNMEnLGMsD2cAvfce9pExupm5RrcQtfYoxIPYluhZ8vR72i2pa6bi0ghy4GEXC+xGgWSycaRRfN1swL10it2tXYeQX6pRmwlvyXNQE3cjtWWk7dQC6bCfi7bEhGkIOclpeGzULTEqbo6gSSNLqWl+9+bWCTvje4KlFbCY+YCqTsmuedjIeqLbfdsiiaP1L8C7l+R88aJt63UefTULVhTRzx3Q1e0uVnEL5dFC/Y1UDhCDwR6SBx7YywYJTwtUsy6z6F00WimSdBrolJfueN98eKx2KwT0gWC/wPlOOb5n6ffdd7FQAmebROg0vDYnwQN81G5Qnjs546/XBvhBwRLnN8fT/pnDvghThVawMVmo6FlTqWUvrMI6EM0d/FtYWeonUwZnkppJtZXR7+QmAPBwvjEY72ebqwiwRly5uAcLAECUE7oDsZRWYFTdD42811gsx/86uEJ/tUQbvBcDVZuf+Cdt+W/QRJspN8moiJa2bO6tedqABrtXvrBE1m5WdUEWQhuE02k0p9tr321IRRuA3+Oy7GdO/3q1oYUI/0FTeGNa4x26BiArD9ejwx7dI1nuvSFIlKiIpavu++Dgq4ax+CYyx6vKj99edRphTzEBkL/rlHYLUFFb7ZrsHLSgcHKsRx1dAvNnAZJypIQf5vncmRjZtRqyUoOWBl8SUXV4fG4A7Se1PQGlETJUq0E4SpfYpC2REuSrEZdg9eevx3HPx/3UDaqL8trF983i3innZAV9xznBXYt4pAaAKezzwEwdjomkvJ1Y2kVyJqkgapwquXzYtZAZWQvzM0m6YtMvZF+oFAHnd8so2iJkM+6SX5umqC3wDchp2tBR798QY5I CRt8Pvg2 wTQOxvEhVsZluzIpejMnaNLBAlVVnhhP7RN7wi/8Qf75gFrNg3OgHWboH/VQsDYmmdtZ3WeGBWjvuiNtvlahOWUEyCiuo8RrMmvZ/7jWQ/MSswLqaSQ8qbQtZCHkL0g/kOu8IWHS45x9LaVj5YQumk93soZpFYMsn2Wxo8646NxnWBqKX/teKxXDceikrPmACZnNd2eN8uyhTCOPeOssbRs84CWBKa5OtSHX/UehkqL7w37mBj3CjogBxJ1BccW2zTwP9Wfpj3YskUEp5Amo3qDKOV5csc1MCvxLKURGk/lBiw5g= 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 --- lib/vdso/getrandom.c | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/lib/vdso/getrandom.c b/lib/vdso/getrandom.c index 938ca539aaa6..9c26b738e4a1 100644 --- a/lib/vdso/getrandom.c +++ b/lib/vdso/getrandom.c @@ -3,19 +3,13 @@ * Copyright (C) 2022-2024 Jason A. Donenfeld . All Rights Reserved. */ -#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)) +#include +#include +#include +#include #define MEMCPY_AND_ZERO_SRC(type, dst, src, len) do { \ while (len >= sizeof(type)) { \ @@ -68,7 +62,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 & VDSO_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; @@ -79,15 +73,15 @@ __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; } /* 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 & ~VDSO_PAGE_MASK) + sizeof(*state) > VDSO_PAGE_SIZE)) return -EFAULT; /* Handle unexpected flags by falling back to the kernel. */