Merge "Fix RTLD_NEXT/DEFAULT lookup" am: e510d9c369

am: 068ea4563a

Change-Id: I2a249c2af977323fdacb28a09b076dcca8a478a6
This commit is contained in:
dimitry 2018-02-20 22:38:39 +00:00 committed by android-build-merger
commit 298b6ef913
2 changed files with 3 additions and 6 deletions

View file

@ -863,11 +863,8 @@ static const ElfW(Sym)* dlsym_linear_lookup(android_namespace_t* ns,
}
}
// If not found - use dlsym_handle_lookup for caller's
// local_group unless it is part of the global group in which
// case we already did it.
if (s == nullptr && caller != nullptr &&
(caller->get_rtld_flags() & RTLD_GLOBAL) == 0) {
// If not found - use dlsym_handle_lookup for caller's local_group
if (s == nullptr && caller != nullptr) {
soinfo* local_group_root = caller->get_local_group_root();
return dlsym_handle_lookup(local_group_root->get_primary_namespace(),

View file

@ -1123,7 +1123,7 @@ TEST(dlfcn, rtld_next_known_symbol) {
// Check that RTLD_NEXT of a libc symbol works in dlopened library
TEST(dlfcn, rtld_next_from_library) {
void* library_with_fclose = dlopen("libtest_check_rtld_next_from_library.so", RTLD_NOW);
void* library_with_fclose = dlopen("libtest_check_rtld_next_from_library.so", RTLD_NOW | RTLD_GLOBAL);
ASSERT_TRUE(library_with_fclose != nullptr) << dlerror();
void* expected_addr = dlsym(RTLD_DEFAULT, "fclose");
ASSERT_TRUE(expected_addr != nullptr) << dlerror();