Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH 0/1 V2] sigwaitinfo01: recent glibc calls syscall directly
@ 2018-09-21  6:09 Hongzhi.Song
  2018-09-21  6:09 ` [PATCH 1/1] " Hongzhi.Song
  2018-09-28 11:27 ` [PATCH 0/1 V2] " He Zhe
  0 siblings, 2 replies; 4+ messages in thread
From: Hongzhi.Song @ 2018-09-21  6:09 UTC (permalink / raw)
  To: openembedded-core

v2:
    modify the format of [Upstream-Status]

Hongzhi.Song (1):
  sigwaitinfo01: recent glibc calls syscall directly

 ...nfo01-recent-glibc-calls-syscall-directly.patch | 75 ++++++++++++++++++++++
 meta/recipes-extended/ltp/ltp_20180515.bb          |  1 +
 2 files changed, 76 insertions(+)
 create mode 100644 meta/recipes-extended/ltp/ltp/0001-sigwaitinfo01-recent-glibc-calls-syscall-directly.patch

-- 
2.11.0



^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/1] sigwaitinfo01: recent glibc calls syscall directly
  2018-09-21  6:09 [PATCH 0/1 V2] sigwaitinfo01: recent glibc calls syscall directly Hongzhi.Song
@ 2018-09-21  6:09 ` Hongzhi.Song
  2018-09-28 13:47   ` Burton, Ross
  2018-09-28 11:27 ` [PATCH 0/1 V2] " He Zhe
  1 sibling, 1 reply; 4+ messages in thread
From: Hongzhi.Song @ 2018-09-21  6:09 UTC (permalink / raw)
  To: openembedded-core

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.

Signed-off-by: Hongzhi.Song <hongzhi.song@windriver.com>
---
 ...nfo01-recent-glibc-calls-syscall-directly.patch | 75 ++++++++++++++++++++++
 meta/recipes-extended/ltp/ltp_20180515.bb          |  1 +
 2 files changed, 76 insertions(+)
 create mode 100644 meta/recipes-extended/ltp/ltp/0001-sigwaitinfo01-recent-glibc-calls-syscall-directly.patch

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..46e7fabd3d
--- /dev/null
+++ b/meta/recipes-extended/ltp/ltp/0001-sigwaitinfo01-recent-glibc-calls-syscall-directly.patch
@@ -0,0 +1,75 @@
+From 0932ca0a6f3ed9f7ae4487ed77ec07eb3610f4a7 Mon Sep 17 00:00:00 2001
+From: "Hongzhi.Song" <hongzhi.song@windriver.com>
+Date: Thu, 20 Sep 2018 21:49:02 -0400
+Subject: [PATCH] sigwaitinfo01: recent glibc calls syscall directly
+
+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.
+
+Signed-off-by: Jan Stancek <jstancek@redhat.com>
+
+Upstream-Status: Submitted [https://lists.linux.it/pipermail/ltp/2018-September/009338.html]
+
+Signed-off-by: Hongzhi.Song <hongzhi.song@windriver.com>
+---
+ .../kernel/syscalls/sigwaitinfo/sigwaitinfo01.c    | 30 +++++++++++++++++++---
+ 1 file changed, 26 insertions(+), 4 deletions(-)
+
+diff --git a/testcases/kernel/syscalls/sigwaitinfo/sigwaitinfo01.c b/testcases/kernel/syscalls/sigwaitinfo/sigwaitinfo01.c
+index 95a9436..8fa8ac3 100644
+--- a/testcases/kernel/syscalls/sigwaitinfo/sigwaitinfo01.c
++++ b/testcases/kernel/syscalls/sigwaitinfo/sigwaitinfo01.c
+@@ -371,19 +371,41 @@ void test_bad_address2(swi_func sigwaitinfo, int signo)
+ 		tst_brkm(TBROK | TERRNO, NULL, "fork() failed");
+ 	case 0:
+ 		signal(SIGSEGV, SIG_DFL);
++
++       /*
++        * depending on glibc implementation we should
++        * either crash or get EFAULT
++        */
+ 		TEST(sigwaitinfo((void *)1, NULL, NULL));
+ 
+-		_exit(0);
++       if (TEST_RETURN == -1 && TEST_ERRNO == EFAULT)
++           _exit(0);
++
++       tst_resm(TINFO, "swi_func returned: %ld, errno: %d",
++           TEST_RETURN, TEST_ERRNO);
++       _exit(1);
++
+ 		break;
+ 	default:
+ 		break;
+ 	}
+ 
+ 	SUCCEED_OR_DIE(waitpid, "waitpid failed", pid, &status, 0);
+-	if (WIFSIGNALED(status) && WTERMSIG(status) == SIGSEGV)
++
++   if ((WIFSIGNALED(status) && WTERMSIG(status) == SIGSEGV)
++       || (WIFEXITED(status) && WEXITSTATUS(status) == 0)) {
+ 		tst_resm(TPASS, "Test passed");
+-	else
+-		tst_resm(TFAIL, "Unrecognised child exit code");
++       return;
++   }
++
++   if (WIFEXITED(status)) {
++       tst_resm(TFAIL, "Unrecognised child exit code: %d",
++           WEXITSTATUS(status));
++   }
++   if (WIFSIGNALED(status)) {
++       tst_resm(TFAIL, "Unrecognised child termsig: %d",
++           WTERMSIG(status));
++   }
+ }
+ 
+ void test_bad_address3(swi_func sigwaitinfo, int signo)
+-- 
+2.8.1
+
diff --git a/meta/recipes-extended/ltp/ltp_20180515.bb b/meta/recipes-extended/ltp/ltp_20180515.bb
index 9cd3489722..c99d5a2b00 100644
--- a/meta/recipes-extended/ltp/ltp_20180515.bb
+++ b/meta/recipes-extended/ltp/ltp_20180515.bb
@@ -52,6 +52,7 @@ SRC_URI = "git://github.com/linux-test-project/ltp.git \
            file://0041-cve-2017-5669-shmat-for-0-or-PAGESIZE-with-RND-flag-.patch \
            file://0042-fs-ftest-ftest06.c-Fix-too-small-name-string-and-rel.patch \
            file://0043-open-creat-skip-S_ISGID-check-on-files-created-by-no.patch \
+           file://0001-sigwaitinfo01-recent-glibc-calls-syscall-directly.patch \
            "
 
 S = "${WORKDIR}/git"
-- 
2.11.0



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 0/1 V2] sigwaitinfo01: recent glibc calls syscall directly
  2018-09-21  6:09 [PATCH 0/1 V2] sigwaitinfo01: recent glibc calls syscall directly Hongzhi.Song
  2018-09-21  6:09 ` [PATCH 1/1] " Hongzhi.Song
