diff --git a/Kernel/Syscalls/mmap.cpp b/Kernel/Syscalls/mmap.cpp index 3bcfbbdc39..515b054d9b 100644 --- a/Kernel/Syscalls/mmap.cpp +++ b/Kernel/Syscalls/mmap.cpp @@ -472,8 +472,10 @@ KResultOr Process::sys$madvise(Userspace 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(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())