criu/test/zdtm
Adrian Reber da5b7bf829 zdtm: unregister rseq before zeroing the rseq area
Starting with Linux 7.1, the kernel enforces strict read-only field
protection for the rseq V2 ABI. Userspace is no longer allowed to
modify kernel-managed fields (cpu_id_start, cpu_id, node_id, mm_cid)
while rseq is registered. Violations are detected on the next context
switch and the offending process is killed with SIGSEGV.

The rseq01 test was zeroing the entire glibc-registered rseq area
with memset() before calling test_init(), which internally calls
fork(). This corrupted the read-only fields while the glibc rseq
registration was still active, causing the kernel to send SIGSEGV
during the fork.

Fix this by calling unregister_old_rseq() before the memset in both
main() and thread_routine(), so the kernel is no longer monitoring
those fields when they are zeroed. The subsequent register_thread()
call re-registers rseq with the clean area.

Link: 7f00232152

Assisted-by: Claude Code (https://claude.ai/code):claude-opus-4-6
Signed-off-by: Adrian Reber <areber@redhat.com>
2026-05-22 11:00:24 -07:00
..
lib zdtm/bpfmap: parse frozen field with SCNu32 2026-04-16 10:41:44 -07:00
static zdtm: check reservation mmaps are restored correctly 2026-05-07 11:45:34 -07:00
transition zdtm: unregister rseq before zeroing the rseq area 2026-05-22 11:00:24 -07:00
.gitignore test/zdtm: unify common code 2017-04-02 18:12:10 +03:00
__init__.py zdtm: add --criu-config option 2022-04-28 17:53:52 -07:00
criu_config.py zdtm: Distinguish between fail and crash of dump 2024-09-11 16:02:11 -07:00
Makefile test/zdtm/Makefile: simplify 2017-04-02 18:12:10 +03:00
Makefile.inc zdtm: gcs: add opt-in GCS test support for AArch64 2025-12-07 19:20:00 +01:00