965d06da1e
This change addresses multiple problems introduced by
02586a2a34
1. In the case of unsuccessful dlopen the failure guard is triggered
for two namespaces which leads to double unload.
2. In the case where load_tasks includes libraries from 3 and more
namespaces it results in incorrect linking of libraries shared between
second and third/forth and so on namespaces.
The root cause of these problems was recursive call to find_libraries.
It does not do what it is expected to do. It does not form new load_tasks
list and immediately jumps to linking local_group. Not only this skips
reference counting it also will include unlinked but accessible library
from third (and fourth and fifth) namespaces in invalid local group. The
best case scenario here is that for 3 or more namesapces this will
fail to link. The worse case scenario it will link the library
incorrectly with will lead to very hard to catch bugs.
This change removes recursive call and replaces it with explicit list of
local_groups which should be linked. It also revisits the way we do
reference counting - with this change the reference counts are updated after
after libraries are successfully loaded.
Also update soinfo_free to abort in case when linker tries to free same
soinfo for the second time - this makes linker behavior less undefined.
Test: bionic-unit-tests
Bug: http://b/69787209
Change-Id: Iea25ced181a98c6503cce6e2b832c91d697342d5
48 lines
2.2 KiB
Makefile
48 lines
2.2 KiB
Makefile
#
|
|
# Copyright (C) 2015 The Android Open Source Project
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
#
|
|
|
|
# -----------------------------------------------------------------------------
|
|
# This set of libraries are used to verify linker namespaces.
|
|
# -----------------------------------------------------------------------------
|
|
|
|
# -----------------------------------------------------------------------------
|
|
# This set of libraries is to test isolated namespaces
|
|
#
|
|
# Isolated namespaces do not allow loading of the library outside of
|
|
# the search paths.
|
|
#
|
|
# This library cannot be loaded in isolated namespace because one of DT_NEEDED
|
|
# libraries is outside of the search paths.
|
|
#
|
|
# libnstest_root_not_isolated.so (DT_RUNPATH = $ORIGIN/../private_namespace_libs_external/)
|
|
# +-> libnstest_public.so
|
|
# +-> libnstest_private_external.so (located in $ORIGIN/../private_namespace_libs_external/)
|
|
#
|
|
# Search path: $NATIVE_TESTS/private_namespace_libs/
|
|
# -----------------------------------------------------------------------------
|
|
libnstest_root_not_isolated_src_files := namespaces_root.cpp
|
|
libnstest_root_not_isolated_shared_libraries := libnstest_public libnstest_private_external
|
|
libnstest_root_not_isolated_relative_install_path := private_namespace_libs
|
|
libnstest_root_not_isolated_ldflags := -Wl,--rpath,\$$ORIGIN/../private_namespace_libs_external \
|
|
-Wl,--enable-new-dtags
|
|
|
|
module := libnstest_root_not_isolated
|
|
include $(LOCAL_PATH)/Android.build.testlib.target.mk
|
|
|
|
libnstest_private_external_src_files := namespaces_private.cpp
|
|
libnstest_private_external_relative_install_path := private_namespace_libs_external
|
|
module := libnstest_private_external
|
|
include $(LOCAL_PATH)/Android.build.testlib.target.mk
|