mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 16:47:36 +00:00
Kernel: Fail madvise() volatile change with EINVAL for non-purgeable mem
AnonymousVMObject::set_volatile() assumes that nobody ever calls it on non-purgeable objects, so let's make sure we don't do that. Also return EINVAL instead of EPERM for non-anonymous VM objects so the error codes match.
This commit is contained in:
parent
410b3c85b6
commit
b807f1c3fc
1 changed files with 3 additions and 1 deletions
|
@ -472,8 +472,10 @@ KResultOr<FlatPtr> Process::sys$madvise(Userspace<void*> address, size_t size, i
|
|||
return EINVAL;
|
||||
if (set_volatile || set_nonvolatile) {
|
||||
if (!region->vmobject().is_anonymous())
|
||||
return EPERM;
|
||||
return EINVAL;
|
||||
auto& vmobject = static_cast<AnonymousVMObject&>(region->vmobject());
|
||||
if (!vmobject.is_purgeable())
|
||||
return EINVAL;
|
||||
bool was_purged = false;
|
||||
auto result = vmobject.set_volatile(set_volatile, was_purged);
|
||||
if (result.is_error())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue