1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-22 16:35:08 +00:00

Kernel: Remove a bunch of no-longer-necessary SmapDisablers

We forgot to remove the automatic SMAP disablers after fixing up all
this code to not access userspace memory directly. Let's lock things
down at last. :^)
This commit is contained in:
Andreas Kling 2021-01-17 14:49:14 +01:00
parent fd441b954d
commit 1730c23775
5 changed files with 0 additions and 10 deletions

View file

@ -506,8 +506,6 @@ int IPv4Socket::ioctl(FileDescription&, unsigned request, FlatPtr arg)
{ {
REQUIRE_PROMISE(inet); REQUIRE_PROMISE(inet);
SmapDisabler disabler;
auto ioctl_route = [request, arg]() { auto ioctl_route = [request, arg]() {
rtentry route; rtentry route;
if (!copy_from_user(&route, (rtentry*)arg)) if (!copy_from_user(&route, (rtentry*)arg))

View file

@ -48,7 +48,6 @@ int Process::sys$dbgputstr(Userspace<const u8*> characters, int length)
if (length <= 0) if (length <= 0)
return 0; return 0;
SmapDisabler disabler;
auto buffer = UserOrKernelBuffer::for_user_buffer(characters, length); auto buffer = UserOrKernelBuffer::for_user_buffer(characters, length);
if (!buffer.has_value()) if (!buffer.has_value())
return -EFAULT; return -EFAULT;

View file

@ -39,7 +39,6 @@ ssize_t Process::sys$getrandom(Userspace<void*> buffer, size_t buffer_size, [[ma
if (buffer_size <= 0) if (buffer_size <= 0)
return -EINVAL; return -EINVAL;
SmapDisabler disabler;
auto data_buffer = UserOrKernelBuffer::for_user_buffer(buffer, buffer_size); auto data_buffer = UserOrKernelBuffer::for_user_buffer(buffer, buffer_size);
if (!data_buffer.has_value()) if (!data_buffer.has_value())
return -EFAULT; return -EFAULT;

View file

@ -39,7 +39,6 @@ int Process::sys$select(const Syscall::SC_select_params* user_params)
REQUIRE_PROMISE(stdio); REQUIRE_PROMISE(stdio);
Syscall::SC_select_params params; Syscall::SC_select_params params;
SmapDisabler disabler;
if (!copy_from_user(&params, user_params)) if (!copy_from_user(&params, user_params))
return -EFAULT; return -EFAULT;
@ -153,8 +152,6 @@ int Process::sys$poll(Userspace<const Syscall::SC_poll_params*> user_params)
if (!copy_from_user(&params, user_params)) if (!copy_from_user(&params, user_params))
return -EFAULT; return -EFAULT;
SmapDisabler disabler;
Thread::BlockTimeout timeout; Thread::BlockTimeout timeout;
if (params.timeout) { if (params.timeout) {
timespec timeout_copy; timespec timeout_copy;

View file

@ -208,7 +208,6 @@ ssize_t Process::sys$sendmsg(int sockfd, Userspace<const struct msghdr*> user_ms
auto& socket = *description->socket(); auto& socket = *description->socket();
if (socket.is_shut_down_for_writing()) if (socket.is_shut_down_for_writing())
return -EPIPE; return -EPIPE;
SmapDisabler disabler;
auto data_buffer = UserOrKernelBuffer::for_user_buffer((u8*)iovs[0].iov_base, iovs[0].iov_len); auto data_buffer = UserOrKernelBuffer::for_user_buffer((u8*)iovs[0].iov_base, iovs[0].iov_len);
if (!data_buffer.has_value()) if (!data_buffer.has_value())
return -EFAULT; return -EFAULT;
@ -236,8 +235,6 @@ ssize_t Process::sys$recvmsg(int sockfd, Userspace<struct msghdr*> user_msg, int
Userspace<sockaddr*> user_addr((FlatPtr)msg.msg_name); Userspace<sockaddr*> user_addr((FlatPtr)msg.msg_name);
Userspace<socklen_t*> user_addr_length(msg.msg_name ? (FlatPtr)&user_msg.unsafe_userspace_ptr()->msg_namelen : 0); Userspace<socklen_t*> user_addr_length(msg.msg_name ? (FlatPtr)&user_msg.unsafe_userspace_ptr()->msg_namelen : 0);
SmapDisabler disabler;
auto description = file_description(sockfd); auto description = file_description(sockfd);
if (!description) if (!description)
return -EBADF; return -EBADF;