pkgsrc-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: pkg/57445: firefox crashes on startup

The following reply was made to PR pkg/57445; it has been noted by GNATS.

From: Taylor R Campbell <>
To: Martin Husemann <>
Subject: Re: pkg/57445: firefox crashes on startup
Date: Thu, 1 Jun 2023 12:46:25 +0000

 Here's a reproducer.  I think I got everything relevant here, but the
 excerpts I asked martin for don't tell me the exact order or arguments
 of dlopens that firefox issues, so I guessed.
 So, I think the massive kludge of `just define the symbol in multiple
 libraries without extern' probably never actually worked, but maybe
 did paper over the symptoms in the past.
 $ head -40 glapi.c GL.c swrast_dri.c firefox.c
 =3D=3D> glapi.c <=3D=3D
 __thread int _glapi_tls_Context __attribute__((tls_model("initial-exec"))) =
 =3D 0;
 int *glapi_context(void);
 int *
 	return &_glapi_tls_Context;
 =3D=3D> GL.c <=3D=3D
 __thread int _glapi_tls_Context __attribute__((tls_model("initial-exec"))) =
 =3D 0;
 int *GL_context(void);
 int *
 	return &_glapi_tls_Context;
 =3D=3D> swrast_dri.c <=3D=3D
 extern __thread int _glapi_tls_Context __attribute__((tls_model("initial-ex=
 int *dri_context(void);
 int *
 	return &_glapi_tls_Context;
 =3D=3D> firefox.c <=3D=3D
 #include <dlfcn.h>
 #include <err.h>
 #include <stdio.h>
 int *GL_context(void);
 int *glapi_context(void);
 int *dri_context(void);
 #define	DL(x)	do							      \
 {									      \
 	if ((x) =3D=3D NULL)						      \
 		errx(1, "%s: %s", #x, dlerror());			      \
 } while (0)
 	void *GL =3D NULL;
 	void *dri =3D NULL;
 	int *(*GL_context)(void);
 	int *(*GL_glapi_context)(void);
 	int *(*dri_context)(void);
 	int *(*dri_glapi_context)(void);
 	DL(GL =3D dlopen("./", 0));
 	DL(dri =3D dlopen("./", 0));
 	DL(GL_context =3D dlsym(GL, "GL_context"));
 	DL(GL_glapi_context =3D dlsym(GL, "glapi_context"));
 	DL(dri_context =3D dlsym(dri, "dri_context"));
 	DL(dri_glapi_context =3D dlsym(dri, "glapi_context"));
 	printf("GL %p\n", GL_context());
 	printf("GL glapi %p\n", GL_glapi_context());
 	printf("dri %p\n", dri_context());
 	printf("dri glapi %p\n", dri_glapi_context());
 	return ferror(stdout);
 $ make
 cc -fPIC   -c firefox.c
 cc -o firefox firefox.o -L. -Wl,-R$(pwd)
 cc -fPIC   -c GL.c
 cc -fPIC   -c glapi.c
 cc -o -shared glapi.o -L. -Wl,-R$(pwd)
 cc -o -shared GL.o -L. -Wl,-R$(pwd) -lglapi
 cc -fPIC   -c swrast_dri.c
 cc -o -shared swrast_dri.o -L. -Wl,-R$(pwd) -lglapi
 $ ./firefox
 GL 0x794c549be044
 GL glapi 0x794c549be044
 dri 0x794c549bf850
 dri glapi 0x794c549be044
 $ LD_PRELOAD=3D$(pwd)/ ./firefox
 GL 0x74f852ef885c
 GL glapi 0x74f852ef885c
 dri 0x74f852ef885c
 dri glapi 0x74f852ef885c

Home | Main Index | Thread Index | Old Index