Skip to content

Automatic ASLR disablement#66

Open
LebedevRI wants to merge 1 commit into
criterion-rs:masterfrom
LebedevRI:aslr
Open

Automatic ASLR disablement#66
LebedevRI wants to merge 1 commit into
criterion-rs:masterfrom
LebedevRI:aslr

Conversation

@LebedevRI

Copy link
Copy Markdown

While ASLR is a useful security hardening feature, it introduces unreproducible noise into benchmarks, and we really really really don't want any noise,
especially easily avoidable one.

Unless prevented by some other security hardening, we can disable ASLR for the current process,
and restart it, thus eliminating this noise.

This implementation matches the implementation
that has been contributed by me to google benchmark, it is battle-tested and is known to be correct.

X-Ref: google/benchmark#1978
X-Ref: google/benchmark#461

@LebedevRI LebedevRI mentioned this pull request Mar 6, 2026
@LebedevRI LebedevRI force-pushed the aslr branch 2 times, most recently from a971625 to 2b95212 Compare March 8, 2026 01:20
@LebedevRI LebedevRI changed the title [WIP] Automatic ASLR disablement Automatic ASLR disablement Mar 8, 2026
While ASLR is a useful security hardening feature,
it introduces unreproducible noise into benchmarks,
and we really really really don't want any noise,
especially easily avoidable one.

Unless prevented by some other security hardening,
we can disable ASLR for the current process,
and restart it, thus eliminating this noise.

This implementation matches the implementation
that has been contributed by me to google benchmark,
it is battle-tested and is known to be correct.

X-Ref: google/benchmark#1978
X-Ref: google/benchmark#461
@LebedevRI LebedevRI marked this pull request as ready for review March 8, 2026 01:42
Comment thread Cargo.toml
"async_tokio",
]
default = ["rayon", "plotters", "cargo_bench_support"]
default = ["rayon", "plotters", "cargo_bench_support", "deaslr"]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Would you be okay with not making this a default feature? If the feature works well and doesn't cause problems, then we could include it as default in a future release.

Comment thread CHANGELOG.md
Comment on lines +12 to +19
### Added

- Add support for automatic disablement of ASLR security hardening feature
for the benchmark process, thus eliminating some execution-to-execution
performance variance.
This is as an optional feature, labelled `deaslr`.
Requires `nix` crate.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This needs to be under "unreleased".

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