Unverified Commit 44cfe94e authored by 残页's avatar 残页 Committed by GitHub

Always cleanup init LD_PRELOAD hooks

Fix #6296
parent f9e82c9e
...@@ -3,11 +3,14 @@ ...@@ -3,11 +3,14 @@
#include <unistd.h> #include <unistd.h>
#include <dlfcn.h> #include <dlfcn.h>
int security_load_policy(void *data, size_t len) { __attribute__((constructor))
static void preload_init() {
// Make sure our next exec won't get bugged // Make sure our next exec won't get bugged
unsetenv("LD_PRELOAD"); unsetenv("LD_PRELOAD");
unlink("/dev/preload.so"); unlink("/dev/preload.so");
}
int security_load_policy(void *data, size_t len) {
int (*load_policy)(void *, size_t) = dlsym(RTLD_NEXT, "security_load_policy"); int (*load_policy)(void *, size_t) = dlsym(RTLD_NEXT, "security_load_policy");
// Skip checking errors, because if we cannot find the symbol, there // Skip checking errors, because if we cannot find the symbol, there
// isn't much we can do other than crashing anyways. // isn't much we can do other than crashing anyways.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment