1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 08:48:11 +00:00

Kernel: Use Userspace<T> for the execve syscall

This commit is contained in:
Brian Gianforcaro 2020-08-09 12:11:13 -07:00 committed by Andreas Kling
parent 025a2a3c5b
commit 0f42463eab
5 changed files with 8 additions and 8 deletions

View file

@ -544,7 +544,7 @@ int Process::exec(String path, Vector<String> arguments, Vector<String> environm
return 0;
}
int Process::sys$execve(const Syscall::SC_execve_params* user_params)
int Process::sys$execve(Userspace<const Syscall::SC_execve_params*> user_params)
{
REQUIRE_PROMISE(exec);
@ -568,14 +568,14 @@ int Process::sys$execve(const Syscall::SC_execve_params* user_params)
path = path_arg.value();
}
auto copy_user_strings = [&](const auto& list, auto& output) {
auto copy_user_strings = [this](const auto& list, auto& output) {
if (!list.length)
return true;
if (!validate_read_typed(list.strings, list.length))
return false;
Vector<Syscall::StringArgument, 32> strings;
strings.resize(list.length);
copy_from_user(strings.data(), list.strings, list.length * sizeof(Syscall::StringArgument));
copy_from_user(strings.data(), list.strings.unsafe_userspace_ptr(), list.length * sizeof(Syscall::StringArgument));
for (size_t i = 0; i < list.length; ++i) {
auto string = validate_and_copy_string_from_user(strings[i]);
if (string.is_null())