Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrectly reports exit code in sched_process_exit event #4566

Closed
rscampos opened this issue Jan 30, 2025 · 1 comment · Fixed by #4564
Closed

Incorrectly reports exit code in sched_process_exit event #4566

rscampos opened this issue Jan 30, 2025 · 1 comment · Fixed by #4564
Assignees
Labels
Milestone

Comments

@rscampos
Copy link
Collaborator

Description

Tracee incorrectly reports the exit code after using the trigger program (attached), whereas it should simply report 1 and 77.

sudo ./dist/tracee -e sched_process_exit -s comm=trigger
TIME             UID    COMM             PID     TID     RET              EVENT                     ARGS
12:08:14:542122  1000   trigger          3133042 3133042 0                sched_process_exit        exit_code: 9, process_group_exit: true
12:08:14:542306  1000   trigger          3133041 3133041 0                sched_process_exit        exit_code: 19712, process_group_exit: true

Output of tracee version:

Tracee version: main-7bd8324e9

Output of uname -a:

Linux vagrant 5.15.0-105-generic #115-Ubuntu SMP Mon Apr 15 09:52:04 UTC 2024 aarch64 aarch64 aarch64 GNU/Linux

Additional details

Use the following code to trigger:

gcc -o trigger trigger.c
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <signal.h>

int main() {
    printf("Forking process...\n");
    pid_t pid = fork();
    
    if (pid == 0) {
        printf("Child process running, PID: %d\n", getpid());
        sleep(10);
        printf("Child process exiting normally\n");
        exit(1);
    } else if (pid > 0) {
        // Parent process
        sleep(1);
        printf("Parent sending SIGKILL to child PID: %d\n", pid);
        kill(pid, SIGKILL);
        wait(NULL);
    } else {
        perror("fork");
        return 1;
    }

    exit(77);
}
@rscampos rscampos self-assigned this Jan 30, 2025
@rscampos
Copy link
Collaborator Author

Fixed by #4564

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant