-
Notifications
You must be signed in to change notification settings - Fork 12.2k
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
[clang] Reporting unused function with ifunc resolver #63957
Comments
This reproduces on trunk. |
…and ifunc support Clang incorrectly warns functions only used through ifuncs are unused, llvm/llvm-project#63957.
Should this really be changed taking into account the ifunc-based xz backdoor added by the issue reporter? https://www.openwall.com/lists/oss-security/2024/03/29/4 |
We should not make this change in LLVM right now. |
tukaani-project/xz@82ecc53 is a legitimate change that exposes two problems:
We should be careful and don't consider all xz commits malicious. |
I disagree, we need to be extra careful with changes associated with the xz project right now. There's no reason why we need to get this change committed quickly. It should get extra scrutiny. |
I concur with this sentiment, the details are still emerging on this whole incident. This so far seems like the best timeline: https://boehs.org/node/everything-i-know-about-the-xz-backdoor and a lot if still unknown. I don't feel confident in saying I have the whole picture and I think until we get a better idea of the scope we should be taking our time. |
Did GitHub just restored their access? I thought the account was suspended. |
Rather offtopic but
No (check https://github.com/Larhzu?tab=following), Larhzu is also still suspended. (https://github.com/JiaT75?tab=following) |
I'm going to lock this for now but we can unlock it later when things have quietened down. |
https://reviews.llvm.org/D54188 marked "alias" targets as used in C to fix -Wunused false positives. This patch extends the approach to handle mangled names to support global scope names in C++ and the `overloadable` attribute in C. In addition, we mark ifunc targets as used to fix #63957. While our approach has false negatives for namespace scope names, the majority of alias/ifunc C++ uses (global scope with no overloads) are handled. Note: The following function with internal linkage but C language linkage type is mangled in Clang but not in GCC. This inconsistency makes alias/ifunc difficult to use in C++ with portability (#88593). ``` extern "C" { static void f0() {} // GCC: void g0() __attribute__((alias("_ZL2f0v"))); // Clang: void g0() __attribute__((alias("f0"))); } ``` Pull Request: #87130
https://reviews.llvm.org/D54188 marked "alias" targets as used in C to fix -Wunused false positives. This patch extends the approach to handle mangled names to support global scope names in C++ and the `overloadable` attribute in C. (Note: we should skip `UsingShadowDecl`, which would trigger an assertion failure in `ItaniumMangleContextImpl::mangleCXXName`. See regression test added by commit 1c2afba.) In addition, we mark ifunc targets as used to fix #63957 (temporarily used by xz; ifunc was removed by tukaani-project/xz@689ae24) While our approach has false negatives for namespace scope names, the majority of alias/ifunc C++ uses (global scope with no overloads) are handled. Note: The following function with internal linkage but C language linkage type is mangled in Clang but not in GCC. This inconsistency makes alias/ifunc difficult to use in C++ with portability (#88593). ``` extern "C" { static void f0() {} // GCC: void g0() __attribute__((alias("_ZL2f0v"))); // Clang: void g0() __attribute__((alias("f0"))); } ``` Pull Request: #87130
Hello!
Clang 16.0.0 and older report a warning when compiling a program that uses
__attribute__((__ifunc__()))
with-Wunused-function
. The resolver function appears to trigger this when it is only referenced by the__attribute__
. Here is an example program that should trigger the warning:GCC does not issue a warning for the above program. Here is a godbolt.org snippet of the above code to allow you to easily test it. Let me know if you need anymore information.
The text was updated successfully, but these errors were encountered: