mirror of
https://github.com/RGBCube/serenity
synced 2025-07-24 22:17:42 +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
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;
|
return (void*)-EBADF;
|
||||||
if (description->is_directory())
|
if (description->is_directory())
|
||||||
return (void*)-ENODEV;
|
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;
|
return (void*)-EACCES;
|
||||||
if (map_shared) {
|
if (map_shared) {
|
||||||
if ((prot & PROT_WRITE) && !description->is_writable())
|
if ((prot & PROT_WRITE) && !description->is_writable())
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue