mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-04 23:57:25 +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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user