mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-04 13:30:31 +00:00
Kernel: Fix little mistakes in ptrace(PT_PEEK)
Output address validation should be done for the tracer's address space and not the tracee's. Also use copy_to_user() instead of copy_from_user(). The two are really identical at the moment, but maybe we can add some assertions to make sure we're doing what we think we're doing. Thanks to Sergey for spotting these!
This commit is contained in:
parent
f0fd85dc1b
commit
0440f4f257
Notes:
sideshowbarker
2024-07-19 07:36:51 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/0440f4f2574
1 changed files with 2 additions and 2 deletions
|
@ -113,9 +113,9 @@ KResultOr<u32> handle_syscall(const Kernel::Syscall::SC_ptrace_params& params, P
|
|||
auto result = peer->process().peek_user_data(peek_params.address);
|
||||
if (result.is_error())
|
||||
return -EFAULT;
|
||||
if (!peer->process().validate_write(peek_params.out_data, sizeof(u32)))
|
||||
if (!caller.validate_write(peek_params.out_data, sizeof(u32)))
|
||||
return -EFAULT;
|
||||
copy_from_user(peek_params.out_data, &result.value());
|
||||
copy_to_user(peek_params.out_data, &result.value());
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue