[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <712424314ffe0bd65b603925ca1283e7d2a3745f.1723817900.git.christophe.leroy@csgroup.eu>
Date: Fri, 16 Aug 2024 16:36:53 +0200
From: Christophe Leroy <christophe.leroy@...roup.eu>
To: Michael Ellerman <mpe@...erman.id.au>,
Nicholas Piggin <npiggin@...il.com>,
Naveen N Rao <naveen@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>,
Borislav Petkov <bp@...en8.de>,
Dave Hansen <dave.hansen@...ux.intel.com>,
x86@...nel.org,
"H. Peter Anvin" <hpa@...or.com>,
"Theodore Ts'o" <tytso@....edu>,
"Jason A. Donenfeld" <Jason@...c4.com>,
Andy Lutomirski <luto@...nel.org>,
Vincenzo Frascino <vincenzo.frascino@....com>,
Arnd Bergmann <arnd@...db.de>
Cc: Christophe Leroy <christophe.leroy@...roup.eu>,
linux-kernel@...r.kernel.org,
linuxppc-dev@...ts.ozlabs.org,
linux-arch@...r.kernel.org
Subject: [PATCH 6/9] vdso: Only use MAP_DROPPABLE when VM_DROPPABLE exists
Commit 9651fcedf7b9 ("mm: add MAP_DROPPABLE for designating always
lazily freeable mappings") only adds MAP_DROPPABLE for 64 bits
architectures, so don't use it on 32 bits as it leads to ENOTSUPP
on mmap().
Signed-off-by: Christophe Leroy <christophe.leroy@...roup.eu>
---
lib/vdso/getrandom.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/lib/vdso/getrandom.c b/lib/vdso/getrandom.c
index 425a422651de..11ba6dbf3b5e 100644
--- a/lib/vdso/getrandom.c
+++ b/lib/vdso/getrandom.c
@@ -78,7 +78,11 @@ __cvdso_getrandom_data(const struct vdso_rng_data *rng_info, void *buffer, size_
params->size_of_opaque_state = sizeof(*state);
params->mmap_prot = PROT_READ | PROT_WRITE;
- params->mmap_flags = MAP_DROPPABLE | MAP_ANONYMOUS;
+ if (IS_ENABLED(CONFIG_64BIT))
+ params->mmap_flags = MAP_DROPPABLE | MAP_ANONYMOUS;
+ else
+ params->mmap_flags = MAP_PRIVATE | MAP_ANONYMOUS;
+
for (i = 0; i < ARRAY_SIZE(params->reserved); i++)
params->reserved[i] = 0;
--
2.44.0
Powered by blists - more mailing lists