Skip to content

[Cherry-pick into stable/20230725][Sanitizers][Darwin] Pass offset to __asan_set_shadow_xx (#71745) #7785

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 15, 2023

Conversation

wrotki
Copy link

@wrotki wrotki commented Nov 14, 2023

Normally, when __asan_option_detect_stack_use_after_return option is set,
the instrumentation passed the adress of the shadow memory bytes to be set, for detecting problems with local variables.
This can be a problem when the -fsanitize-stable-abi option is in effect,
since the ABI implementation doesn't have means to communicate the current shadow memory base address
back to its users.

This change addresses it simply by setting
__asan_shadow_memory_dynamic_address to zero. It means that __asan_set_shadow_xx will be now called with the offset relative to the current shadow memory
base, and the ABI implementation needs to adapt accordingly.

The other change here is to set
__asan_option_detect_stack_use_after_return to nonzer by default, which is needed for instrumentation to take paths using the __asan_shadow_memory_dynamic_address
and __asan_set_shadow_xx calls.

Co-authored-by: Mariusz Borsa [email protected]
(cherry picked from commit c2205ab)

Normally, when __asan_option_detect_stack_use_after_return option is
set,
the instrumentation passed the adress of the shadow memory bytes to be
set, for detecting problems with local variables.
This can be a problem when the -fsanitize-stable-abi option is in
effect,
since the ABI implementation doesn't have means to communicate the
current shadow memory base address
back to its users.

This change addresses it simply by setting
__asan_shadow_memory_dynamic_address to zero. It means
that __asan_set_shadow_xx will be now called with the offset relative to
the current shadow memory
base, and the ABI implementation needs to adapt accordingly.

The other change here is to set
__asan_option_detect_stack_use_after_return to nonzer by default,
which is needed for instrumentation to take paths using the
__asan_shadow_memory_dynamic_address
and __asan_set_shadow_xx calls.

Co-authored-by: Mariusz Borsa <[email protected]>
(cherry picked from commit c2205ab)
@wrotki
Copy link
Author

wrotki commented Nov 14, 2023

@swift-ci test

@wrotki
Copy link
Author

wrotki commented Nov 14, 2023

@swift-ci test windows

1 similar comment
@wrotki
Copy link
Author

wrotki commented Nov 14, 2023

@swift-ci test windows

@wrotki wrotki merged commit 0bc383a into stable/20230725 Nov 15, 2023
@wrotki wrotki deleted the m_borsa/cherry-pick-c2205ab309 branch November 15, 2023 00:32
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.

1 participant