Skip to content

gh-158868: Reduce ASLR in the MSan CI job - #158872

Merged
vstinner merged 1 commit into
python:mainfrom
StanFromIreland:msan-aslr
Oct 5, 2026
Merged

vstinner merged 1 commit into
python:mainfrom
StanFromIreland:msan-aslr

Conversation

@StanFromIreland

Copy link
Copy Markdown
Member

This fixes the bug reported in #158868, rather than skipping the job.

To reproduce this locally:

$ sudo sysctl vm.mmap_rnd_bits
vm.mmap_rnd_bits = 28
$ for i in $(seq 300); do
  MSAN_OPTIONS=verbosity=1 ./python -m test test_os.test_posix -m test_fexecve 2>&1 \
    | grep -E 'execve failed|incompatible' && { echo "failed on run $i"; break; }
done
$ sudo sysctl -w vm.mmap_rnd_bits=32
vm.mmap_rnd_bits = 32
$ for i in $(seq 300); do   MSAN_OPTIONS=verbosity=1 ./python -m test test_os.test_posix -m test_fexecve 2>&1     | grep -E 'execve failed|incompatible' && { echo "$i"; break; }; done
==35706==WARNING: MemorySanitizer: memory layout is incompatible, possibly due to high-entropy ASLR.
execve failed, errno 2
4

We actually already do this for the TSan job, it seems we got unlucky on the PR that added MSan:

sudo sysctl -w vm.mmap_rnd_bits=28 # Reduce ASLR to avoid TSan crashing

In the test, the mappings of the exec'd child sometimes land where MSan needs its shadow memory, so the MSan runtime disables ASLR and re-executes the process at startup, which fails because the child was started from a close-on-exec file descriptor.

@vstinner vstinner 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. It seems correct to reuse the same configuration than then TSan job.

@vstinner
vstinner enabled auto-merge (squash) October 5, 2026 19:08
@vstinner
vstinner disabled auto-merge October 5, 2026 19:09
@vstinner
vstinner merged commit dc0add3 into python:main Oct 5, 2026
59 checks passed
@StanFromIreland
StanFromIreland deleted the msan-aslr branch October 5, 2026 19:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants