]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MEDIUM: tools: avoid calling dlsym() in static builds
authorWilly Tarreau <w@1wt.eu>
Sat, 16 Jul 2022 11:49:34 +0000 (13:49 +0200)
committerWilly Tarreau <w@1wt.eu>
Sat, 16 Jul 2022 11:49:34 +0000 (13:49 +0200)
commit288dc1d8eeb3340068792698e98960c59faa6c99
treea17a520735d962381158f4817c48f6e1a0f93a70
parent856d56d2d2bfe7f5eae0927d43e2cdb306b36279
BUG/MEDIUM: tools: avoid calling dlsym() in static builds

Since 2.4 with commit 64192392c ("MINOR: tools: add functions to retrieve
the address of a symbol"), we can resolve symbols. However some old glibc
crash in dlsym() when the program is statically built.

Fortunately even on these old libs we can detect lack of support by
calling dlopen(NULL). Normally it returns a handle to the current
program, but on a static build it returns NULL. This is sufficient to
refrain from calling dlsym() (which will be of very limited use anyway),
so we check this once at boot and use the result when needed.

This may be backported to 2.4. On stable versions, be careful to place
the init code inside an if/endif guard that checks for DL support.
src/tools.c