Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(282)

Unified Diff: base/native_library_posix.cc

Issue 2277863002: Enable loading native libraries with RTLD_DEEPBIND (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: base/native_library_posix.cc
diff --git a/base/native_library_posix.cc b/base/native_library_posix.cc
index 2dc434b7be25af2395a80b313defa3e8be08616f..00bd7238b57724fd85e905a7f53019a831505f5b 100644
--- a/base/native_library_posix.cc
+++ b/base/native_library_posix.cc
@@ -19,16 +19,22 @@ std::string NativeLibraryLoadError::ToString() const {
}
// static
-NativeLibrary LoadNativeLibrary(const FilePath& library_path,
- NativeLibraryLoadError* error) {
+NativeLibrary LoadNativeLibraryWithOptions(const FilePath& library_path,
+ const NativeLibraryOptions& options,
+ NativeLibraryLoadError* error) {
// dlopen() opens the file off disk.
ThreadRestrictions::AssertIOAllowed();
- // We deliberately do not use RTLD_DEEPBIND. For the history why, please
- // refer to the bug tracker. Some useful bug reports to read include:
+ // We deliberately do not use RTLD_DEEPBIND by default. For the history why,
+ // please refer to the bug tracker. Some useful bug reports to read include:
// http://crbug.com/17943, http://crbug.com/17557, http://crbug.com/36892,
// and http://crbug.com/40794.
- void* dl = dlopen(library_path.value().c_str(), RTLD_LAZY);
+ int flags = RTLD_LAZY;
+#if !defined(OS_ANDROID)
+ if (options.prefer_own_symbols)
+ flags |= RTLD_DEEPBIND;
Primiano Tucci (use gerrit) 2016/08/24 22:14:09 are you sue you don't need also RTLD_GLOBAL? Can
Ken Rockot(use gerrit already) 2016/08/24 23:23:57 We may want this behavior but it might be worth ke
+#endif
+ void* dl = dlopen(library_path.value().c_str(), flags);
if (!dl && error)
error->message = dlerror();

Powered by Google App Engine
This is Rietveld 408576698