mirror of
https://github.com/RGBCube/serenity
synced 2025-06-01 02:38:13 +00:00
Kernel: Limit the number of file descriptors sys$poll() can handle
Just slap an arbitrary limit on there so we don't panic if somebody asks us to poll 1 fajillion fds. Found by fuzz-syscalls. :^)
This commit is contained in:
parent
7551090056
commit
62f0f73bf0
1 changed files with 4 additions and 0 deletions
|
@ -147,6 +147,10 @@ int Process::sys$poll(Userspace<const Syscall::SC_poll_params*> user_params)
|
|||
if (!copy_from_user(¶ms, user_params))
|
||||
return -EFAULT;
|
||||
|
||||
// This limit is just a number from the place where numbers come from.
|
||||
if (params.nfds >= 16384)
|
||||
return -ENOBUFS;
|
||||
|
||||
Thread::BlockTimeout timeout;
|
||||
if (params.timeout) {
|
||||
timespec timeout_copy;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue