https://bugs.llvm.org/show_bug.cgi?id=44500

            Bug ID: 44500
           Summary: CFI broken with dlsym()
           Product: new-bugs
           Version: 9.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedb...@nondot.org
          Reporter: hen...@gramner.com
                CC: htmldevelo...@gmail.com, llvm-bugs@lists.llvm.org

CFI always considers indirect calls to function pointers returned by dlsym() to
have the wrong function signature, even though they're correct, resulting in
SIGILL.

Minimal code sample (compiled with -flto -fvisibility=hidden -fsanitize=cfi
-ldl):

#define _GNU_SOURCE
#include <dlfcn.h>

int main(int arc, char *argv[]) {
    int (*p)(const char*) = dlsym(RTLD_DEFAULT, "puts");
    if (p) p("hello!");
    return 0;
}

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to