1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-21 15:55:07 +00:00

Kernel+ping: Only allow superuser to create SOCK_RAW sockets

/bin/ping is now setuid-root, and will drop privileges immediately
after opening a raw socket.
This commit is contained in:
Andreas Kling 2019-12-31 01:42:34 +01:00
parent 5c918d0e71
commit 3f254bfbc8
3 changed files with 8 additions and 0 deletions

View file

@ -2609,6 +2609,8 @@ size_t Process::amount_purgeable_nonvolatile() const
int Process::sys$socket(int domain, int type, int protocol)
{
if ((type & SOCK_TYPE_MASK) == SOCK_RAW && !is_superuser())
return -EACCES;
int fd = alloc_fd();
if (fd < 0)
return fd;