mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-02-22 23:55:12 +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:
@@ -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());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user