mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 14:57:35 +00:00
Kernel: Defer switching the paging scope in ptrace(PT_POKE) a little
If we can fail with EFAULT early, might as well avoid switching the paging scope.
This commit is contained in:
parent
e08e1a89d9
commit
8ff0afd829
1 changed files with 3 additions and 3 deletions
|
@ -72,11 +72,11 @@ KResultOr<u32> Process::peek_user_data(Userspace<const u32*> address)
|
|||
|
||||
KResult Process::poke_user_data(Userspace<u32*> address, u32 data)
|
||||
{
|
||||
ProcessPagingScope scope(*this);
|
||||
Range range = { VirtualAddress(address), sizeof(u32) };
|
||||
auto* region = find_region_containing(range);
|
||||
if (!region)
|
||||
return KResult(-EFAULT);
|
||||
ProcessPagingScope scope(*this);
|
||||
if (region->is_shared()) {
|
||||
// If the region is shared, we change its vmobject to a PrivateInodeVMObject
|
||||
// to prevent the write operation from changing any shared inode data
|
||||
|
@ -97,11 +97,11 @@ KResult Process::poke_user_data(Userspace<u32*> address, u32 data)
|
|||
});
|
||||
|
||||
if (!copy_to_user(address, &data)) {
|
||||
dbg() << "Invalid address for poke_user_data: " << address.ptr();
|
||||
dbgln("poke_user_data: Bad address {:p}", address.ptr());
|
||||
return KResult(-EFAULT);
|
||||
}
|
||||
|
||||
return KResult(KSuccess);
|
||||
return KSuccess;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue