summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHongzhi.Song <hongzhi.song@windriver.com>2018-10-07 20:31:51 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-10-09 19:04:02 +0100
commit7a3cfd235b7434df5e9cdcbb5267ae6c618c1726 (patch)
tree95cb97d7d7ed2d74179705eca26ba3b0ca5195f4
parent58641400ce51176ea18e09428038c4e8a8ec2cd5 (diff)
downloadpoky-7a3cfd235b7434df5e9cdcbb5267ae6c618c1726.tar.gz
ltp: recent glibc calls syscall directly
The case of sigwaitinfo related to sigwaitinfo API failed. glibc commit 8b0e795aaa44 ("Simplify Linux sig{timed}wait{info} implementations") changed sigwaitinfo to call sigtimedwait, which calls rt_sigtimedwait syscall directly. So, an invalid pointer no longer crashes child process and test reports failure. Fix it by accepting either crash or EFAULT. (From OE-Core rev: bfd32c0d1c335e9c9cf8340f999e15054917577e) Signed-off-by: Hongzhi.Song <hongzhi.song@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-extended/ltp/ltp/0001-sigwaitinfo01-recent-glibc-calls-syscall-directly.patch75
-rw-r--r--meta/recipes-extended/ltp/ltp_20180515.bb1
2 files changed, 76 insertions, 0 deletions
diff --git a/meta/recipes-extended/ltp/ltp/0001-sigwaitinfo01-recent-glibc-calls-syscall-directly.patch b/meta/recipes-extended/ltp/ltp/0001-sigwaitinfo01-recent-glibc-calls-syscall-directly.patch
new file mode 100644
index 0000000000..c412c89e99
--- /dev/null
+++ b/meta/recipes-extended/ltp/ltp/0001-sigwaitinfo01-recent-glibc-calls-syscall-directly.patch
@@ -0,0 +1,75 @@
1From bb977ca0716ae98f10102c7122fe15bc0ddb5356 Mon Sep 17 00:00:00 2001
2From: "Hongzhi.Song" <hongzhi.song@windriver.com>
3Date: Thu, 20 Sep 2018 21:49:02 -0400
4Subject: [PATCH] sigwaitinfo01: recent glibc calls syscall directly
5
6glibc commit
7 8b0e795aaa44 ("Simplify Linux sig{timed}wait{info} implementations")
8changed sigwaitinfo to call sigtimedwait, which calls rt_sigtimedwait
9syscall directly.
10
11So, an invalid pointer no longer crashes child process and test
12reports failure. Fix it by accepting either crash or EFAULT.
13
14Signed-off-by: Jan Stancek <jstancek@redhat.com>
15
16Upstream-Status: Submitted [https://lists.linux.it/pipermail/ltp/2018-September/009338.html]
17
18Signed-off-by: Hongzhi.Song <hongzhi.song@windriver.com>
19---
20 .../kernel/syscalls/sigwaitinfo/sigwaitinfo01.c | 30 +++++++++++++++++++---
21 1 file changed, 26 insertions(+), 4 deletions(-)
22
23diff --git a/testcases/kernel/syscalls/sigwaitinfo/sigwaitinfo01.c b/testcases/kernel/syscalls/sigwaitinfo/sigwaitinfo01.c
24index 95a9436a4..8fa8ac34b 100644
25--- a/testcases/kernel/syscalls/sigwaitinfo/sigwaitinfo01.c
26+++ b/testcases/kernel/syscalls/sigwaitinfo/sigwaitinfo01.c
27@@ -371,19 +371,41 @@ void test_bad_address2(swi_func sigwaitinfo, int signo)
28 tst_brkm(TBROK | TERRNO, NULL, "fork() failed");
29 case 0:
30 signal(SIGSEGV, SIG_DFL);
31+
32+ /*
33+ * depending on glibc implementation we should
34+ * either crash or get EFAULT
35+ */
36 TEST(sigwaitinfo((void *)1, NULL, NULL));
37
38- _exit(0);
39+ if (TEST_RETURN == -1 && TEST_ERRNO == EFAULT)
40+ _exit(0);
41+
42+ tst_resm(TINFO, "swi_func returned: %ld, errno: %d",
43+ TEST_RETURN, TEST_ERRNO);
44+ _exit(1);
45+
46 break;
47 default:
48 break;
49 }
50
51 SUCCEED_OR_DIE(waitpid, "waitpid failed", pid, &status, 0);
52- if (WIFSIGNALED(status) && WTERMSIG(status) == SIGSEGV)
53+
54+ if ((WIFSIGNALED(status) && WTERMSIG(status) == SIGSEGV)
55+ || (WIFEXITED(status) && WEXITSTATUS(status) == 0)) {
56 tst_resm(TPASS, "Test passed");
57- else
58- tst_resm(TFAIL, "Unrecognised child exit code");
59+ return;
60+ }
61+
62+ if (WIFEXITED(status)) {
63+ tst_resm(TFAIL, "Unrecognised child exit code: %d",
64+ WEXITSTATUS(status));
65+ }
66+ if (WIFSIGNALED(status)) {
67+ tst_resm(TFAIL, "Unrecognised child termsig: %d",
68+ WTERMSIG(status));
69+ }
70 }
71
72 void test_bad_address3(swi_func sigwaitinfo, int signo)
73--
742.11.0
75
diff --git a/meta/recipes-extended/ltp/ltp_20180515.bb b/meta/recipes-extended/ltp/ltp_20180515.bb
index ce86f7f14b..ba0e6a60b4 100644
--- a/meta/recipes-extended/ltp/ltp_20180515.bb
+++ b/meta/recipes-extended/ltp/ltp_20180515.bb
@@ -53,6 +53,7 @@ SRC_URI = "git://github.com/linux-test-project/ltp.git \
53 file://0042-fs-ftest-ftest06.c-Fix-too-small-name-string-and-rel.patch \ 53 file://0042-fs-ftest-ftest06.c-Fix-too-small-name-string-and-rel.patch \
54 file://0043-open-creat-skip-S_ISGID-check-on-files-created-by-no.patch \ 54 file://0043-open-creat-skip-S_ISGID-check-on-files-created-by-no.patch \
55 file://0001-syscalls-fcntl-make-OFD-command-use-fcntl64-syscall-.patch \ 55 file://0001-syscalls-fcntl-make-OFD-command-use-fcntl64-syscall-.patch \
56 file://0001-sigwaitinfo01-recent-glibc-calls-syscall-directly.patch \
56 " 57 "
57 58
58S = "${WORKDIR}/git" 59S = "${WORKDIR}/git"