4 ms·
Turns out (1) works: #include <stdio.h> #include <stdlib.h> static void begin() __attribute__((constructor)); void begin() { unsetenv("LD_PRELOAD
by shaded-enmity 4y ago
Turns out (1) works:
#include <stdio.h>
#include <stdlib.h>
static void begin() __attribute__((constructor));
void begin() {
unsetenv("LD_PRELOAD");
}
Build with:
gcc -shared -fpie -o library.so library.c
Test:
LD_PRELOAD=~/library.so env | grep LD_PRELOAD
- rurban 4y agoUsually guarded with an #ifndef DEBUG. Disallow LD_PRELOAD in Release builds