[PATCH] D103304: Update and improve compiler-rt tests for -mllvm -asan_use_after_return=(never|[runtime]|always).
Vitaly Buka via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 7 11:04:29 PDT 2021
vitalybuka added a comment.
In D103304#2800789 <https://reviews.llvm.org/D103304#2800789>, @kda wrote:
> Regarding below, I had this previously: https://reviews.llvm.org/differential/changeset/?ref=2601358
Correct, at that time I thought we are doing WEAK __asan_use_after_return_mode, for which new fictions are not needed.
Sorry, we'd save some time if I asked to drop __asan_use_after_return_mode instead.
If you are going to recover that one I'd recommencement Flagless -> Always to be consistent with naming?
> The problem I don't know how to navigate is that GetFakeStackFast is only called from one place (at runtime, the other is for testing only).
> That call is in OnMalloc. Which, in turn, is only called from one place: __asan_stack_malloc_<##class_id>
>
> How do I have the runtime code pick the Always version of GetFakeStackFast without examining the global?
> Do I inject the function ptr when generating the call to __asan_stack_malloc?
No, AddressSanitizer Always branch will call only __asan_stack_malloc_always_<##class_id> functions
Runtime branch will continue to call __asan_stack_malloc_<##class_id>
> In D103304#2800596 <https://reviews.llvm.org/D103304#2800596>, @vitalybuka wrote:
>
>> I looked at Lazy approach and it's simpler then I thought. Asan already contains all needed pieces.
>> Considering that we have not idea how to handle Windows and Darwin we should do that in this patch.
>>
>> Cloning of GetFakeStackFast -> GetFakeStackFastAlways which does not check __asan_option_detect_stack_use_after_return should be enough.
>>
>> static FakeStack *GetFakeStackFast() {
>> if (FakeStack *fs = GetTLSFakeStack())
>> return fs;
>> if (!__asan_option_detect_stack_use_after_return)
>> return nullptr;
>> return GetFakeStack();
>> }
>>
>>
>> static FakeStack *GetFakeStackFastAlways() {
>> if (FakeStack *fs = GetTLSFakeStack())
>> return fs;
>> return GetFakeStack();
>> }
>>
>> And same for all callers.
>> Anything __asan_detect_use_after_return_always related can be reverted.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D103304/new/
https://reviews.llvm.org/D103304
More information about the llvm-commits
mailing list