sigpending: use direct syscall
PATCH 1/1 sigpending: use direct syscall
Expand coverage to the Android platform.
--- testcases/kernel/syscalls/sigpending/sigpending02.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
testcases/kernel/syscalls/sigpending/sigpending02.c +2 -1
@@ -17,13 +17,14 @@#include <sys/types.h> #include "tst_test.h" +#include "lapi/syscalls.h" static void run (void ) {/* set sigset to point to an invalid location */ sigset_t *sigset = (sigset_t *) -1 ; -TEST (sigpending (sigset)); +TEST (tst_syscall (__NR_rt_sigpending, sigset,NSIG /8 ));/* check return code */ if (TST_RET ==-1 ) {
Signature · 1 line
2.20.1.611.gfbb209baf1-goog
PATCH 1/1 sigpending: use direct syscall
Quoted 17 lines · Matthias Maennich
Expand coverage to the Android platform.
Signed-off-by Matthias Maennich <[email protected]>--- testcases/kernel/syscalls/sigpending/sigpending02.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)testcases/kernel/syscalls/sigpending/sigpending02.c +1
-0@@ -17,13 +17,14 @@#include <sys/types.h> #include "tst_test.h" +#include "lapi/syscalls.h"
testcases/kernel/syscalls/sigpending/sigpending02.c line 30
Quoted 10 lines
testcases/kernel/syscalls/sigpending/sigpending02.c +1
-1static void run (void ) {/* set sigset to point to an invalid location */ sigset_t *sigset = (sigset_t *) -1 ; -TEST (sigpending (sigset)); +TEST (tst_syscall (__NR_rt_sigpending, sigset,NSIG /8 ));/* check return code */ if (TST_RET ==-1 ) {
Should this be using __NR_sigpending instead? That worked for me (for 32-bit anyway, it's not available on arm64).
Alternately, this test/dir could be renamed to rt_sigpending, though we should also add a test for sigpending.
thanks,
steve
PATCH 1/1 sigpending: use direct syscall
Quoted 14 lines · Steve Muckle
testcases/kernel/syscalls/sigpending/sigpending02.c line 30
Quoted 6 lines · Matthias Maennich
testcases/kernel/syscalls/sigpending/sigpending02.c +1
-0/* set sigset to point to an invalid location */ sigset_t *sigset = (sigset_t *) -1 ; -TEST (sigpending (sigset)); +TEST (tst_syscall (__NR_rt_sigpending, sigset,NSIG /8 ));/* check return code */ if (TST_RET ==-1 ) {Should this be using
__NR_sigpendinginstead? That worked for me (for 32-bit anyway, it's not available on arm64).
Quoted 2 lines
Alternately, this test/dir could be renamed to
rt_sigpending, though we should also add a test for sigpending.
Syscall wrappers usually call __NR_rt_sigpending if the kernel provides it. So, I was going with this. But I guess you are right: if we already bypass the wrappers, we should adjust the tests accordingly.
I will update the patch.
Cheers,
Matthias
v2 cover sigpending / rt_sigpending
In reply to Matthias MaennichSplit the sigpending test case into rt_sigpending and sigpending, both bypassing any syscall wrappers.
Obviously these tests are currently only testing a rare corner case and more thorough testing is needed to cover both of the syscalls. That work is to be done in a later commit.
Matthias Maennich (2):
sigpending: use direct syscall
rt_sigpending: add rt_sigpending02 test case
runtest/syscalls | 1 + .../kernel/syscalls/rt_sigpending/.gitignore | 1 + .../kernel/syscalls/rt_sigpending/Makefile | 23 +++++++++ .../syscalls/rt_sigpending/rt_sigpending02.c | 48 +++++++++++++++++++ .../kernel/syscalls/sigpending/sigpending02.c | 3 +- 5 files changed, 75 insertions(+), 1 deletion(-) create mode 100644 testcases/kernel/syscalls/rt_sigpending/.gitignore create mode 100644 testcases/kernel/syscalls/rt_sigpending/Makefile create mode 100644 testcases/kernel/syscalls/rt_sigpending/rt_sigpending02.c
Signature · 1 line
2.20.1.791.gb4d0f1c61a-goog
PATCH v2 1/2 sigpending: use direct syscall
Expand coverage to the Android platform.
--- testcases/kernel/syscalls/sigpending/sigpending02.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
testcases/kernel/syscalls/sigpending/sigpending02.c +2 -1
@@ -17,13 +17,14 @@#include <sys/types.h> #include "tst_test.h" +#include "lapi/syscalls.h" static void run (void ) {/* set sigset to point to an invalid location */ sigset_t *sigset = (sigset_t *) -1 ; -TEST (sigpending (sigset)); +TEST (tst_syscall (__NR_sigpending, sigset));/* check return code */ if (TST_RET ==-1 ) {
Signature · 1 line
2.20.1.791.gb4d0f1c61a-goog
PATCH v2 1/2 sigpending: use direct syscall
Quoted 18 lines · Matthias Maennich' via kernel-team
Expand coverage to the Android platform.
Signed-off-by Matthias Maennich <[email protected]>--- testcases/kernel/syscalls/sigpending/sigpending02.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)testcases/kernel/syscalls/sigpending/sigpending02.c +1
-0@@ -17,13 +17,14 @@#include <sys/types.h> #include "tst_test.h" +#include "lapi/syscalls.h"
testcases/kernel/syscalls/sigpending/sigpending02.c line 30
Quoted 10 lines
testcases/kernel/syscalls/sigpending/sigpending02.c +1
-1static void run (void ) {/* set sigset to point to an invalid location */ sigset_t *sigset = (sigset_t *) -1 ; -TEST (sigpending (sigset)); +TEST (tst_syscall (__NR_sigpending, sigset));/* check return code */ if (TST_RET ==-1 ) {
PATCH v2 2/2 rt_sigpending: add rt_sigpending02 test case
In reply to Matthias MaennichThis is effectively a copy of the sigpending/sigpending02 test case. Both of them are now bypassing any syscall wrapper.
--- runtest/syscalls | 1 + .../kernel/syscalls/rt_sigpending/.gitignore | 1 + .../kernel/syscalls/rt_sigpending/Makefile | 23 +++++++++ .../syscalls/rt_sigpending/rt_sigpending02.c | 48 +++++++++++++++++++ 4 files changed, 73 insertions(+) create mode 100644 testcases/kernel/syscalls/rt_sigpending/.gitignore create mode 100644 testcases/kernel/syscalls/rt_sigpending/Makefile create mode 100644 testcases/kernel/syscalls/rt_sigpending/rt_sigpending02.c
runtest/syscalls +1 -0
@@ -990,6 +990,7 @@ rmdir03A symlink01 -T rmdir03 rt_sigaction01 rt_sigaction01 rt_sigaction02 rt_sigaction02 rt_sigaction03 rt_sigaction03 +rt_sigpending02 rt_sigpending02 rt_sigprocmask01 rt_sigprocmask01 rt_sigprocmask02 rt_sigprocmask02 rt_sigqueueinfo01 rt_sigqueueinfo01
testcases/kernel/syscalls/rt_sigpending/.gitignore new file +1 -0
@@ -0,0 +1 @@ +/rt_sigpending02
testcases/kernel/syscalls/rt_sigpending/Makefile new file +23 -0
@@ -0,0 +1,23 @@ +# +# Copyright (c) International Business Machines Corp., 2001 +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See +# the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# + +top_srcdir ?= ../../../.. + +include $(top_srcdir)/include/mk/testcases.mk + +include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/syscalls/rt_sigpending/rt_sigpending02.c new file +48 -0
48 lines not on this page · raw message
Signature · 1 line
2.20.1.791.gb4d0f1c61a-goog
PATCH v2 2/2 rt_sigpending: add rt_sigpending02 test case
Quoted 10 lines · Matthias Maennich' via kernel-team
This is effectively a copy of the sigpending/sigpending02 test case. Both of them are now bypassing any syscall wrapper.
Signed-off-by Matthias Maennich <[email protected]>--- runtest/syscalls | 1 + .../kernel/syscalls/rt_sigpending/.gitignore | 1 + .../kernel/syscalls/rt_sigpending/Makefile | 23 +++++++++ .../syscalls/rt_sigpending/rt_sigpending02.c | 48 +++++++++++++++++++ 4 files changed, 73 insertions(+)
Quoted 3 lines
create mode 100644 testcases/kernel/syscalls/rt_sigpending/.gitignore create mode 100644 testcases/kernel/syscalls/rt_sigpending/Makefile create mode 100644
testcases/kernel/syscalls/rt_sigpending/rt_sigpending02.c
I believe this new test should also be added to runtest/syscalls.
Quoted 71 lines
runtest/syscalls +1
-0@@ -990,6 +990,7 @@ rmdir03A symlink01 -T rmdir03 rt_sigaction01 rt_sigaction01 rt_sigaction02 rt_sigaction02 rt_sigaction03 rt_sigaction03 +rt_sigpending02 rt_sigpending02 rt_sigprocmask01 rt_sigprocmask01 rt_sigprocmask02 rt_sigprocmask02 rt_sigqueueinfo01 rt_sigqueueinfo01testcases/kernel/syscalls/rt_sigpending/.gitignore new file +1
-0@@ -0,0 +1 @@ +/rt_sigpending02testcases/kernel/syscalls/rt_sigpending/Makefile new file +23
-0@@ -0,0 +1,23 @@ +# +# Copyright (c) International Business Machines Corp., 2001 +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See +# the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# + +top_srcdir ?= ../../../.. + +include $(top_srcdir)/include/mk/testcases.mk + +include $(top_srcdir)/include/mk/generic_leaf_target.mktestcases/kernel/syscalls/rt_sigpending/rt_sigpending02.c new file +16
-0@@ -0,0 +1,48 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Copyright (c) International Business Machines Corp., 2002 +* +* AUTHORS +* Paul Larson +* +* DESCRIPTION +* Test to see that the proper errors are returned by rt_sigpending +* +* Test 1: +* Call rt_sigpending(sigset_t*=-1, SIGSETSIZE), +* it should return -1 with errno EFAULT +*/ + +#include <errno.h>
testcases/kernel/syscalls/rt_sigpending/rt_sigpending02.c line 26
Quoted 10 lines
testcases/kernel/syscalls/rt_sigpending/rt_sigpending02.c new file +10
-0+#include <signal.h> +#include <sys/types.h> + +#include "tst_test.h" +#include "ltp_signal.h" +#include "lapi/syscalls.h" + +static void run (void ) +{ +/* set sigset to point to an invalid location */
There are some cleanups that code be made such as removing not-necessarily-useful comments like the above, removing unnecessary brackets below, etc. But since this patch is just duplicating an existing test, maybe it's better to add the test first as is, then perhaps a cleanup patch can be done by someone later for both tests?
Quoted 13 lines
testcases/kernel/syscalls/rt_sigpending/rt_sigpending02.c new file +12
-0+sigset_t *sigset = (sigset_t *) -1 ; + +TEST (tst_syscall (__NR_rt_sigpending, sigset,SIGSETSIZE )); + +/* check return code */ +if (TST_RET ==-1 ) { +if (TST_ERR !=EFAULT ) { +tst_res (TFAIL |TTERRNO , +"rt_sigpending() Failed with wrong errno, " +"expected errno=%d, got " ,EFAULT ); + }else { +tst_res (TPASS |TTERRNO ,"expected failure" );
testcases/kernel/syscalls/rt_sigpending/rt_sigpending02.c line 48
Quoted 10 lines
testcases/kernel/syscalls/rt_sigpending/rt_sigpending02.c new file +10
-0+ } + }else { +tst_res (TFAIL , +"rt_sigpending() Failed, expected return value=-1, got %ld" ,TST_RET ); + } +} + +static struct tst_test test = { + .test_all = run +};
Looks good to me aside from the addition to runtest/syscalls.
cheers,
Steve
PATCH v2 2/2 rt_sigpending: add rt_sigpending02 test case
Hi!
Quoted 19 lines · Steve Muckle
Quoted 9 lines · Matthias Maennich' via kernel-team
This is effectively a copy of the sigpending/sigpending02 test case. Both of them are now bypassing any syscall wrapper.
Signed-off-by Matthias Maennich <[email protected]>---
runtest/syscalls | 1 + .../kernel/syscalls/rt_sigpending/.gitignore | 1 + .../kernel/syscalls/rt_sigpending/Makefile | 23 +++++++++ .../syscalls/rt_sigpending/rt_sigpending02.c | 48 +++++++++++++++++++Quoted 5 lines
4 files changed, 73 insertions(+)create mode 100644 testcases/kernel/syscalls/rt_sigpending/.gitignore create mode 100644 testcases/kernel/syscalls/rt_sigpending/Makefile create mode 100644
testcases/kernel/syscalls/rt_sigpending/rt_sigpending02.cI believe this new test should also be added to runtest/syscalls.
Quoted 1 line
Quoted 12 lines
Quoted 5 lines
runtest/syscalls +0
-0@@ -990,6 +990,7 @@ rmdir03A symlink01 -T rmdir03Quoted 7 lines
rt_sigaction01rt_sigaction01
rt_sigaction02rt_sigaction02
rt_sigaction03rt_sigaction03
+rt_sigpending02rt_sigpending02
rt_sigprocmask01rt_sigprocmask01
rt_sigprocmask02rt_sigprocmask02
rt_sigqueueinfo01rt_sigqueueinfo01
I added rt_sigpending02 to runtest/syscalls here. sigpending02 has already been there before.
Cheers,
Matthias
PATCH v2 2/2 rt_sigpending: add rt_sigpending02 test case
Quoted 2 lines · Matthias Männich
I added
rt_sigpending02to runtest/syscalls here. sigpending02 has already been there before.
Sigh, not sure how I missed that. Sorry for the noise!
PATCH v2 2/2 rt_sigpending: add rt_sigpending02 test case
Hi Matthias, Steve,
Quoted 7 lines · Matthias Männich
Quoted 2 lines
I added
rt_sigpending02to runtest/syscalls here. sigpending02 has already been there before.Sigh, not sure how I missed that. Sorry for the noise!
Reviewed-by Steve Muckle <[email protected]>
Both commits merged, thanks!
BTW maybe you have noticed ticket about using libc wrapper vs. direct syscall [1].
Build failure of your commit is caused by our docker image [2]
Kind regards,
Petr
[1] https://github.com/linux-test-project/ltp/issues/506
[2] http://lists.linux.it/pipermail/ltp/2019-March/011050.html