libc: Add support to allow library calls to find appropriate shell executable for a process
Library calls like system() and popen() invoke the shell executable
pointed to by '_PATH_BSHELL' in order to run the command passed into the
function. The _PATH_BSHELL points to /system/bin/sh by default and thus
breaks any vendor process trying to use system() / popen(), as they are
denied access to system shell by selinux.
This CL make necessary changes, so the implmentations of system() and popen()
can use the appropriate shell (e.g. /vendor/bin/sh for processes running
out of /vendor partition). Also, changes the implementation of system()
and popen().
Bug: 64832610
Test: Manual, Using a test program running from /system/bin and
/vendor/bin to ensure correct shell is being used.
Change-Id: Ie7168d69decb1ae98284446ae7db34dec930dc33
Merged-In: Ie7168d69decb1ae98284446ae7db34dec930dc33
Signed-off-by: Sandeep Patil <sspatil@google.com>
(cherry picked from commit aa3e32422cc7089b9b15976f2651a58840d95e4f)
diff --git a/libc/Android.bp b/libc/Android.bp
index 42d0914..be45f40 100644
--- a/libc/Android.bp
+++ b/libc/Android.bp
@@ -1385,6 +1385,7 @@
defaults: ["libc_defaults"],
srcs: [
"bionic/NetdClientDispatch.cpp",
+ "bionic/__bionic_get_shell_path.cpp",
"bionic/__cmsg_nxthdr.cpp",
"bionic/__errno.cpp",
"bionic/__gnu_basename.cpp",