https://git.reactos.org/?p=reactos.git;a=commitdiff;h=78ded05547ca67fba1145…
commit 78ded05547ca67fba11450ef5361e6f19788a31e
Author: Timo Kreuzer <timo.kreuzer(a)reactos.org>
AuthorDate: Sun Nov 3 16:59:19 2024 +0200
Commit: Timo Kreuzer <timo.kreuzer(a)reactos.org>
CommitDate: Tue Feb 4 16:45:48 2025 +0200
[MINIHAL] Move the definition of _MINIHAL_ to directory scope
This is required, so that the definition is available when preprocessing asm files on MSVC builds. Otherwise systimer.s will contain KeStallExecutionProcessor, which must not be used in freeldr.
---
hal/halx86/minihal/CMakeLists.txt | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/hal/halx86/minihal/CMakeLists.txt b/hal/halx86/minihal/CMakeLists.txt
index d446bf3cc7b..4a7ca0f9d89 100644
--- a/hal/halx86/minihal/CMakeLists.txt
+++ b/hal/halx86/minihal/CMakeLists.txt
@@ -1,4 +1,9 @@
+# We need to define this here, because the target definitions are not
+# passed to CL, when preprocessing the asm files on MSVC builds.
+# See CORE-19847
+add_definitions(-D_MINIHAL_)
+
list(APPEND MINI_HAL_SOURCE
../generic/portio.c
../legacy/bus/bushndlr.c
@@ -39,6 +44,6 @@ endif()
add_asm_files(mini_hal_asm ../generic/systimer.S)
add_library(mini_hal ${MINI_HAL_SOURCE} ${mini_hal_asm})
-target_compile_definitions(mini_hal PRIVATE _MINIHAL_ _BLDR_ _NTSYSTEM_)
+target_compile_definitions(mini_hal PRIVATE _BLDR_ _NTSYSTEM_)
add_dependencies(mini_hal psdk bugcodes asm)
add_pch(mini_hal ../include/hal.h MINI_HAL_SOURCE)
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=aa46e0f0a7471dc86ec91…
commit aa46e0f0a7471dc86ec9118fa0f83736dd9de420
Author: Timo Kreuzer <timo.kreuzer(a)reactos.org>
AuthorDate: Fri Jan 31 11:30:50 2025 +0200
Commit: Timo Kreuzer <timo.kreuzer(a)reactos.org>
CommitDate: Tue Feb 4 09:00:35 2025 +0200
[RTL/x64] Fix a bug in RtlpUnwindInternal
Check if the stack pointer is out of bounds, before trying to unwind a frame. This will not fix any crashes, but it prevents simple crashes from going into a recursive exception.
---
sdk/lib/rtl/amd64/unwind.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/sdk/lib/rtl/amd64/unwind.c b/sdk/lib/rtl/amd64/unwind.c
index 72393b9404b..3a438390cb6 100644
--- a/sdk/lib/rtl/amd64/unwind.c
+++ b/sdk/lib/rtl/amd64/unwind.c
@@ -649,6 +649,18 @@ Exit:
return NULL;
}
+static __inline
+BOOL
+RtlpIsStackPointerValid(
+ _In_ ULONG64 StackPointer,
+ _In_ ULONG64 LowLimit,
+ _In_ ULONG64 HighLimit)
+{
+ return (StackPointer >= LowLimit) &&
+ (StackPointer < HighLimit) &&
+ ((StackPointer & 7) == 0);
+}
+
/*!
\remark The implementation is based on the description in this blog: http://www.nynaeve.net/?p=106
@@ -699,6 +711,11 @@ RtlpUnwindInternal(
/* Start looping */
while (TRUE)
{
+ if (!RtlpIsStackPointerValid(UnwindContext.Rsp, StackLow, StackHigh))
+ {
+ return FALSE;
+ }
+
/* Lookup the FunctionEntry for the current RIP */
FunctionEntry = RtlLookupFunctionEntry(UnwindContext.Rip, &ImageBase, NULL);
if (FunctionEntry == NULL)