Skip to content

Conversation

@chfast
Copy link
Contributor

@chfast chfast commented May 16, 2025

In some docker configurations the personality() function may return inconsistent results. Double check if the persona has been updated before reentering, otherwise we risk infinite loop.

Fixes #1984.

src/benchmark.cc Outdated
// otherwise we will try to reenter infinitely.
// This seems impossible, but can happen in some docker configurations.
const auto new_personality = personality(0xffffffff);
if (internal::get_as_unsigned(new_personality) != proposed_personality)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Hm, i would think we should just check that ADDR_NO_RANDOMIZE flag is now set.
Mainly, i don't think it is guaranteed that setting one flag wouldn't set/unset something else.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed.

@chfast chfast force-pushed the fix_adlr_docker branch from 32a609b to 2fa8742 Compare May 16, 2025 19:00
src/benchmark.cc Outdated
// Have we failed to change the personality? That may happen.
if (prev_personality == -1) return;

// Make sure the parsona has been updated with the no-ADLR flag,
Copy link
Collaborator

Choose a reason for hiding this comment

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

s/ADLR/ASLR/

In some docker configurations the `personality()` function may return
inconsistent results. Double check if the persona has been updated
before reentering, otherwise we risk infinite loop.

Fixes google#1984.
@chfast chfast force-pushed the fix_adlr_docker branch from 2fa8742 to e93b6a7 Compare May 16, 2025 19:02
Copy link
Collaborator

@LebedevRI LebedevRI left a comment

Choose a reason for hiding this comment

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

LGTM, thank you!

@LebedevRI LebedevRI merged commit 4995099 into google:main May 16, 2025
83 of 84 checks passed
@dmah42
Copy link
Member

dmah42 commented May 19, 2025

nice catch

@chfast chfast deleted the fix_adlr_docker branch May 19, 2025 10:38
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() causes infinite loop

3 participants