diff options
-rw-r--r-- | Kernel/Process.h | 5 | ||||
-rw-r--r-- | Kernel/StdLib.cpp | 29 | ||||
-rw-r--r-- | Kernel/StdLib.h | 2 |
3 files changed, 0 insertions, 36 deletions
diff --git a/Kernel/Process.h b/Kernel/Process.h index df4102c5a5..58ecf484e1 100644 --- a/Kernel/Process.h +++ b/Kernel/Process.h @@ -986,11 +986,6 @@ inline ProcessID Thread::pid() const #define VERIFY_NO_PROCESS_BIG_LOCK(process) \ VERIFY(!process->big_lock().own_lock()); -inline static String copy_string_from_user(const Kernel::Syscall::StringArgument& string) -{ - return copy_string_from_user(string.characters, string.length); -} - inline static KResultOr<NonnullOwnPtr<KString>> try_copy_kstring_from_user(const Kernel::Syscall::StringArgument& string) { Userspace<char const*> characters((FlatPtr)string.characters); diff --git a/Kernel/StdLib.cpp b/Kernel/StdLib.cpp index 4571c8b1ec..83874108eb 100644 --- a/Kernel/StdLib.cpp +++ b/Kernel/StdLib.cpp @@ -13,35 +13,6 @@ #include <Kernel/Memory/MemoryManager.h> #include <Kernel/StdLib.h> -String copy_string_from_user(const char* user_str, size_t user_str_size) -{ - bool is_user = Kernel::Memory::is_user_range(VirtualAddress(user_str), user_str_size); - if (!is_user) - return {}; - Kernel::SmapDisabler disabler; - void* fault_at; - ssize_t length = Kernel::safe_strnlen(user_str, user_str_size, fault_at); - if (length < 0) { - dbgln("copy_string_from_user({:p}, {}) failed at {} (strnlen)", static_cast<const void*>(user_str), user_str_size, VirtualAddress { fault_at }); - return {}; - } - if (length == 0) - return String::empty(); - - char* buffer; - auto copied_string = StringImpl::create_uninitialized((size_t)length, buffer); - if (!Kernel::safe_memcpy(buffer, user_str, (size_t)length, fault_at)) { - dbgln("copy_string_from_user({:p}, {}) failed at {} (memcpy)", static_cast<const void*>(user_str), user_str_size, VirtualAddress { fault_at }); - return {}; - } - return copied_string; -} - -String copy_string_from_user(Userspace<const char*> user_str, size_t user_str_size) -{ - return copy_string_from_user(user_str.unsafe_userspace_ptr(), user_str_size); -} - Kernel::KResultOr<NonnullOwnPtr<Kernel::KString>> try_copy_kstring_from_user(Userspace<const char*> user_str, size_t user_str_size) { bool is_user = Kernel::Memory::is_user_range(VirtualAddress(user_str), user_str_size); diff --git a/Kernel/StdLib.h b/Kernel/StdLib.h index f43e1f5f15..642fbbfc41 100644 --- a/Kernel/StdLib.h +++ b/Kernel/StdLib.h @@ -18,8 +18,6 @@ namespace Syscall { struct StringArgument; } -[[nodiscard]] String copy_string_from_user(const char*, size_t); -[[nodiscard]] String copy_string_from_user(Userspace<const char*>, size_t); [[nodiscard]] Kernel::KResultOr<NonnullOwnPtr<Kernel::KString>> try_copy_kstring_from_user(Userspace<const char*>, size_t); [[nodiscard]] Optional<Time> copy_time_from_user(const timespec*); [[nodiscard]] Optional<Time> copy_time_from_user(const timeval*); |