mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-26 06:18:59 +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:
parent
56974f76be
commit
e594724b01
Notes:
sideshowbarker
2024-07-19 10:15:08 +09:00
Author: https://github.com/ADKaster
Commit: e594724b01
Pull-request: https://github.com/SerenityOS/serenity/pull/1046
1 changed files with 3 additions and 0 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue