mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-05 09:52:54 +00:00
Kernel: Ptrace::handle_syscall() should return errors as KResult
This commit is contained in:
parent
eaa63fdda5
commit
23febb9d8e
Notes:
sideshowbarker
2024-07-19 00:39:38 +09:00
Author: https://github.com/awesomekling
Commit: 23febb9d8e
1 changed files with 6 additions and 6 deletions
|
@ -128,27 +128,27 @@ KResultOr<u32> handle_syscall(const Kernel::Syscall::SC_ptrace_params& params, P
|
|||
case PT_PEEK: {
|
||||
Kernel::Syscall::SC_ptrace_peek_params peek_params;
|
||||
if (!copy_from_user(&peek_params, reinterpret_cast<Kernel::Syscall::SC_ptrace_peek_params*>(params.addr)))
|
||||
return -EFAULT;
|
||||
return KResult(-EFAULT);
|
||||
if (!is_user_address(VirtualAddress { peek_params.address }))
|
||||
return -EFAULT;
|
||||
return KResult(-EFAULT);
|
||||
auto result = peer->process().peek_user_data(Userspace<const u32*> { (FlatPtr)peek_params.address });
|
||||
if (result.is_error())
|
||||
return result.error();
|
||||
if (!copy_to_user(peek_params.out_data, &result.value()))
|
||||
return -EFAULT;
|
||||
return KResult(-EFAULT);
|
||||
break;
|
||||
}
|
||||
|
||||
case PT_POKE:
|
||||
if (!is_user_address(VirtualAddress { params.addr }))
|
||||
return -EFAULT;
|
||||
return KResult(-EFAULT);
|
||||
return peer->process().poke_user_data(Userspace<u32*> { (FlatPtr)params.addr }, params.data);
|
||||
|
||||
default:
|
||||
return -EINVAL;
|
||||
return KResult(-EINVAL);
|
||||
}
|
||||
|
||||
return 0;
|
||||
return KSuccess;
|
||||
}
|
||||
|
||||
void copy_kernel_registers_into_ptrace_registers(PtraceRegisters& ptrace_regs, const RegisterState& kernel_regs)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue