mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 06:48:12 +00:00
Kernel: Don't allow userspace to sys$open() literal symlinks
The O_NOFOLLOW_NOERROR is an internal kernel mechanism used for the implementation of sys$readlink() and sys$lstat(). There is no reason to allow userspace to open symlinks directly.
This commit is contained in:
parent
e23536d682
commit
d79de38bd2
1 changed files with 6 additions and 0 deletions
|
@ -1863,6 +1863,9 @@ int Process::sys$open(const Syscall::SC_open_params* user_params)
|
|||
auto options = params.options;
|
||||
auto mode = params.mode;
|
||||
|
||||
if (options & O_NOFOLLOW_NOERROR)
|
||||
return -EINVAL;
|
||||
|
||||
if ((options & O_RDWR) || (options & O_WRONLY))
|
||||
REQUIRE_PROMISE(wpath);
|
||||
else
|
||||
|
@ -1905,6 +1908,9 @@ int Process::sys$openat(const Syscall::SC_openat_params* user_params)
|
|||
int options = params.options;
|
||||
u16 mode = params.mode;
|
||||
|
||||
if (options & O_NOFOLLOW_NOERROR)
|
||||
return -EINVAL;
|
||||
|
||||
if ((options & O_RDWR) || (options & O_WRONLY))
|
||||
REQUIRE_PROMISE(wpath);
|
||||
else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue