mirror of
https://github.com/RGBCube/serenity
synced 2025-07-24 19:57:41 +00:00
Kernel: Reduce pledge requirement for recvfrom()+sendto() to "stdio"
Since these only operate on already-open sockets, we should treat them the same as we do read() and write() by putting them into "stdio".
This commit is contained in:
parent
955034e86e
commit
114a770c6f
1 changed files with 2 additions and 2 deletions
|
@ -3008,6 +3008,7 @@ int Process::sys$connect(int sockfd, const sockaddr* address, socklen_t address_
|
||||||
|
|
||||||
ssize_t Process::sys$sendto(const Syscall::SC_sendto_params* user_params)
|
ssize_t Process::sys$sendto(const Syscall::SC_sendto_params* user_params)
|
||||||
{
|
{
|
||||||
|
REQUIRE_PROMISE(stdio);
|
||||||
if (!validate_read_typed(user_params))
|
if (!validate_read_typed(user_params))
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
|
|
||||||
|
@ -3029,12 +3030,12 @@ ssize_t Process::sys$sendto(const Syscall::SC_sendto_params* user_params)
|
||||||
return -ENOTSOCK;
|
return -ENOTSOCK;
|
||||||
SmapDisabler disabler;
|
SmapDisabler disabler;
|
||||||
auto& socket = *description->socket();
|
auto& socket = *description->socket();
|
||||||
REQUIRE_PROMISE_FOR_SOCKET_DOMAIN(socket.domain());
|
|
||||||
return socket.sendto(*description, params.data.data, params.data.size, flags, addr, addr_length);
|
return socket.sendto(*description, params.data.data, params.data.size, flags, addr, addr_length);
|
||||||
}
|
}
|
||||||
|
|
||||||
ssize_t Process::sys$recvfrom(const Syscall::SC_recvfrom_params* user_params)
|
ssize_t Process::sys$recvfrom(const Syscall::SC_recvfrom_params* user_params)
|
||||||
{
|
{
|
||||||
|
REQUIRE_PROMISE(stdio);
|
||||||
if (!validate_read_typed(user_params))
|
if (!validate_read_typed(user_params))
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
|
|
||||||
|
@ -3062,7 +3063,6 @@ ssize_t Process::sys$recvfrom(const Syscall::SC_recvfrom_params* user_params)
|
||||||
if (!description->is_socket())
|
if (!description->is_socket())
|
||||||
return -ENOTSOCK;
|
return -ENOTSOCK;
|
||||||
auto& socket = *description->socket();
|
auto& socket = *description->socket();
|
||||||
REQUIRE_PROMISE_FOR_SOCKET_DOMAIN(socket.domain());
|
|
||||||
|
|
||||||
bool original_blocking = description->is_blocking();
|
bool original_blocking = description->is_blocking();
|
||||||
if (flags & MSG_DONTWAIT)
|
if (flags & MSG_DONTWAIT)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue