Merge "Fix unistd.exec_argv0_null for new kernels." am: 97ef479dfe
am: 3a50e803dd
am: 5437ec7a18
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2052352 Change-Id: I318ed82a245ffb10858d569f81d86b1b9e2b210d Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
commit
9050366342
1 changed files with 12 additions and 2 deletions
|
@ -1529,11 +1529,21 @@ TEST(UNISTD_TEST, execvp_libcore_test_55017) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(UNISTD_TEST, exec_argv0_null) {
|
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* args[] = {nullptr};
|
||||||
char* envs[] = {nullptr};
|
char* envs[] = {nullptr};
|
||||||
ASSERT_EXIT(execve("/system/bin/run-as", args, envs), testing::ExitedWithCode(1),
|
ASSERT_EXIT(execve("/system/bin/run-as", args, envs), testing::ExitedWithCode(1),
|
||||||
"<unknown>: usage: run-as");
|
": usage: run-as");
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(UNISTD_TEST, fexecve_failure) {
|
TEST(UNISTD_TEST, fexecve_failure) {
|
||||||
|
|
Loading…
Reference in a new issue