Skip to content

Fix MaybeReenterWithoutASLR() in docker#1985

Merged
LebedevRI merged 1 commit into
google:mainfrom
chfast:fix_adlr_docker
May 16, 2025
Merged

Fix MaybeReenterWithoutASLR() in docker#1985
LebedevRI merged 1 commit into
google:mainfrom
chfast:fix_adlr_docker

Conversation

@chfast

@chfast chfast commented May 16, 2025

Copy link
Copy Markdown
Contributor

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.

Comment thread 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
Copy Markdown
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
Copy Markdown
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
Comment thread 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
Copy Markdown
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

@LebedevRI LebedevRI left a comment

Copy link
Copy Markdown
Collaborator

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

dmah42 commented May 19, 2025

Copy link
Copy Markdown
Member

nice catch

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