[llvm-bugs] [Bug 44500] New: CFI broken with dlsym()

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Jan 9 08:05:16 PST 2020


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: unassignedbugs at nondot.org
          Reporter: henrik at gramner.com
                CC: htmldeveloper at gmail.com, llvm-bugs at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200109/3e931f7e/attachment-0001.html>


More information about the llvm-bugs mailing list