aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-05-17 20:07:46 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2022-05-17 20:07:46 +0000
commitb120c956d02ab6d2c5b040ca52c1608e4c3a5353 (patch)
treef9dcaee74f4dcf527d17fce7ebf982ad86719f4f
parent4237efa2538ad231200ca87d026d9b410f9c34cc (diff)
parent3d11c38d811c2e258d23082bc0e6ba93380da9ac (diff)
downloadbionic-b120c956d02ab6d2c5b040ca52c1608e4c3a5353.tar.gz
Merge "Snap for 8603829 from 16457fd9d0d985c07c8b581a3e5542084cf70f2a to android10-tests-release" into android10-tests-release
-rw-r--r--tests/unistd_test.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/tests/unistd_test.cpp b/tests/unistd_test.cpp
index 10c1710bd..38046ff14 100644
--- a/tests/unistd_test.cpp
+++ b/tests/unistd_test.cpp
@@ -1425,11 +1425,21 @@ TEST(UNISTD_TEST, execvp_libcore_test_55017) {
}
TEST(UNISTD_TEST, exec_argv0_null) {
- // http://b/33276926
+ // http://b/33276926 and http://b/227498625.
+ //
+ // With old kernels, bionic will see the null pointer and use "<unknown>" but
+ // with new (5.18+) kernels, the kernel will already have substituted the
+ // empty string, so we don't make any assertion here about what (if anything)
+ // comes before the first ':'.
+ //
+ // If this ever causes trouble, we could change bionic to replace _either_ the
+ // null pointer or the empty string. We could also use the actual name from
+ // readlink() on /proc/self/exe if we ever had reason to disallow programs
+ // from trying to hide like this.
char* args[] = {nullptr};
char* envs[] = {nullptr};
ASSERT_EXIT(execve("/system/bin/run-as", args, envs), testing::ExitedWithCode(1),
- "<unknown>: usage: run-as");
+ ": usage: run-as");
}
TEST(UNISTD_TEST, fexecve_failure) {