Skip to content

Commit

Permalink
Add a sleep for attach test to avoid a race and fail to resolve trace…
Browse files Browse the repository at this point in the history
…r pid namespace
  • Loading branch information
spikat committed Nov 28, 2024
1 parent 462437b commit 365a6c2
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions pkg/security/tests/syscall_tester/c/syscall_tester.c
Original file line number Diff line number Diff line change
Expand Up @@ -188,11 +188,10 @@ int ptrace_traceme() {
int ptrace_attach() {
int child = fork();
if (child == 0) {
for (int i = 0; i < 20; i++) {
sleep(1);
}
sleep(2);
} else {
ptrace(PTRACE_ATTACH, child, 0, NULL);
sleep(2); // sleep here to let the agent resolve the pid namespace on procfs
wait(NULL);
}
return EXIT_SUCCESS;
Expand Down

0 comments on commit 365a6c2

Please sign in to comment.