aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2022-04-27 18:44:30 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2022-04-27 18:44:30 +0000
commit1627acb5e421f6b61b4ee9c47057198f7d20f389 (patch)
tree602ac1fa715dde0d3d9d1b3bb4fcf52b9660b1ac /tests
parentd8fa0f64af4b3ee41b3aa1bc7dd27b2185112b47 (diff)
parentede618aef2e66825d484503c020c106953db7e97 (diff)
Merge "Merge "Fix unistd.exec_argv0_null for new kernels." into android10-tests-dev am: 16457fd9d0" into android11-tests-dev am: ede618aef2
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2078358 Change-Id: I716eacb116e3a4a29acd1aa10ad96f43c583b56b Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
Diffstat (limited to 'tests')
-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) {