summaryrefslogtreecommitdiff
path: root/linker/linker.cpp
diff options
context:
space:
mode:
authorDimitry Ivanov <dimitry@google.com>2017-04-24 13:35:41 -0700
committerDimitry Ivanov <dimitry@google.com>2017-04-24 13:35:41 -0700
commit15f1db35fa71410356925e6469d1c1a61a4207cb (patch)
tree768b1e0e038b878c9b2f125012d7e0a91411dee1 /linker/linker.cpp
parentaf3bdf9299d12e919ffe81100fecae57b9d22d75 (diff)
Revert "Revert "loader: enable loading libraries from tmpfs""
This reverts commit 6d59318d78553c32c8f2f43ee48ec3bebace8e86. Bug: http://b/37245203 Bug: http://b/37590327 Test: bionic-unit-tests on angler and marlin Test: boot an angler and make sure mediacodec does not crash
Diffstat (limited to 'linker/linker.cpp')
-rw-r--r--linker/linker.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/linker/linker.cpp b/linker/linker.cpp
index 66bec58af..53f0608b5 100644
--- a/linker/linker.cpp
+++ b/linker/linker.cpp
@@ -36,6 +36,7 @@
#include <string.h>
#include <sys/mman.h>
#include <sys/param.h>
+#include <sys/vfs.h>
#include <unistd.h>
#include <new>
@@ -1191,7 +1192,15 @@ static bool load_library(android_namespace_t* ns,
return false;
}
- if (!ns->is_accessible(realpath)) {
+ struct statfs fs_stat;
+ if (TEMP_FAILURE_RETRY(fstatfs(task->get_fd(), &fs_stat)) != 0) {
+ DL_ERR("unable to fstatfs file for the library \"%s\": %s", name, strerror(errno));
+ return false;
+ }
+
+ // do not check accessibility using realpath if fd is located on tmpfs
+ // this enables use of memfd_create() for apps
+ if ((fs_stat.f_type != TMPFS_MAGIC) && (!ns->is_accessible(realpath))) {
// TODO(dimitry): workaround for http://b/26394120 - the grey-list
// TODO(dimitry) before O release: add a namespace attribute to have this enabled