projects
/
musl
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix TLS layout of TLS variant I when there is a gap above TP
[musl]
/
src
/
mman
/
mmap.c
diff --git
a/src/mman/mmap.c
b/src/mman/mmap.c
index
19caadb
..
1592403
100644
(file)
--- a/
src/mman/mmap.c
+++ b/
src/mman/mmap.c
@@
-14,6
+14,7
@@
weak_alias(dummy, __vm_wait);
void *__mmap(void *start, size_t len, int prot, int flags, int fd, off_t off)
{
void *__mmap(void *start, size_t len, int prot, int flags, int fd, off_t off)
{
+ long ret;
if (off & OFF_MASK) {
errno = EINVAL;
return MAP_FAILED;
if (off & OFF_MASK) {
errno = EINVAL;
return MAP_FAILED;
@@
-26,10
+27,14
@@
void *__mmap(void *start, size_t len, int prot, int flags, int fd, off_t off)
__vm_wait();
}
#ifdef SYS_mmap2
__vm_wait();
}
#ifdef SYS_mmap2
- ret
urn (void *)
syscall(SYS_mmap2, start, len, prot, flags, fd, off/UNIT);
+ ret
= __
syscall(SYS_mmap2, start, len, prot, flags, fd, off/UNIT);
#else
#else
- ret
urn (void *)
syscall(SYS_mmap, start, len, prot, flags, fd, off);
+ ret
= __
syscall(SYS_mmap, start, len, prot, flags, fd, off);
#endif
#endif
+ /* Fixup incorrect EPERM from kernel. */
+ if (ret == -EPERM && !start && (flags&MAP_ANON) && !(flags&MAP_FIXED))
+ ret = -ENOMEM;
+ return (void *)__syscall_ret(ret);
}
weak_alias(__mmap, mmap);
}
weak_alias(__mmap, mmap);