1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 23:07:35 +00:00

Kernel+strace: Remove unnecessary indirection for PEEK

Also, remove incomplete, superfluous check.
Incomplete, because only the byte at the provided address was checked;
this misses the last bytes of the "jerk page".
Superfluous, because it is already correctly checked by peek_user_data
(which calls copy_from_user).

The caller/tracer should not typically attempt to read non-userspace
addresses, we don't need to "hot-path" it either.
This commit is contained in:
Ben Wiederhake 2021-11-25 20:15:02 +01:00 committed by Andreas Kling
parent 6f37510a71
commit 3e223185b3
3 changed files with 5 additions and 21 deletions

View file

@ -18,12 +18,9 @@ long ptrace(int request, pid_t tid, void* addr, void* data)
// by looking at errno rather than the return value.
FlatPtr out_data;
Syscall::SC_ptrace_peek_params peek_params;
auto is_peek_type = request == PT_PEEK || request == PT_PEEKDEBUG;
if (is_peek_type) {
peek_params.address = reinterpret_cast<FlatPtr*>(addr);
peek_params.out_data = &out_data;
addr = &peek_params;
data = &out_data;
}
Syscall::SC_ptrace_params params {