diff options
| author | Amlal El Mahrouss <amlalelmahrouss@icloud.com> | 2024-02-08 11:50:09 +0100 |
|---|---|---|
| committer | Amlal El Mahrouss <amlalelmahrouss@icloud.com> | 2024-02-08 11:50:09 +0100 |
| commit | fe44d10437a3508f62ac21e03cd712aba0c1683b (patch) | |
| tree | 96c049d0412f097c7dffb2ba31b3f118ea903fb5 | |
| parent | 477b65fe9d50014273f9f2357bdeb2dc82693db2 (diff) | |
Kernel: Protect region from 0 to 512.
Signed-off-by: Amlal El Mahrouss <amlalelmahrouss@icloud.com>
| -rw-r--r-- | Private/NewKit/Json.hpp | 2 | ||||
| -rw-r--r-- | Private/Source/PageManager.cxx | 6 |
2 files changed, 6 insertions, 2 deletions
diff --git a/Private/NewKit/Json.hpp b/Private/NewKit/Json.hpp index d52f1d4a..1c404397 100644 --- a/Private/NewKit/Json.hpp +++ b/Private/NewKit/Json.hpp @@ -56,7 +56,7 @@ struct JsonStreamTraits final { for (SizeT i = 1; i < len; i++) { if (full_array[i] == ' ') continue; - JsonType type(255, 255); + JsonType type(kPathLen, kPathLen); if (probe_key) { type.AsKey().Data()[key_len] = full_array[i]; 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; } } |
