Commit Graph

577 Commits

Author SHA1 Message Date
momo5502
6eb4ef33ff Handle invalid page protections
This fixes #420
2025-07-20 09:34:25 +02:00
momo5502
5e57360dc3 Fix buffer overflow 2025-07-18 07:15:54 +02:00
Maurice Heumann
9e5a6b509b Implement guard pages (#406)
Hey, looking for feedback on my guard page implementation. 

I wasn't sure on how to structure the additional windows specific memory
flags, since the emulation backends won't like additional guard flag. I
opted to create a new `memory_permission_ext` enum to hold the guard
flag, and a `nt_memory_permission` struct to wrap the "common" memory
permission flags, with the new extended flags. This struct implicitly
coerces to the original `memory_permission` to reduce the amount of
changes for the PR.

This however meant that I changed signatures of `map_memory` and
`apply_memory_protection` in `memory_interface` to accommodate this new
structure, and was an afterthought.

The `map_nt_to_emulator_protection` function might also need some
attention now, too. For future reference, windows uses
[MiMakeProtectionMask](https://doxygen.reactos.org/d1/d9a/marea_8c.html#adfb66408771a4df77c1056cc2a99ef21)
in ntoskrnl to map `PAGE_*` flags to [MM PTE
constants](https://reactos.org/wiki/Techwiki:Memory_management_in_the_Windows_XP_kernel).

The test added to the `test-sample` binary seems to be passing.

Fixes #21
2025-07-17 17:41:06 +02:00
3fault
f1d54f7417 Parameterize basic_memory_region to support extended memory flags 2025-07-17 11:19:56 -04:00
3fault
9f637105fb Unset extended flags in nt_memory_permission assignment operator 2025-07-17 11:06:26 -04:00
Maurice Heumann
d7a1a269b7 Setup thread before dispatching APC 2025-07-12 21:33:12 +02:00
momo5502
ac2d34c143 Small cleanup 2025-07-12 15:40:04 +02:00
momo5502
7a3a5d760e Fix thread deletion 2025-07-12 15:28:30 +02:00
momo5502
08995a4205 Print memory stats 2025-07-12 14:17:52 +02:00
momo5502
acb65dc10d Log message box arguments 2025-07-09 21:17:32 +02:00
3fault
f4fc9c4a6c fix memory_permissions_ext includes 2025-07-09 14:49:26 -04:00
3fault
19574fb512 remove references to nt_memory_permission from backend 2025-07-09 14:43:06 -04:00
3fault
8ec184d57f remove unneeded windows-emulator/memory_permission_ext.cpp 2025-07-09 14:39:49 -04:00
Maurice Heumann
a711a8faad Fix posix colors 2025-07-08 18:55:29 +02:00
3fault
6e203d9590 Fix formatting issues 2025-07-02 14:47:51 -04:00
3fault
9a6da790cf Remove #include <winnt.h> in exception_dispatch 2025-07-02 13:41:23 -04:00
3fault
68a5800c85 Add test for guard page in test-sample, formatting fix 2025-07-02 12:09:21 -04:00
3fault
2e17f37f78 Update hook_memory_violation to handle guard page violations 2025-07-01 19:17:05 -04:00
3fault
1276c7e2bc Update occurances of memory_permission to nt_memory_permission where needed 2025-07-01 19:04:22 -04:00
3fault
7d8daf7c68 Update map_nt_to_emulator_protection to support PAGE_GUARD flag 2025-07-01 18:28:54 -04:00
3fault
a8ae617e50 Add memory_permission_ext to windows-emulator 2025-07-01 18:14:02 -04:00
3fault
ceadcbc3e8 Add dispatch_guard_page_violation to exception_dispatch 2025-07-01 17:50:45 -04:00
momo5502
08ae52710b Prevent translation of relative files 2025-06-16 18:38:55 +02:00
momo5502
bda89b5d1e Add more syscalls 2025-06-15 19:48:05 +02:00
Red
a6a2636e7f Attempt format, not sure if it did anything 2025-06-15 13:02:05 +02:00
Red
9d406b91d8 Fix handle_query_internal to only write to buffer on success 2025-06-15 12:04:58 +02:00
momo5502
1421550764 Cleanup and fix NtQueryInformationProcess 2025-06-15 09:31:57 +02:00
Red
f14b16d080 Fix anti-debug detections for NtQueryInformationProcess with ProcessDebugObjectHandle 2025-06-14 15:00:53 +02:00
momo5502
43ff531354 Add NtRemoveIoCompletionEx syscall stub 2025-06-14 08:46:27 +02:00
Maurice Heumann
b76f5ab92d minidump support: dump loading and process reconstruction (#361) 2025-06-14 08:21:00 +02:00
redthing1
1e63fe381f minidump: tidy const refs 2025-06-12 15:25:37 -07:00
redthing1
afd80aa9af make minidump loader fully standalone 2025-06-12 15:13:45 -07:00
redthing1
01d2656189 minidump loader: handle zero protection 2025-06-12 15:08:07 -07:00
redthing1
f8b163f556 refactor to address comments 2025-06-12 15:04:54 -07:00
3fault
e5e5d05d05 Add temp environment variables to fix GetTempPath(2)W 2025-06-10 09:59:34 -04:00
redthing1
21a0d3c4bc fix tidy 2025-06-10 01:08:45 -07:00
redthing1
ca214a539a minidump: more clang tidy 2025-06-10 00:57:19 -07:00
redthing1
47f4589774 minidump: satisfy clang tidy 2025-06-10 00:47:01 -07:00
redthing1
3fa9fa9c15 minidump: fix uintmax_t format specifier 2025-06-10 00:35:52 -07:00
redthing1
dae4f07f70 module manager: apply clang format 2025-06-10 00:31:17 -07:00
redthing1
aa966826a2 fixup! minidump loader: fix PRIx64 format specifier 2025-06-10 00:28:43 -07:00
redthing1
12646566ca minidump loader: fix PRIx64 format specifier 2025-06-10 00:27:13 -07:00
redthing1
5d9dd122d2 minidump support: dump loading and process reconstruction 2025-06-09 23:12:45 -07:00
momo5502
906cec808a Small fixes 2025-06-07 20:10:36 +02:00
momo5502
f3b20da9cc Optimize thread scheduling and pausing 2025-06-07 14:20:19 +02:00
momo5502
05c5f0a085 Final cleanup 2025-06-07 08:01:02 +02:00
momo5502
da4a4f90c9 Cleanup exception callbacks 2025-06-07 07:54:11 +02:00
momo5502
802e295bcc Adapt more printing 2025-06-07 07:29:30 +02:00
momo5502
9372e27453 Fix module logging 2025-06-07 07:11:27 +02:00
momo5502
bc77faec3d Move more logging into callbacks 2025-06-06 20:03:53 +02:00