Programs like the one below aren't handled properly and Ksysguard thinks they are zombies. Note that even if normal users don't create such processes that hackers will if they think it'll make it harder to for people to notice their process. #define _POSIX_C_SOURCE 200809L #include <assert.h> #include <errno.h> #include <pthread.h> #include <sched.h> #include <signal.h> #include <stdio.h> #include <stdlib.h> #include <stdio.h> #include <sys/wait.h> #include <unistd.h> struct start_args { pthread_t parent; }; static void *start_routine(void *arg); int main() { int err = 0; struct start_args *start_args = malloc(sizeof *start_args); if (0 == start_args) { perror("malloc"); return EXIT_FAILURE; } start_args->parent = pthread_self(); pthread_t child; { pthread_t xx; err = pthread_create(&xx, 0, start_routine, start_args); if (err != 0) { errno = err; perror("pthread_create"); return EXIT_FAILURE; } child = xx; } err = pthread_detach(child); if (err != 0) { errno = err; perror("pthread_detach"); return EXIT_FAILURE; } pthread_exit(0); } static void *start_routine(void *foo) { struct start_args *args = foo; pthread_t parent = args->parent; free(args); fprintf(stderr, "Process %i is a weirdo\n", getpid()); int err = pthread_join(parent, 0); if (err != 0) { perror("pthread_join"); exit(EXIT_FAILURE); } for (;;) pause(); } Reproducible: Always
Git commit 66c175011361a69fb4002debe97fa86b71777e68 by Arjen Hiemstra, on behalf of Jiří Paleček. Committed on 26/08/2021 at 08:50. Pushed by ahiemstra into branch 'master'. Offer process menu even for zombies It has been brought to my attention that even zombies may be sometimes running processes, particularly when a normal process does pthread_exit() in its main thread. Therefore, it should be possible to lower their priority or kill them by signal. Although the latter is still possible with the delete key, I think it is better that the normal context menu is also provided. M +14 -20 processui/ksysguardprocesslist.cpp https://invent.kde.org/plasma/libksysguard/commit/66c175011361a69fb4002debe97fa86b71777e68