mirror of
https://github.com/genodelabs/genode.git
synced 2025-02-21 18:06:50 +00:00
libc: don't treat 'mmap()' address hint w/o MAP_FIXED flag as error
Fixes #3855
This commit is contained in:
parent
2f55ffdf20
commit
dd8777093d
@ -413,9 +413,15 @@ __SYS_(void *, mmap, (void *addr, ::size_t length,
|
|||||||
int prot, int flags,
|
int prot, int flags,
|
||||||
int libc_fd, ::off_t offset),
|
int libc_fd, ::off_t offset),
|
||||||
{
|
{
|
||||||
|
|
||||||
/* handle requests for anonymous memory */
|
/* handle requests for anonymous memory */
|
||||||
if (!addr && libc_fd == -1) {
|
if ((flags & MAP_ANONYMOUS) || (flags & MAP_ANON)) {
|
||||||
|
|
||||||
|
if (flags & MAP_FIXED) {
|
||||||
|
Genode::error("mmap for fixed predefined address not supported yet");
|
||||||
|
errno = EINVAL;
|
||||||
|
return MAP_FAILED;
|
||||||
|
}
|
||||||
|
|
||||||
bool const executable = prot & PROT_EXEC;
|
bool const executable = prot & PROT_EXEC;
|
||||||
void *start = mem_alloc(executable)->alloc(length, PAGE_SHIFT);
|
void *start = mem_alloc(executable)->alloc(length, PAGE_SHIFT);
|
||||||
if (!start) {
|
if (!start) {
|
||||||
|
@ -1640,8 +1640,8 @@ void *Libc::Vfs_plugin::mmap(void *addr_in, ::size_t length, int prot, int flags
|
|||||||
return (void *)-1;
|
return (void *)-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (addr_in != 0) {
|
if (flags & MAP_FIXED) {
|
||||||
error("mmap for predefined address not supported");
|
error("mmap for fixed predefined address not supported yet");
|
||||||
errno = EINVAL;
|
errno = EINVAL;
|
||||||
return (void *)-1;
|
return (void *)-1;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user