You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by ya...@apache.org on 2017/02/09 21:47:57 UTC
[2/3] mesos git commit: Capture ELF interpreters in the ldd utility.
Capture ELF interpreters in the ldd utility.
The ELF interpreter (ie. program loader) path is not necessarily
specified in the ELF dependencies section but we still need
to capture is as a dependency of an executable program.
Review: https://reviews.apache.org/r/56466/
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/0c0080e7
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/0c0080e7
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/0c0080e7
Branch: refs/heads/master
Commit: 0c0080e7ec2c2bbd4f935824217119ead0b8c7c6
Parents: 96f4991
Author: James Peach <jp...@apache.org>
Authored: Thu Feb 9 13:39:16 2017 -0800
Committer: Jiang Yan Xu <xu...@apple.com>
Committed: Thu Feb 9 13:40:51 2017 -0800
----------------------------------------------------------------------
src/linux/ldd.cpp | 11 +++++++++++
1 file changed, 11 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/0c0080e7/src/linux/ldd.cpp
----------------------------------------------------------------------
diff --git a/src/linux/ldd.cpp b/src/linux/ldd.cpp
index dd5c9c5..fead938 100644
--- a/src/linux/ldd.cpp
+++ b/src/linux/ldd.cpp
@@ -82,6 +82,17 @@ Try<hashset<string>> ldd(
return Error("'" + dependency + "' is not in the ld.so cache");
}
+ // If this ELF object has an interpreter (e.g. ld-linux-x86-64.so.2),
+ // inspect that too. We need both to be able to run an executable program.
+ // NOTE: The same object may be specified as a dependency too but on some
+ // systems (e.g. Ubuntu), the exact path of the two can differ even though
+ // they link to the the same file (see MESOS-7060). We however need the
+ // exact path specified in the interpreter section to run the executable.
+ Result<string> interpreter = elf->get_interpreter();
+ if (interpreter.isSome()) {
+ candidates.push_back(interpreter.get());
+ }
+
candidates.push_back(entry->path);
}