Skip to content

Windows: fix and re-enable 2 tests - #52

Merged
slipher merged 4 commits into
masterfrom
slipher/win-tests
Aug 2, 2026
Merged

Windows: fix and re-enable 2 tests#52
slipher merged 4 commits into
masterfrom
slipher/win-tests

Conversation

@slipher

@slipher slipher commented Jul 28, 2026

Copy link
Copy Markdown
Member

Fix and enable run_patch_ntdll_test and run_debug_stub_test. Also update the crash handler to use the new __fastfail method of instantly exiting the process introduced in Windows 8.

slipher added 4 commits July 27, 2026 22:11
It needed a Python 3 migration to signed process exit code.
For some reason functions in the printf family were crashing when called
from the crash handler in run_patch_ntdll_test. Avoid this by switching
them to (f)puts instead of (f)printf, and re-enable the test. Also
modify the handler to do an infinite loop (thus timing out the test) if
unexpected extra crashes happen.
Use int 0x29 aka __fastfail (introduced in Windows 8) to implement
NaCl_exception_dispatcher_exit_fast.
Fixes run_patch_ntdll_test on MinGW.

MinGW GCC 16 decided to be clever and optimize out `*(int*)0 = 0`.
It does this even if I add `volatile`. So change the target address to
4 instead of 0 so the special null pointer optimization can't be
applied. Also do this for the other 14 places where a hard-coded null
pointer is dereferenced.

@illwieckz illwieckz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@slipher
slipher merged commit 17c36c2 into master Aug 2, 2026
@slipher
slipher deleted the slipher/win-tests branch August 2, 2026 04:03
@slipher

slipher commented Aug 2, 2026

Copy link
Copy Markdown
Member Author

Now there is a new warning on Linux due to Robustly dereference the null page!. So on MinGW GCC apparently it won't actually crash if the address is 0, but with Linux GCC it complains if the address is 4 instead of 0.

src/trusted/service_runtime/linux/nacl_bootstrap.c:159:13: error: array subscript 0 is outside array bounds of ‘volatile int[0]’ [-Werror=array-bounds=]
  159 |   while (1) *(volatile int *) 4 = 0;  /* Crash.  */

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants