mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-24 02:09:28 +00:00
Kernel: mmap(..., MAP_PRIVATE, fd, offset) is not supported
Make mmap return -ENOTSUP in this case to make sure users don't get confused and think they're using a private mapping when it's actually shared. It's currenlty not possible to open a file and mmap it MAP_PRIVATE, and change the perms of the private mapping to ones that don't match the permissions of the underlying file.
This commit is contained in:
committed by
Andreas Kling
parent
56974f76be
commit
e594724b01
@@ -336,6 +336,9 @@ void* Process::sys$mmap(const Syscall::SC_mmap_params* user_params)
|
||||
return (void*)-EINVAL;
|
||||
if (static_cast<size_t>(offset) & ~PAGE_MASK)
|
||||
return (void*)-EINVAL;
|
||||
// FIXME: Implement MAP_PRIVATE for FileDescription-backed mmap
|
||||
if (map_private)
|
||||
return (void*)-ENOTSUP;
|
||||
auto description = file_description(fd);
|
||||
if (!description)
|
||||
return (void*)-EBADF;
|
||||
|
||||
Reference in New Issue
Block a user