================
@@ -1980,6 +1981,23 @@ static void handleWeakRefAttr(Sema &S, Decl *D, const 
ParsedAttr &AL) {
   D->addAttr(::new (S.Context) WeakRefAttr(S.Context, AL));
 }
 
+// Mark alias/ifunc target as used. For C++, we look up the demangled name
+// ignoring parameters. This should handle the majority of use cases while
+// leaveing false positives for namespace scope names and false negatives in
+// the presence of overloads.
+static void markUsedForAliasOrIfunc(Sema &S, Decl *D, const ParsedAttr &AL,
+                                    StringRef Str) {
+  char *Demangled = llvm::itaniumDemangle(Str, /*ParseParams=*/false);
----------------
erichkeane wrote:
Ah, good to know!  I think it is important that we match here, since that is 
the one we're going to 'find'.  Frankly, based on the reporter of this bug's 
transgression (PLUS his exploit directly involved ifuncs), I want us to be as 
careful with this as possible.  

The mangling should be the one we're mangling the current TU with at all costs. 
 I could imagine an invalid ifunc/alias being used to 'hide' a function that is 
otherwise not called (but I'm also not smart enough to figure out why that 
would be en exploit).

https://github.com/llvm/llvm-project/pull/87130
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to