[PATCH 6/9] vdso: Only use MAP_DROPPABLE when VM_DROPPABLE exists

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 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





[Index of Archives]     [Linux Kernel]     [Kernel Newbies]     [x86 Platform Driver]     [Netdev]     [Linux Wireless]     [Netfilter]     [Bugtraq]     [Linux Filesystems]     [Yosemite Discussion]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]

  Powered by Linux