7ef4782f9d
Upstream commit: a996d13b8a2e101bedbb1bdaa7ffcfea3b959bb2 Drop glibc-rh1992702-*.patch, applied upstream. (#1992702) - Add missing braces to bsearch inline implementation [BZ #28400] - Suppress -Wcast-qual warnings in bsearch - linux: Revert the use of sched_getaffinity on get_nproc (BZ #28310) - linux: Simplify get_nprocs - misc: Add __get_nprocs_sched - nptl: pthread_kill must send signals to a specific thread [BZ #28407] - support: Add check for TID zero in support_wait_for_thread_exit
38 lines
1.5 KiB
Diff
38 lines
1.5 KiB
Diff
commit 4bf72519987ebc2be4a2058c670379040fae90ea
|
|
Author: Florian Weimer <fweimer@redhat.com>
|
|
Date: Fri Oct 1 18:16:41 2021 +0200
|
|
|
|
support: Add check for TID zero in support_wait_for_thread_exit
|
|
|
|
Some kernel versions (observed with kernel 5.14 and earlier) can list
|
|
"0" entries in /proc/self/task. This happens when a thread exits
|
|
while the task list is being constructed. Treat this entry as not
|
|
present, like the proposed kernel patch does:
|
|
|
|
[PATCH] procfs: Do not list TID 0 in /proc/<pid>/task
|
|
<https://lore.kernel.org/all/8735pn5dx7.fsf@oldenburg.str.redhat.com/>
|
|
|
|
Fixes commit 032d74eaf6179100048a5bf0ce942e97dc8b9a60 ("support: Add
|
|
support_wait_for_thread_exit").
|
|
|
|
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
|
|
Tested-by: Carlos O'Donell <carlos@redhat.com>
|
|
(cherry picked from commit 176c88f5214d8107d330971cbbfbbba5186a111f)
|
|
|
|
diff --git a/support/support_wait_for_thread_exit.c b/support/support_wait_for_thread_exit.c
|
|
index 658a81381006ea62..5e3be421a78a4c78 100644
|
|
--- a/support/support_wait_for_thread_exit.c
|
|
+++ b/support/support_wait_for_thread_exit.c
|
|
@@ -43,7 +43,10 @@ support_wait_for_thread_exit (void)
|
|
return;
|
|
}
|
|
|
|
- if (strcmp (e->d_name, ".") == 0 || strcmp (e->d_name, "..") == 0)
|
|
+ /* In some kernels, "0" entries denote a thread that has just
|
|
+ exited. */
|
|
+ if (strcmp (e->d_name, ".") == 0 || strcmp (e->d_name, "..") == 0
|
|
+ || strcmp (e->d_name, "0") == 0)
|
|
continue;
|
|
|
|
int task_tid = atoi (e->d_name);
|