Kaynağa Gözat

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. :^)
Andreas Kling 4 yıl önce
ebeveyn
işleme
1730c23775

+ 0 - 2
Kernel/Net/IPv4Socket.cpp

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

+ 0 - 1
Kernel/Syscalls/debug.cpp

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

+ 0 - 1
Kernel/Syscalls/getrandom.cpp

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

+ 0 - 3
Kernel/Syscalls/select.cpp

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

+ 0 - 3
Kernel/Syscalls/socket.cpp

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