[Webkit-unassigned] [Bug 254286] New: usage of initial-exec prevents dlopen of the libwebkit shared object outside of GLIBC on linux

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Mar 22 14:13:37 PDT 2023


https://bugs.webkit.org/show_bug.cgi?id=254286

            Bug ID: 254286
           Summary: usage of initial-exec prevents dlopen of the libwebkit
                    shared object outside of GLIBC on linux
           Product: WebKit
           Version: Other
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: WebKitGTK
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: alice at ayaya.dev
                CC: bugs-noreply at webkitgtk.org

Created attachment 465547

  --> https://bugs.webkit.org/attachment.cgi?id=465547&action=review

a fix for this issue

usage of initial-exec prevents valid dlopen of the library later. this works on glibc, because glibc reserves some memory for initial-exec variables in dlopen'd objects.

on other libcs, this doesn't work. for instance:

$ cat main.c 
#include <dlfcn.h>
#include <stdio.h>

int main() {
  void *h = dlopen("libwebkit2gtk-4.0.so.37", 0);

  if(!h) {
    fprintf(stderr, "%s\n", dlerror());
    return 1;
  }

  return 0;
}
$ gcc main.c 
$ ./a.out 
Error relocating /usr/lib/libwebkit2gtk-4.0.so.37: lroundf: initial-exec TLS resolves to dynamic definition in /usr/lib/libwebkit2gtk-4.0.so.37
$ ldd --version
musl libc (x86_64)
Version 1.2.3
Dynamic Program Loader
Usage: /lib/ld-musl-x86_64.so.1 [options] [--] pathname

utilising initial-exec only when __GLIBC__ is defined fixes this.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20230322/16aa8ffb/attachment.htm>


More information about the webkit-unassigned mailing list