comparison Core/SharedLibrary.cpp @ 3788:626d5f4a5afb

disable RTLD_DEEPBIND if loading plugins
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 20 Mar 2020 12:37:41 +0100
parents b7087f928050
children
comparison
equal deleted inserted replaced
3784:7f4a75093a6a 3788:626d5f4a5afb
60 LOG(ERROR) << "LoadLibrary(" << path_ << ") failed: Error " << ::GetLastError(); 60 LOG(ERROR) << "LoadLibrary(" << path_ << ") failed: Error " << ::GetLastError();
61 throw OrthancException(ErrorCode_SharedLibrary); 61 throw OrthancException(ErrorCode_SharedLibrary);
62 } 62 }
63 63
64 #elif defined(__linux__) || (defined(__APPLE__) && defined(__MACH__)) || defined(__FreeBSD_kernel__) || defined(__FreeBSD__) || defined(__OpenBSD__) 64 #elif defined(__linux__) || (defined(__APPLE__) && defined(__MACH__)) || defined(__FreeBSD_kernel__) || defined(__FreeBSD__) || defined(__OpenBSD__)
65 65
66 /** 66 /**
67 * "RTLD_LOCAL" is the default, and is only present to be 67 * "RTLD_LOCAL" is the default, and is only present to be
68 * explicit. "RTLD_DEEPBIND" was added in Orthanc 1.6.0, in order 68 * explicit. "RTLD_DEEPBIND" was added in Orthanc 1.6.0, in order
69 * to avoid crashes while loading plugins from the LSB binaries of 69 * to avoid crashes while loading plugins from the LSB binaries of
70 * the Orthanc core. 70 * the Orthanc core.
71 *
72 * BUT this had no effect, and this results in a crash if loading
73 * the Python 2.7 plugin => We disabled it again in Orthanc 1.6.1.
71 **/ 74 **/
72 #if defined(RTLD_DEEPBIND) // This is a GNU extension 75
76 #if 0 // && defined(RTLD_DEEPBIND) // This is a GNU extension
77 // Disabled in Orthanc 1.6.1
73 handle_ = ::dlopen(path_.c_str(), RTLD_NOW | RTLD_LOCAL | RTLD_DEEPBIND); 78 handle_ = ::dlopen(path_.c_str(), RTLD_NOW | RTLD_LOCAL | RTLD_DEEPBIND);
74 #else 79 #else
75 handle_ = ::dlopen(path_.c_str(), RTLD_NOW | RTLD_LOCAL); 80 handle_ = ::dlopen(path_.c_str(), RTLD_NOW | RTLD_LOCAL);
76 #endif 81 #endif
77 82