Skip to content

Prevent repeated ASLR reexec attempts#2197

Closed
Haihan-Jiang wants to merge 1 commit into
google:mainfrom
Haihan-Jiang:codex/benchmark-aslr-reexec-sentinel
Closed

Prevent repeated ASLR reexec attempts#2197
Haihan-Jiang wants to merge 1 commit into
google:mainfrom
Haihan-Jiang:codex/benchmark-aslr-reexec-sentinel

Conversation

@Haihan-Jiang
Copy link
Copy Markdown
Contributor

What changed

  • Add an internal BENCHMARK_ASLR_REEXEC_ATTEMPTED sentinel before MaybeReenterWithoutASLR() calls execv().
  • If the benchmark process is re-entered but the no-ASLR personality was reset by a security policy, the next process sees the sentinel and skips another re-exec attempt.
  • Add a gtest covering the sentinel short-circuit path.

Why

This prevents an infinite re-exec loop when personality() appears to set ADDR_NO_RANDOMIZE in the current process, but AppArmor resets that personality across execv().

Fixes #2184.

Validation

  • git diff --check
  • bazel test //test:benchmark_gtest --cxxopt=-isystem --cxxopt=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1

Note: the explicit --cxxopt is needed on my macOS local environment because the default Command Line Tools compiler is not finding libc++ headers without the SDK include path.

@Haihan-Jiang Haihan-Jiang marked this pull request as ready for review May 24, 2026 17:46
@LebedevRI
Copy link
Copy Markdown
Collaborator

Duplicate of #2193.

@LebedevRI LebedevRI closed this May 24, 2026
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.

[BUG] MaybeReenterWithoutASLR() infinite loop under AppArmor (not covered by #1984 fix)

2 participants