Replace public library list with shared lib sonames (part 2/2)

This commit updates interface of libdl.c.

1. android_init_namespaces is replaces with android_init_anonymous_namespace
2. added 2 arguments to android_create_namespace to specify linked namespace
   and the list of shared libraries sonames.
3. symbol lookup does not get past boundary libraries (added check and test for it).

Bug: http://b/26833548
Bug: http://b/21879602
Test: bionic-unit-tests --gtest_filter=dl*:Dl*
Change-Id: I32921da487a02e5bd0d2fc528904d1228394bfb9
diff --git a/tests/libs/Android.build.linker_namespaces.mk b/tests/libs/Android.build.linker_namespaces.mk
index df6428c..cd9d7f1 100644
--- a/tests/libs/Android.build.linker_namespaces.mk
+++ b/tests/libs/Android.build.linker_namespaces.mk
@@ -25,10 +25,13 @@
 # 2. Check that public libraries loaded in different namespaces are shared
 #    between them.
 # 3. Check that namespace sticks on dlopen
+# 4. Check that having access to shared library (libnstest_public.so)
+#    does not expose symbols from dependent library (libnstest_public_internal.so)
 #
 # Dependency tree (visibility)
 # libnstest_root.so (this should be local to the namespace)
 # +-> libnstest_public.so
+#     +-> libnstest_public_internal.so
 # +-> libnstest_private.so
 #
 # libnstest_dlopened.so (library in private namespace dlopened from libnstest_root.so)
@@ -39,7 +42,13 @@
 module := libnstest_root
 include $(LOCAL_PATH)/Android.build.testlib.target.mk
 
+libnstest_public_internal_src_files := namespaces_public_internal.cpp
+module := libnstest_public_internal
+libnstest_public_internal_relative_install_path := public_namespace_libs
+include $(LOCAL_PATH)/Android.build.testlib.target.mk
+
 libnstest_public_src_files := namespaces_public.cpp
+libnstest_public_shared_libraries := libnstest_public_internal
 module := libnstest_public
 libnstest_public_relative_install_path := public_namespace_libs
 include $(LOCAL_PATH)/Android.build.testlib.target.mk