Commit 621fd0ee authored by topjohnwu's avatar topjohnwu

Fix SEGV_ACCERR on some 64 bit devices

parent 6ca8db2f
...@@ -86,12 +86,12 @@ void dload_selinux() { ...@@ -86,12 +86,12 @@ void dload_selinux() {
void *handle = dlopen("libselinux.so", RTLD_LAZY); void *handle = dlopen("libselinux.so", RTLD_LAZY);
if (handle == nullptr) if (handle == nullptr)
return; return;
*(void **) &freecon = dlsym(handle, "freecon"); /* We only use dlopen to know whether libselinux.so exists.
*(void **) &setcon = dlsym(handle, "setcon"); * For some reason calling symbols returned from dlsym
*(void **) &getfilecon = dlsym(handle, "getfilecon"); * will result to SEGV_ACCERR on some devices.
*(void **) &lgetfilecon = dlsym(handle, "lgetfilecon"); * Always use builtin implementations for SELinux stuffs. */
*(void **) &setfilecon = dlsym(handle, "setfilecon"); dlclose(handle);
*(void **) &lsetfilecon = dlsym(handle, "lsetfilecon"); selinux_builtin_impl();
} }
static void restore_syscon(int dirfd) { static void restore_syscon(int dirfd) {
......
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