mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 02:38:11 +00:00
Kernel: Disallow opening socket files
You can still open files that have sockets attached to them from inside the kernel via VFS::open() (and in fact, that is what LocalSocket itslef uses), but trying to do that from userspace using open() will now fail with ENXIO.
This commit is contained in:
parent
00c166e2ca
commit
752617cbb2
1 changed files with 4 additions and 0 deletions
|
@ -2082,6 +2082,10 @@ int Process::sys$open(const Syscall::SC_open_params* user_params)
|
||||||
if (result.is_error())
|
if (result.is_error())
|
||||||
return result.error();
|
return result.error();
|
||||||
auto description = result.value();
|
auto description = result.value();
|
||||||
|
|
||||||
|
if (description->inode() && description->inode()->socket())
|
||||||
|
return -ENXIO;
|
||||||
|
|
||||||
u32 fd_flags = (options & O_CLOEXEC) ? FD_CLOEXEC : 0;
|
u32 fd_flags = (options & O_CLOEXEC) ? FD_CLOEXEC : 0;
|
||||||
m_fds[fd].set(move(description), fd_flags);
|
m_fds[fd].set(move(description), fd_flags);
|
||||||
return fd;
|
return fd;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue