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

Kernel: Don't assert on PT_PEEK with kernelspace address

We were casting the address to Userspace<T> without validating it first
which is no good and will trap an assertion soon after.

Let's catch this sooner with an ASSERT in the Userspace<T> constructor
and update the PT_PEEK and PT_POKE handlers to avoid it.

Fixes #4505.
This commit is contained in:
Andreas Kling 2020-12-23 14:42:22 +01:00
parent c25cf5fb56
commit eaa63fdda5
2 changed files with 10 additions and 9 deletions

View file

@ -26,6 +26,7 @@
#pragma once
#include <AK/Assertions.h>
#include <AK/StdLibExtras.h>
#include <AK/Types.h>
@ -59,6 +60,7 @@ public:
Userspace(FlatPtr ptr)
: m_ptr(ptr)
{
ASSERT(m_ptr < 0xc0000000);
}
FlatPtr ptr() const { return m_ptr; }