mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 15:40:19 +00:00
Kernel: Always require read access when mmaping a file
POSIX says, "The file descriptor fildes shall have been opened with read permission, regardless of the protection options specified."
This commit is contained in:
parent
6af2418de7
commit
f945d7c358
Notes:
sideshowbarker
2024-07-19 06:01:08 +09:00
Author: https://github.com/bugaevc Commit: https://github.com/SerenityOS/serenity/commit/f945d7c3589 Pull-request: https://github.com/SerenityOS/serenity/pull/2430 Reviewed-by: https://github.com/alimpfard
1 changed files with 2 additions and 1 deletions
|
@ -430,7 +430,8 @@ void* Process::sys$mmap(const Syscall::SC_mmap_params* user_params)
|
|||
return (void*)-EBADF;
|
||||
if (description->is_directory())
|
||||
return (void*)-ENODEV;
|
||||
if ((prot & PROT_READ) && !description->is_readable())
|
||||
// Require read access even when read protection is not requested.
|
||||
if (!description->is_readable())
|
||||
return (void*)-EACCES;
|
||||
if (map_shared) {
|
||||
if ((prot & PROT_WRITE) && !description->is_writable())
|
||||
|
|
Loading…
Reference in a new issue