https://git.reactos.org/?p=reactos.git;a=commitdiff;h=5d91d52417f94e41427bd3ecc7239c31d726d8ac
commit 5d91d52417f94e41427bd3ecc7239c31d726d8ac Author: Jérôme Gardou <jerome.gar...@reactos.org> AuthorDate: Fri Nov 2 18:26:52 2018 +0100 Commit: Jérôme Gardou <zefk...@users.noreply.github.com> CommitDate: Sat Nov 3 12:50:16 2018 +0100 [KMTESTS/MM] Enable again accessing forbidden memory. Also adda test case for the PAGE_GUARD case ROSTESTS-110 --- .../rostests/kmtests/ntos_mm/ZwMapViewOfSection.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/modules/rostests/kmtests/ntos_mm/ZwMapViewOfSection.c b/modules/rostests/kmtests/ntos_mm/ZwMapViewOfSection.c index b6e6146536..aa8e145954 100644 --- a/modules/rostests/kmtests/ntos_mm/ZwMapViewOfSection.c +++ b/modules/rostests/kmtests/ntos_mm/ZwMapViewOfSection.c @@ -433,8 +433,6 @@ BehaviorChecks(HANDLE FileHandleReadOnly, HANDLE FileHandleWriteOnly) ZwUnmapViewOfSection(NtCurrentProcess(), BaseAddress); } -/* FIXME: Crash. See ROSTESTS-110 */ -#ifdef ROSTESTS_110_FIXED //try to access forbidden memory BaseAddress = NULL; ViewSize = 0; @@ -448,7 +446,24 @@ BehaviorChecks(HANDLE FileHandleReadOnly, HANDLE FileHandleWriteOnly) ZwUnmapViewOfSection(NtCurrentProcess(), BaseAddress); } -#endif /* ROSTESTS_110_FIXED */ + + //try to access guarded memory + BaseAddress = NULL; + ViewSize = 0; + SectionOffset.QuadPart = 0; + Status = ZwMapViewOfSection(WriteSectionHandle, NtCurrentProcess(), &BaseAddress, 0, 0, &SectionOffset, &ViewSize, ViewUnmap, 0, PAGE_GUARD | PAGE_READWRITE); + if (!skip(NT_SUCCESS(Status), "Error mapping view with PAGE_NOACCESS priv. Error = %p\n", Status)) + { + KmtStartSeh() + RtlCompareMemory(BaseAddress, TestString, TestStringSize); + KmtEndSeh(STATUS_GUARD_PAGE_VIOLATION); + + KmtStartSeh() + RtlCompareMemory(BaseAddress, TestString, TestStringSize); + KmtEndSeh(STATUS_SUCCESS); + + ZwUnmapViewOfSection(NtCurrentProcess(), BaseAddress); + } ZwClose(WriteSectionHandle);