1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-20 14:55:08 +00:00

Kernel: Don't ignore validation result in ptrace(PT_PEEK)

Also mark all of the address validation functions [[nodiscard]] to turn
this kind of bug into a compile error in the future.
This commit is contained in:
Andreas Kling 2020-04-13 22:40:38 +02:00
parent e432a27676
commit c8edcf1d71
2 changed files with 12 additions and 11 deletions

View file

@ -113,7 +113,8 @@ 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;
peer->process().validate_write(peek_params.out_data, sizeof(u32));
if (!peer->process().validate_write(peek_params.out_data, sizeof(u32)))
return -EFAULT;
copy_from_user(peek_params.out_data, &result.value());
break;
}