mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 06:38:10 +00:00
Kernel: mknod() should not allow unprivileged users to create devices
In fact, unless you are superuser, you may only create a regular file, a named pipe, or a local domain socket. Anything else should EPERM.
This commit is contained in:
parent
3dcec260ed
commit
c7eb3ff1b3
1 changed files with 5 additions and 0 deletions
|
@ -3478,6 +3478,11 @@ int Process::sys$mknod(const char* pathname, mode_t mode, dev_t dev)
|
|||
if (!validate_read_str(pathname))
|
||||
return -EFAULT;
|
||||
|
||||
if (!is_superuser()) {
|
||||
if (!is_regular_file(mode) && !is_fifo(mode) && !is_socket(mode))
|
||||
return -EPERM;
|
||||
}
|
||||
|
||||
return VFS::the().mknod(StringView(pathname), mode, dev, current_directory());
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue