summaryrefslogtreecommitdiffhomepage
path: root/Private/Source
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlalelmahrouss@icloud.com>2024-02-08 11:50:09 +0100
committerAmlal El Mahrouss <amlalelmahrouss@icloud.com>2024-02-08 11:50:09 +0100
commitfe44d10437a3508f62ac21e03cd712aba0c1683b (patch)
tree96c049d0412f097c7dffb2ba31b3f118ea903fb5 /Private/Source
parent477b65fe9d50014273f9f2357bdeb2dc82693db2 (diff)
Kernel: Protect region from 0 to 512.
Signed-off-by: Amlal El Mahrouss <amlalelmahrouss@icloud.com>
Diffstat (limited to 'Private/Source')
-rw-r--r--Private/Source/PageManager.cxx6
1 files changed, 5 insertions, 1 deletions
diff --git a/Private/Source/PageManager.cxx b/Private/Source/PageManager.cxx
index d6455a18..7dec0343 100644
--- a/Private/Source/PageManager.cxx
+++ b/Private/Source/PageManager.cxx
@@ -10,6 +10,9 @@
#include <KernelKit/DebugOutput.hpp>
#include <NewKit/PageManager.hpp>
+//! null deref will throw (Page Zero detected, aborting program!)
+#define kProtectedRegionEnd 512
+
namespace HCore {
PTEWrapper::PTEWrapper(Boolean Rw, Boolean User, Boolean ExecDisable,
UIntPtr VirtAddr)
@@ -23,11 +26,12 @@ PTEWrapper::PTEWrapper(Boolean Rw, Boolean User, Boolean ExecDisable,
m_Present(true),
m_Accessed(false) {
// special case for the null region.
- if (VirtAddr == 0) {
+ if (VirtAddr <= kProtectedRegionEnd) {
m_Wt = false;
m_Rw = false;
m_Cache = false;
m_Shareable = false;
+ m_ExecDisable = true;
}
}