mirror of
https://github.com/Divested-Mobile/DivestOS-Build.git
synced 2024-10-01 01:35:54 -04:00
181519cf38
11b3a0c2c5db
115412c37195
#explicit zero 1131456ac632
#brk 1158ebc243ea
#random 115323b39f7e
#undefined 116a91d9dddb
#merge 11a042b5a0ba
#vla formatting 119ec639de1b
#pthread 1149571a0a49
#read only 11149cc5ccb8
#zero 112e613ccbe7
#fork mmap 11e239c7dff8
#memprot pthread 110b03d92b7f
#xor 11de08419b82
#junk 11897d4903e2
#guard 11648cd68ca3
#ptrhread guard 110bc4dbcbd2
#stack rand 10aa9cc05d07
10a8cdbb6352
#explicit zero 10b28302c668
#brk 109f8be7d07c
#random 10cb91a7ee3a
#undefined 1008279e2fdd
#merge 106a18bd565d
#vla formatting 102f392c2d08
#pthread 108bbce1bc50
#read only 10725f61db82
#zero 104cd257135f
#fork mmap 109220cf622b
#memprot pthread 108ef71d1ffd
#memprot exit 100eaef1abbd
#xor 1064f1cc2148
#junk 105c42a527cf
#guard 105cc8c34e60
#pthread guard 107f61cc8a1c
#stack rand 9abdf523d26
9e4b9b31e6f
#explicit zero 9a3a22a63d2
#brk 97444dbc3cf
#random 9dcd3b72ac9
#undefined 9543e1df342
#merge 9611e5691f7
#vla formatting 98de97ce864
#pthread 9a475717042
#read only 97f0947cc0e
#zero 9e9751d3370
#fork mmap 983cd86d0d5
#memprot pthread 91ebb165455
#memprot exit 9488ba483cf
#xor 9f9351d884b
#junk 985e5bca0a5
#move Signed-off-by: Tad <tad@spotco.us>
48 lines
1.7 KiB
Diff
48 lines
1.7 KiB
Diff
From 6a91d9dddb01964134e50cc73f6f158706da800a Mon Sep 17 00:00:00 2001
|
|
From: Daniel Micay <danielmicay@gmail.com>
|
|
Date: Sat, 19 Nov 2016 09:56:14 -0500
|
|
Subject: [PATCH] stop implicitly marking mappings as mergeable
|
|
|
|
Signed-off-by: anupritaisno1 <www.anuprita804@gmail.com>
|
|
---
|
|
libc/bionic/mmap.cpp | 19 +------------------
|
|
1 file changed, 1 insertion(+), 18 deletions(-)
|
|
|
|
diff --git a/libc/bionic/mmap.cpp b/libc/bionic/mmap.cpp
|
|
index 9aad0b3156..6bf0ecfd16 100644
|
|
--- a/libc/bionic/mmap.cpp
|
|
+++ b/libc/bionic/mmap.cpp
|
|
@@ -39,8 +39,6 @@ extern "C" void* __mmap2(void*, size_t, int, int, int, size_t);
|
|
|
|
#define MMAP2_SHIFT 12 // 2**12 == 4096
|
|
|
|
-static bool kernel_has_MADV_MERGEABLE = true;
|
|
-
|
|
void* mmap64(void* addr, size_t size, int prot, int flags, int fd, off64_t offset) {
|
|
if (offset < 0 || (offset & ((1UL << MMAP2_SHIFT)-1)) != 0) {
|
|
errno = EINVAL;
|
|
@@ -54,22 +52,7 @@ void* mmap64(void* addr, size_t size, int prot, int flags, int fd, off64_t offse
|
|
return MAP_FAILED;
|
|
}
|
|
|
|
- bool is_private_anonymous =
|
|
- (flags & (MAP_PRIVATE | MAP_ANONYMOUS)) == (MAP_PRIVATE | MAP_ANONYMOUS);
|
|
- bool is_stack_or_grows_down = (flags & (MAP_STACK | MAP_GROWSDOWN)) != 0;
|
|
-
|
|
- void* result = __mmap2(addr, size, prot, flags, fd, offset >> MMAP2_SHIFT);
|
|
-
|
|
- if (result != MAP_FAILED && kernel_has_MADV_MERGEABLE &&
|
|
- is_private_anonymous && !is_stack_or_grows_down) {
|
|
- ErrnoRestorer errno_restorer;
|
|
- int rc = madvise(result, size, MADV_MERGEABLE);
|
|
- if (rc == -1 && errno == EINVAL) {
|
|
- kernel_has_MADV_MERGEABLE = false;
|
|
- }
|
|
- }
|
|
-
|
|
- return result;
|
|
+ return __mmap2(addr, size, prot, flags, fd, offset >> MMAP2_SHIFT);
|
|
}
|
|
|
|
void* mmap(void* addr, size_t size, int prot, int flags, int fd, off_t offset) {
|