aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2022-04-27 19:01:15 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2022-04-27 19:01:15 +0000
commit1fee8b5a6765dd1abf024aa3924e8715d8a2fda7 (patch)
tree602ac1fa715dde0d3d9d1b3bb4fcf52b9660b1ac
parent6c73a7ac6fad62ccf3bc7d6d7cb4be37e68be23c (diff)
parentba0f5b91958b6d0f86d067cd902b148aad744a03 (diff)
downloadbionic-1fee8b5a6765dd1abf024aa3924e8715d8a2fda7.tar.gz
Merge "Merge "Merge "Fix unistd.exec_argv0_null for new kernels." into android10-tests-dev am: 16457fd9d0" into android11-tests-dev am: ede618aef2" into android12-tests-dev am: ba0f5b9195
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2078358 Change-Id: Ia3d387780844a30feaaa65c55841f0577561620d Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-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 7d1e6128b..19f58e3f9 100644
--- a/tests/unistd_test.cpp
+++ b/tests/unistd_test.cpp
@@ -1515,11 +1515,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) {