@ 2018-09-28 11:27 ` He Zhe
  1 sibling, 0 replies; 4+ messages in thread
From: He Zhe @ 2018-09-28 11:27 UTC (permalink / raw)
  To: Hongzhi.Song, openembedded-core

Ping.

Zhe

On 2018年09月21日 14:09, Hongzhi.Song wrote:
> v2:
>     modify the format of [Upstream-Status]
>
> Hongzhi.Song (1):
>   sigwaitinfo01: recent glibc calls syscall directly
>
>  ...nfo01-recent-glibc-calls-syscall-directly.patch | 75 ++++++++++++++++++++++
>  meta/recipes-extended/ltp/ltp_20180515.bb          |  1 +
>  2 files changed, 76 insertions(+)
>  create mode 100644 meta/recipes-extended/ltp/ltp/0001-sigwaitinfo01-recent-glibc-calls-syscall-directly.patch
>



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/1] sigwaitinfo01: recent glibc calls syscall directly
  2018-09-21  6:09 ` [PATCH 1/1] " Hongzhi.Song
@ 2018-09-28 13:47   ` Burton, Ross
  0 siblings, 0 replies; 4+ messages in thread
From: Burton, Ross @ 2018-09-28 13:47 UTC (permalink / raw)
  To: Hongzhi.Song; +Cc: OE-core

Please put the recipe name at the beginning of the commit log, and
rebase on top of master.

Ross
On Fri, 21 Sep 2018 at 07:10, Hongzhi.Song <hongzhi.song@windriver.com> wrote:
>
> 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.
>
> Signed-off-by: Hongzhi.Song <hongzhi.song@windriver.com>
> ---
>  ...nfo01-recent-glibc-calls-syscall-directly.patch | 75 ++++++++++++++++++++++
>  meta/recipes-extended/ltp/ltp_20180515.bb          |  1 +
>  2 files changed, 76 insertions(+)
>  create mode 100644 meta/recipes-extended/ltp/ltp/0001-sigwaitinfo01-recent-glibc-calls-syscall-directly.patch
>
> 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..46e7fabd3d
> --- /dev/null
> +++ b/meta/recipes-extended/ltp/ltp/0001-sigwaitinfo01-recent-glibc-calls-syscall-directly.patch
> @@ -0,0 +1,75 @@
> +From 0932ca0a6f3ed9f7ae4487ed77ec07eb3610f4a7 Mon Sep 17 00:00:00 2001
> +From: "Hongzhi.Song" <hongzhi.song@windriver.com>
> +Date: Thu, 20 Sep 2018 21:49:02 -0400
> +Subject: [PATCH] sigwaitinfo01: recent glibc calls syscall directly
> +
> +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.
> +
> +Signed-off-by: Jan Stancek <jstancek@redhat.com>
> +
> +Upstream-Status: Submitted [https://lists.linux.it/pipermail/ltp/2018-September/009338.html]
> +
> +Signed-off-by: Hongzhi.Song <hongzhi.song@windriver.com>
> +---
> + .../kernel/syscalls/sigwaitinfo/sigwaitinfo01.c    | 30 +++++++++++++++++++---
> + 1 file changed, 26 insertions(+), 4 deletions(-)
> +
> +diff --git a/testcases/kernel/syscalls/sigwaitinfo/sigwaitinfo01.c b/testcases/kernel/syscalls/sigwaitinfo/sigwaitinfo01.c
> +index 95a9436..8fa8ac3 100644
> +--- a/testcases/kernel/syscalls/sigwaitinfo/sigwaitinfo01.c
> ++++ b/testcases/kernel/syscalls/sigwaitinfo/sigwaitinfo01.c
> +@@ -371,19 +371,41 @@ void test_bad_address2(swi_func sigwaitinfo, int signo)
> +               tst_brkm(TBROK | TERRNO, NULL, "fork() failed");
> +       case 0:
> +               signal(SIGSEGV, SIG_DFL);
> ++
> ++       /*
> ++        * depending on glibc implementation we should
> ++        * either crash or get EFAULT
> ++        */
> +               TEST(sigwaitinfo((void *)1, NULL, NULL));
> +
> +-              _exit(0);
> ++       if (TEST_RETURN == -1 && TEST_ERRNO == EFAULT)
> ++           _exit(0);
> ++
> ++       tst_resm(TINFO, "swi_func returned: %ld, errno: %d",
> ++           TEST_RETURN, TEST_ERRNO);
> ++       _exit(1);
> ++
> +               break;
> +       default:
> +               break;
> +       }
> +
> +       SUCCEED_OR_DIE(waitpid, "waitpid failed", pid, &status, 0);
> +-      if (WIFSIGNALED(status) && WTERMSIG(status) == SIGSEGV)
> ++
> ++   if ((WIFSIGNALED(status) && WTERMSIG(status) == SIGSEGV)
> ++       || (WIFEXITED(status) && WEXITSTATUS(status) == 0)) {
> +               tst_resm(TPASS, "Test passed");
> +-      else
> +-              tst_resm(TFAIL, "Unrecognised child exit code");
> ++       return;
> ++   }
> ++
> ++   if (WIFEXITED(status)) {
> ++       tst_resm(TFAIL, "Unrecognised child exit code: %d",
> ++           WEXITSTATUS(status));
> ++   }
> ++   if (WIFSIGNALED(status)) {
> ++       tst_resm(TFAIL, "Unrecognised child termsig: %d",
> ++           WTERMSIG(status));
> ++   }
> + }
> +
> + void test_bad_address3(swi_func sigwaitinfo, int signo)
> +--
> +2.8.1
> +
> diff --git a/meta/recipes-extended/ltp/ltp_20180515.bb b/meta/recipes-extended/ltp/ltp_20180515.bb
> index 9cd3489722..c99d5a2b00 100644
> --- a/meta/recipes-extended/ltp/ltp_20180515.bb
> +++ b/meta/recipes-extended/ltp/ltp_20180515.bb
> @@ -52,6 +52,7 @@ SRC_URI = "git://github.com/linux-test-project/ltp.git \
>             file://0041-cve-2017-5669-shmat-for-0-or-PAGESIZE-with-RND-flag-.patch \
>             file://0042-fs-ftest-ftest06.c-Fix-too-small-name-string-and-rel.patch \
>             file://0043-open-creat-skip-S_ISGID-check-on-files-created-by-no.patch \
> +           file://0001-sigwaitinfo01-recent-glibc-calls-syscall-directly.patch \
>             "
>
>  S = "${WORKDIR}/git"
> --
> 2.11.0
>
> --
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-09-28 13:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-09-21  6:09 [PATCH 0/1 V2] sigwaitinfo01: recent glibc calls syscall directly Hongzhi.Song
2018-09-21  6:09 ` [PATCH 1/1] " Hongzhi.Song
2018-09-28 13:47   ` Burton, Ross
2018-09-28 11:27 ` [PATCH 0/1 V2] " He Zhe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox