vdso should be available in all namespaces

vdso should be available in all namespaces when present. This
bug went undetected because the way libc currently uses vdso (it
does all the lookups itself). This makes it available for the
programs that want to take advantage by dlopening it.

Bug: http://b/73105445
Bug: http://b/79561555
Test: adb shell /data/nativetest/arm/bionic-unit-tests/bionic-unit-tests --gtest_filter=dl.exec_with_ld_config_file
Test: adb shell /data/nativetest/bionic-unit-tests/bionic-unit-tests --gtest_filter=dl*
Change-Id: I8eae0c9848f256190d1c9ec85d10dc6ce383a8bc
(cherry picked from commit 69c68c46ac18a440bf1c0447d8343a6dbad595f1)
diff --git a/linker/linker.cpp b/linker/linker.cpp
index 79330fc..96f424e 100644
--- a/linker/linker.cpp
+++ b/linker/linker.cpp
@@ -3822,8 +3822,14 @@
   // we can no longer rely on the fact that libdl.so is part of default namespace
   // this is why we want to add ld-android.so to all namespaces from ld.config.txt
   soinfo* ld_android_so = solist_get_head();
+
+  // we also need vdso to be available for all namespaces (if present)
+  soinfo* vdso = solist_get_vdso();
   for (auto it : namespaces) {
     it.second->add_soinfo(ld_android_so);
+    if (vdso != nullptr) {
+      it.second->add_soinfo(vdso);
+    }
     // somain and ld_preloads are added to these namespaces after LD_PRELOAD libs are linked
   }