diff options
author | V3n3RiX <venerix@redcorelinux.org> | 2018-08-04 08:53:53 +0100 |
---|---|---|
committer | V3n3RiX <venerix@redcorelinux.org> | 2018-08-04 08:53:53 +0100 |
commit | e3872864be25f7421015bef2732fa57c0c9fb726 (patch) | |
tree | 9cb29a544215119b5c5538e37211b994ce1c87ae /sys-apps/proot/files/proot-4.0.1-argv.patch | |
parent | 480486b52ea64765faf696c88b2c6a26a5a454d4 (diff) |
gentoo resync : 04.08.2018
Diffstat (limited to 'sys-apps/proot/files/proot-4.0.1-argv.patch')
-rw-r--r-- | sys-apps/proot/files/proot-4.0.1-argv.patch | 125 |
1 files changed, 0 insertions, 125 deletions
diff --git a/sys-apps/proot/files/proot-4.0.1-argv.patch b/sys-apps/proot/files/proot-4.0.1-argv.patch deleted file mode 100644 index df580563458c..000000000000 --- a/sys-apps/proot/files/proot-4.0.1-argv.patch +++ /dev/null @@ -1,125 +0,0 @@ -commit 520fa3601c36dd0a3c84e310bd2a1189259000bd -Author: Cédric VINCENT <cedric.vincent@st.com> -Date: Thu Aug 7 14:29:37 2014 +0200 - - Don't dereference argv[0] when launching a script through a symlink. - - Reported-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se> - Ref: https://bugs.gentoo.org/show_bug.cgi?id=517496 - - Also, don't complain about non-regular or non-executable files that - are not explicitely candidates. - -diff --git a/src/path/path.c b/src/path/path.c -index 4225876..ecdef70 100644 ---- a/src/path/path.c -+++ b/src/path/path.c -@@ -219,17 +219,21 @@ int which(Tracee *tracee, const char *paths, char host_path[PATH_MAX], char *con - /* Is the command available without any $PATH look-up? */ - status = realpath2(tracee, host_path, command, true); - if (status == 0 && stat(host_path, &statr) == 0) { -- if (!S_ISREG(statr.st_mode)) { -+ if (is_explicit && !S_ISREG(statr.st_mode)) { - notice(tracee, ERROR, USER, "'%s' is not a regular file", command); - return -EACCES; - } - -- if ((statr.st_mode & S_IXUSR) == 0) { -+ if (is_explicit && (statr.st_mode & S_IXUSR) == 0) { - notice(tracee, ERROR, USER, "'%s' is not executable", command); - return -EACCES; - } - - found = true; -+ -+ /* Don't dereference the final component to preserve -+ * argv0 in case it is a symlink to script. */ -+ (void) realpath2(tracee, host_path, command, false); - } - else - found = false; -@@ -274,8 +278,12 @@ int which(Tracee *tracee, const char *paths, char host_path[PATH_MAX], char *con - if (status == 0 - && stat(host_path, &statr) == 0 - && S_ISREG(statr.st_mode) -- && (statr.st_mode & S_IXUSR) != 0) -- return 0; -+ && (statr.st_mode & S_IXUSR) != 0) { -+ /* Don't dereference the final component to preserve -+ * argv0 in case it is a symlink to script. */ -+ (void) realpath2(tracee, host_path, path, false); -+ return 0; -+ } - } while (*(cursor - 1) != '\0'); - - not_found: -diff --git a/src/tracee/event.c b/src/tracee/event.c -index 70668d6..5905c43 100644 ---- a/src/tracee/event.c -+++ b/src/tracee/event.c -@@ -92,7 +92,7 @@ int launch_process(Tracee *tracee) - * guest rootfs. Note: Valgrind can't handle execve(2) on - * "foreign" binaries (ENOEXEC) but can handle execvp(3) on such - * binaries. */ -- execvp(tracee->exe, tracee->cmdline); -+ execv(tracee->exe, tracee->cmdline); - return -errno; - - default: /* parent */ -diff --git a/tests/test-713b6910.sh b/tests/test-713b6910.sh -new file mode 100644 -index 0000000..82e01fd ---- /dev/null -+++ b/tests/test-713b6910.sh -@@ -0,0 +1,51 @@ -+if [ -z `which mcookie` ] || [ -z `which rm` ] || [ -z `which cat` ] || [ -z `which chmod` ] || [ -z `which ln` ] || [ -z `which grep` ] || [ -z `which mkdir` ] || [ ! -x ${ROOTFS}/bin/readlink ]; then -+ exit 125; -+fi -+ -+###################################################################### -+ -+TMP1=/tmp/$(mcookie) -+TMP2=/tmp/$(mcookie) -+TMP3=/tmp/$(mcookie) -+TMP4=/tmp/$(mcookie) -+ -+rm -fr ${TMP1} ${TMP2} ${TMP3} ${TMP4} -+ -+###################################################################### -+ -+cat > ${TMP1} <<'EOF' -+#!/bin/sh -+echo $0 -+EOF -+ -+chmod +x ${TMP1} -+ln -s ${TMP1} ${TMP2} -+ -+${PROOT} ${TMP2} | grep -v ${TMP1} -+${PROOT} ${TMP2} | grep ${TMP2} -+ -+###################################################################### -+ -+mkdir -p ${TMP3} -+cd ${TMP3} -+ -+ln -s $(which true) false -+! ${PROOT} false -+ -+echo "#!$(which false)" > true -+chmod a-x true -+${PROOT} true -+ -+###################################################################### -+ -+ln -s ${ROOTFS}/bin/readlink ${TMP4} -+ -+TEST1=$(${PROOT} ${ROOTFS}/bin/readlink /proc/self/exe) -+TEST2=$(${PROOT} ${TMP4} /proc/self/exe) -+ -+test "${TEST1}" = "${TEST2}" -+ -+###################################################################### -+ -+cd / -+rm -fr ${TMP1} ${TMP2} ${TMP3} ${TMP4} |