summaryrefslogtreecommitdiffstats
path: root/meta/recipes-extended/ltp
diff options
context:
space:
mode:
authorHe Zhe <zhe.he@windriver.com>2019-08-19 21:56:33 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-08-21 15:29:02 +0100
commitf5a8ce775c803fa406bda378eb174407d365d503 (patch)
tree9dc6b033484cdbfcad3423bc56cfe23bb526ff2a /meta/recipes-extended/ltp
parent95c604953d054a688d3a30b303c9025094e65f84 (diff)
downloadpoky-f5a8ce775c803fa406bda378eb174407d365d503.tar.gz
ltp: Fix tgkill03 failure
Backport a patch to fix the followig failure. tgkill03.c:94: FAIL: Defunct tid should have failed with ESRCH: SUCCESS (From OE-Core rev: 92e873c63499850f1f9461d3babde13d44bc8f9c) Signed-off-by: He Zhe <zhe.he@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-extended/ltp')
-rw-r--r--meta/recipes-extended/ltp/ltp/0001-syscalls-tgkill03-wait-for-defunct-tid-to-get-detach.patch75
-rw-r--r--meta/recipes-extended/ltp/ltp_20190517.bb1
2 files changed, 76 insertions, 0 deletions
diff --git a/meta/recipes-extended/ltp/ltp/0001-syscalls-tgkill03-wait-for-defunct-tid-to-get-detach.patch b/meta/recipes-extended/ltp/ltp/0001-syscalls-tgkill03-wait-for-defunct-tid-to-get-detach.patch
new file mode 100644
index 0000000000..6ea26150fb
--- /dev/null
+++ b/meta/recipes-extended/ltp/ltp/0001-syscalls-tgkill03-wait-for-defunct-tid-to-get-detach.patch
@@ -0,0 +1,75 @@
1From e747d0456adc080a1d31fb653bda9dc491795c80 Mon Sep 17 00:00:00 2001
2From: Jan Stancek <jstancek@redhat.com>
3Date: Sun, 16 Jun 2019 11:14:16 +0200
4Subject: [PATCH] syscalls/tgkill03: wait for defunct tid to get detached
5
6Case where defunct tid is used has been observed to sporadically fail:
7 tgkill03.c:96: FAIL: Defunct tid should have failed with ESRCH: SUCCESS
8
9glibc __pthread_timedjoin_ex() waits for CLONE_CHILD_CLEARTID to clear tid,
10and then resumes. Kernel clears it (glibc pd->tid) at:
11 do_exit
12 exit_mm
13 mm_release
14 put_user(0, tsk->clear_child_tid);
15
16but kernel tid is still valid, presumably until:
17 release_task
18 __exit_signal
19 __unhash_process
20 detach_pid
21
22To avoid race wait until /proc/<pid>/task/<tid> disappears.
23
24Signed-off-by: Jan Stancek <jstancek@redhat.com>
25Reviewed-by: Li Wang <liwang@redhat.com>
26Acked-by: Sumit Garg <sumit.garg@linaro.org>
27
28Upstream-Status: Backport
29[https://github.com/linux-test-project/ltp/commit/e747d0456adc080a1d31fb653bda9dc491795c80]
30
31Signed-off-by: He Zhe <zhe.he@windriver.com>
32---
33 testcases/kernel/syscalls/tgkill/tgkill03.c | 6 +++++-
34 1 file changed, 5 insertions(+), 1 deletion(-)
35
36diff --git a/testcases/kernel/syscalls/tgkill/tgkill03.c b/testcases/kernel/syscalls/tgkill/tgkill03.c
37index f5bbdc5..593a217 100644
38--- a/testcases/kernel/syscalls/tgkill/tgkill03.c
39+++ b/testcases/kernel/syscalls/tgkill/tgkill03.c
40@@ -7,6 +7,7 @@
41
42 #include <pthread.h>
43 #include <pwd.h>
44+#include <stdio.h>
45 #include <sys/types.h>
46
47 #include "tst_safe_pthread.h"
48@@ -42,6 +43,7 @@ static void setup(void)
49 {
50 sigset_t sigusr1;
51 pthread_t defunct_thread;
52+ char defunct_tid_path[PATH_MAX];
53
54 sigemptyset(&sigusr1);
55 sigaddset(&sigusr1, SIGUSR1);
56@@ -55,8 +57,9 @@ static void setup(void)
57 TST_CHECKPOINT_WAIT(0);
58
59 SAFE_PTHREAD_CREATE(&defunct_thread, NULL, defunct_thread_func, NULL);
60-
61 SAFE_PTHREAD_JOIN(defunct_thread, NULL);
62+ sprintf(defunct_tid_path, "/proc/%d/task/%d", getpid(), defunct_tid);
63+ TST_RETRY_FN_EXP_BACKOFF(access(defunct_tid_path, R_OK), -1, 15);
64 }
65
66 static void cleanup(void)
67@@ -108,4 +111,5 @@ static struct tst_test test = {
68 .setup = setup,
69 .cleanup = cleanup,
70 .test = run,
71+ .timeout = 20,
72 };
73--
742.7.4
75
diff --git a/meta/recipes-extended/ltp/ltp_20190517.bb b/meta/recipes-extended/ltp/ltp_20190517.bb
index c62f2618b5..f6c7de62dd 100644
--- a/meta/recipes-extended/ltp/ltp_20190517.bb
+++ b/meta/recipes-extended/ltp/ltp_20190517.bb
@@ -43,6 +43,7 @@ SRC_URI = "git://github.com/linux-test-project/ltp.git \
43 file://0012-getrlimit03-adjust-a-bit-of-code-to-compatiable-with.patch \ 43 file://0012-getrlimit03-adjust-a-bit-of-code-to-compatiable-with.patch \
44 file://0001-Add-configure-time-check-for-getdents-getdents64-API.patch \ 44 file://0001-Add-configure-time-check-for-getdents-getdents64-API.patch \
45 file://0002-check-for-RES_USE_INET6-during-configure.patch \ 45 file://0002-check-for-RES_USE_INET6-during-configure.patch \
46 file://0001-syscalls-tgkill03-wait-for-defunct-tid-to-get-detach.patch \
46 " 47 "
47 48
48S = "${WORKDIR}/git" 49S = "${WORKDIR}/git"