+47
−8
+21
−0
src/test/e2e/thread_guard_page_test.cpp
0 → 100644
+49
−0
+11
−0
Loading
Thread stacks were a plain mmap: running off one overwrote whatever lay
below, and Rust's std (which expects glibc's guard pages on *-linux-gnu)
panicked "there is no guard page" in every spawned thread. The mapping
now has a PROT_NONE guard (one page by default, pthread_attr_setguardsize
rounds up to pages) below the unchanged usable stack; a stack the caller
provides has none (POSIX). pthread_attr_getguardsize reports it, and
pthread_getattr_np reports the thread's real guard (the main thread: the
kernel's guard gap, one page).
e2e: getattr_np on a worker reports the guard, a worker's stack overflow
ends in SIGSEGV; clock_nanosleep's guardsize checks follow. 171/171.
With this a Rust program built by rustc on FenrirOS runs threads, and a
panic caught with catch_unwind unwinds through systempp's _Unwind_* ABI.
Co-Authored-By:
Claude Opus 5.5 <noreply@anthropic.com>