GlobalAlias::getAliasee() may not always point directly to a
GlobalVariable. In such cases, try to find the canonical GlobalVariable
that the alias refers to.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Unit Tests
Time | Test | |
---|---|---|
60 ms | x64 windows > LLVM.CodeGen/XCore::threads.ll |
Event Timeline
Have you checked if there is already a function that does this? Frequently there is :)
Some functions that look similar based on names:
stripPointerCasts
stripPointerCastsAndOffsets
stripPointerCastsAndAliases
canonicalizeAlias
The code looks reasonable to me. I see it only affects kernel, so assuming you booted kernel, we should be fine.
I can rubber-stamp it, but if you want more meaningful review, please wait for Alex or Nick.
Added Nick.
I suppose all I'd like a 2nd confirmation on is if stripPointerCastsAndAliases() is the right thing to use here.
Nick or Alex, if you could have a brief look would be great -- thanks!
Thanks,
- Marco
Thanks for the patch.
clang/test/CodeGen/asan-globals-alias.cpp | ||
---|---|---|
30 | Do we want to add checks for the aliases: global_alias_2, __global_alias_2_alias, and __mod_joydev_ids_device_table? |
clang/test/CodeGen/asan-globals-alias.cpp | ||
---|---|---|
30 | I found that depending on optimization level, what the aliases end up aliasing varies (e.g. for the alias-of-alias at -O2 it turns it into an alias to the global_alias_2). Not sure how to best capture this in the test without it becoming flaky. I suppose we could check that the alias somehow references either what was specified directly or the final global, but I don't think that's the job of this test since it's not directly related to ASan or KASAN. Or did you mean to just check they exist? |
clang/test/CodeGen/asan-globals-alias.cpp | ||
---|---|---|
30 | Existence check. If it doesn't add anything, feel free to skip the suggestion. |
Do we want to add checks for the aliases: global_alias_2, __global_alias_2_alias, and __mod_joydev_ids_device_table?