|
25 | 25 | #include <stdlib.h> |
26 | 26 | #include <string.h> |
27 | 27 |
|
| 28 | +extern const char *cbm_test_program_path; |
| 29 | + |
28 | 30 | #ifdef _WIN32 |
29 | 31 | #ifndef WIN32_LEAN_AND_MEAN |
30 | 32 | #define WIN32_LEAN_AND_MEAN |
@@ -3262,6 +3264,7 @@ TEST(daemon_ipc_posix_startup_lock_is_cross_process) { |
3262 | 3264 | int child_result = ipc_test_cross_process_lock_child(endpoint, commands[0], results[1]); |
3263 | 3265 | (void)close(commands[0]); |
3264 | 3266 | (void)close(results[1]); |
| 3267 | + cbm_daemon_ipc_endpoint_free(endpoint); |
3265 | 3268 | _exit(child_result); |
3266 | 3269 | } |
3267 | 3270 | if (child > 0) { |
@@ -3352,6 +3355,7 @@ TEST(daemon_ipc_posix_lifetime_reservation_rejects_fork_inheritance) { |
3352 | 3355 | cbm_daemon_ipc_lifetime_reservation_release(inherited); |
3353 | 3356 | bool reported = ipc_test_fd_write_all(result_pipe[1], &child_result, sizeof(child_result)); |
3354 | 3357 | (void)close(result_pipe[1]); |
| 3358 | + cbm_daemon_ipc_endpoint_free(endpoint); |
3355 | 3359 | _exit(reported && child_result == 1 ? 0 : 1); |
3356 | 3360 | } |
3357 | 3361 | if (child > 0) { |
@@ -3447,6 +3451,7 @@ TEST(daemon_ipc_posix_child_participant_handoff_retains_legacy_bridge) { |
3447 | 3451 | ipc_test_fd_write_all(child_to_parent[1], &release_byte, sizeof(release_byte)); |
3448 | 3452 | (void)close(parent_to_child[0]); |
3449 | 3453 | (void)close(child_to_parent[1]); |
| 3454 | + cbm_daemon_ipc_endpoint_free(endpoint); |
3450 | 3455 | _exit(join_byte == 1 && release_reported && release_byte == 1 ? 0 : 1); |
3451 | 3456 | } |
3452 | 3457 | if (child > 0) { |
@@ -5581,6 +5586,14 @@ TEST(daemon_ipc_posix_single_uid_userns_real_smoke_issue1830) { |
5581 | 5586 | * unprivileged userns) -- while looking like a product regression. |
5582 | 5587 | * Re-exec so the decision is made by a process that STARTED here, which |
5583 | 5588 | * is also the only shape production ever takes. */ |
| 5589 | + /* /proc/self/exe can name Valgrind itself here. Re-exec the runner |
| 5590 | + * path recorded from argv[0] so the probe starts fresh in the namespace. |
| 5591 | + * A relative argv[0] stops resolving once an earlier test changes the |
| 5592 | + * working directory, so fall back to /proc/self/exe. */ |
| 5593 | + if (cbm_test_program_path) { |
| 5594 | + (void)execl(cbm_test_program_path, "test-runner", "--userns-secure-probe", probe, |
| 5595 | + (char *)NULL); |
| 5596 | + } |
5584 | 5597 | (void)execl("/proc/self/exe", "test-runner", "--userns-secure-probe", probe, (char *)NULL); |
5585 | 5598 | _exit(3); /* exec failed -- distinct from secure(0)/refused(1)/skip(2) */ |
5586 | 5599 | } |
|
0 commit comments