* [LTP] [PATCH] syscalls/cma: add runtime check to setup()
@ 2013-04-23 8:17 Jan Stancek
2013-04-23 10:29 ` chrubis
2013-04-23 16:13 ` Mike Frysinger
0 siblings, 2 replies; 7+ messages in thread
From: Jan Stancek @ 2013-04-23 8:17 UTC (permalink / raw)
To: ltp-list
__NR_process_vm_readv / __NR_process_vm_writev defined doesn't
guarantee, that kernel supports these syscalls. Add check to setup(),
which uses ltp_syscall(). If syscall isn't supported it will
end the testcase with TCONF.
This also fixes small copy-paste error in process_vm_writev02.
Signed-off-by: Jan Stancek <jstancek@redhat.com>
---
testcases/kernel/syscalls/cma/process_vm.h | 1 +
testcases/kernel/syscalls/cma/process_vm01.c | 2 ++
testcases/kernel/syscalls/cma/process_vm_readv02.c | 2 ++
testcases/kernel/syscalls/cma/process_vm_readv03.c | 2 ++
.../kernel/syscalls/cma/process_vm_writev02.c | 6 ++++--
5 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/testcases/kernel/syscalls/cma/process_vm.h b/testcases/kernel/syscalls/cma/process_vm.h
index 5241fa1..35086c6 100644
--- a/testcases/kernel/syscalls/cma/process_vm.h
+++ b/testcases/kernel/syscalls/cma/process_vm.h
@@ -31,6 +31,7 @@
#include <sys/syscall.h>
#include <sys/uio.h>
#include <unistd.h>
+#include "linux_syscall_numbers.h"
union semun {
int val;
diff --git a/testcases/kernel/syscalls/cma/process_vm01.c b/testcases/kernel/syscalls/cma/process_vm01.c
index 1a91570..bb09855 100644
--- a/testcases/kernel/syscalls/cma/process_vm01.c
+++ b/testcases/kernel/syscalls/cma/process_vm01.c
@@ -108,6 +108,7 @@ static void setup(char *argv[])
else if (rflag) {
TCID = TCID_readv;
#if defined(__NR_process_vm_readv)
+ ltp_syscall(__NR_process_vm_readv, 0, NULL, 0, NULL, 0, 0);
cma_test_params = cma_test_params_read;
#else
tst_brkm(TCONF, NULL, "process_vm_readv does not"
@@ -116,6 +117,7 @@ static void setup(char *argv[])
} else if (wflag) {
TCID = TCID_writev;
#if defined(__NR_process_vm_writev)
+ ltp_syscall(__NR_process_vm_writev, 0, NULL, 0, NULL, 0, 0);
cma_test_params = cma_test_params_write;
#else
tst_brkm(TCONF, NULL, "process_vm_writev does not"
diff --git a/testcases/kernel/syscalls/cma/process_vm_readv02.c b/testcases/kernel/syscalls/cma/process_vm_readv02.c
index dea1bbe..752a513 100644
--- a/testcases/kernel/syscalls/cma/process_vm_readv02.c
+++ b/testcases/kernel/syscalls/cma/process_vm_readv02.c
@@ -159,6 +159,8 @@ static void setup(void)
#if !defined(__NR_process_vm_readv)
tst_brkm(TCONF, NULL, "process_vm_readv does not exist "
"on your system");
+#else
+ ltp_syscall(__NR_process_vm_readv, 0, NULL, 0, NULL, 0, 0);
#endif
semid = init_sem(1);
diff --git a/testcases/kernel/syscalls/cma/process_vm_readv03.c b/testcases/kernel/syscalls/cma/process_vm_readv03.c
index 7475a64..2a8f631 100644
--- a/testcases/kernel/syscalls/cma/process_vm_readv03.c
+++ b/testcases/kernel/syscalls/cma/process_vm_readv03.c
@@ -261,6 +261,8 @@ static void setup(void)
#if !defined(__NR_process_vm_readv)
tst_brkm(TCONF, NULL, "process_vm_readv does not exist "
"on your system");
+#else
+ ltp_syscall(__NR_process_vm_readv, 0, NULL, 0, NULL, 0, 0);
#endif
semid = init_sem(1);
srand(time(NULL));
diff --git a/testcases/kernel/syscalls/cma/process_vm_writev02.c b/testcases/kernel/syscalls/cma/process_vm_writev02.c
index 0ea956d..6fd7aea 100644
--- a/testcases/kernel/syscalls/cma/process_vm_writev02.c
+++ b/testcases/kernel/syscalls/cma/process_vm_writev02.c
@@ -180,7 +180,7 @@ static void child_write(void)
tst_resm(TINFO, "child 2: write to the same memory location.");
TEST(test_process_vm_writev(pids[0], &local, 1, &remote, 1, 0));
if (TEST_RETURN != bufsz)
- tst_brkm(TFAIL | TERRNO, tst_exit, "process_vm_readv");
+ tst_brkm(TFAIL | TERRNO, tst_exit, "process_vm_writev");
}
static void setup(void)
@@ -191,9 +191,11 @@ static void setup(void)
sflag ? SAFE_STRTOL(NULL, sz_opt, 1, LONG_MAX - PADDING_SIZE * 2)
: 100000;
-#if !defined(__NR_process_vm_readv)
+#if !defined(__NR_process_vm_writev)
tst_brkm(TCONF, NULL, "process_vm_writev does not exist "
"on your system");
+#else
+ ltp_syscall(__NR_process_vm_writev, 0, NULL, 0, NULL, 0, 0);
#endif
semid = init_sem(1);
--
1.7.1
------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [LTP] [PATCH] syscalls/cma: add runtime check to setup()
2013-04-23 8:17 [LTP] [PATCH] syscalls/cma: add runtime check to setup() Jan Stancek
@ 2013-04-23 10:29 ` chrubis
[not found] ` <956651177.1121108.1366719315370.JavaMail.root@redhat.com>
2013-04-23 16:13 ` Mike Frysinger
1 sibling, 1 reply; 7+ messages in thread
From: chrubis @ 2013-04-23 10:29 UTC (permalink / raw)
To: Jan Stancek; +Cc: ltp-list
Hi!
> static void setup(void)
> @@ -191,9 +191,11 @@ static void setup(void)
> sflag ? SAFE_STRTOL(NULL, sz_opt, 1, LONG_MAX - PADDING_SIZE * 2)
> : 100000;
>
> -#if !defined(__NR_process_vm_readv)
> +#if !defined(__NR_process_vm_writev)
> tst_brkm(TCONF, NULL, "process_vm_writev does not exist "
> "on your system");
> +#else
> + ltp_syscall(__NR_process_vm_writev, 0, NULL, 0, NULL, 0, 0);
> #endif
> semid = init_sem(1);
If you add the __NR_process_vm_writev to at least one of the
testscases/kernel/include/*.in and run regen script (make clean && make
in the corresponding dir), the linux_syscall_numbers.h will contain at
least stubs and ltp_syscall() will be able to handle both situations.
--
Cyril Hrubis
chrubis@suse.cz
------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [LTP] [PATCH] syscalls/cma: add runtime check to setup()
[not found] ` <956651177.1121108.1366719315370.JavaMail.root@redhat.com>
@ 2013-04-23 12:45 ` chrubis
0 siblings, 0 replies; 7+ messages in thread
From: chrubis @ 2013-04-23 12:45 UTC (permalink / raw)
To: Jan Stancek; +Cc: ltp-list
Hi!
> > > static void setup(void)
> > > @@ -191,9 +191,11 @@ static void setup(void)
> > > sflag ? SAFE_STRTOL(NULL, sz_opt, 1, LONG_MAX - PADDING_SIZE * 2)
> > > : 100000;
> > >
> > > -#if !defined(__NR_process_vm_readv)
> > > +#if !defined(__NR_process_vm_writev)
> > > tst_brkm(TCONF, NULL, "process_vm_writev does not exist "
> > > "on your system");
> > > +#else
> > > + ltp_syscall(__NR_process_vm_writev, 0, NULL, 0, NULL, 0, 0);
> > > #endif
> > > semid = init_sem(1);
> >
> > If you add the __NR_process_vm_writev to at least one of the
> > testscases/kernel/include/*.in and run regen script (make clean && make
> > in the corresponding dir), the linux_syscall_numbers.h will contain at
> > least stubs and ltp_syscall() will be able to handle both situations.
>
> We seem to be regenerating linux_syscall_numbers.h only when it's missing
> or when you run it manually. Should we just remove it from git tree?
> Build process will generate one and it will contain latest bits from *.in files
Right. And please add dependency on the *.in files too (this seems to be
missing as well).
--
Cyril Hrubis
chrubis@suse.cz
------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [LTP] [PATCH] syscalls/cma: add runtime check to setup()
2013-04-23 8:17 [LTP] [PATCH] syscalls/cma: add runtime check to setup() Jan Stancek
2013-04-23 10:29 ` chrubis
@ 2013-04-23 16:13 ` Mike Frysinger
2013-04-24 6:53 ` Jan Stancek
1 sibling, 1 reply; 7+ messages in thread
From: Mike Frysinger @ 2013-04-23 16:13 UTC (permalink / raw)
To: ltp-list
[-- Attachment #1.1: Type: Text/Plain, Size: 370 bytes --]
On Tuesday 23 April 2013 04:17:15 Jan Stancek wrote:
> __NR_process_vm_readv / __NR_process_vm_writev defined doesn't
> guarantee, that kernel supports these syscalls. Add check to setup(),
> which uses ltp_syscall(). If syscall isn't supported it will
> end the testcase with TCONF.
delete all the "#else" branches since you're now using linux_syscall_numbers.h
-mike
[-- Attachment #1.2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
[-- Attachment #2: Type: text/plain, Size: 421 bytes --]
------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr
[-- Attachment #3: Type: text/plain, Size: 155 bytes --]
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [LTP] [PATCH] syscalls/cma: add runtime check to setup()
2013-04-23 16:13 ` Mike Frysinger
@ 2013-04-24 6:53 ` Jan Stancek
2013-04-24 15:52 ` Mike Frysinger
0 siblings, 1 reply; 7+ messages in thread
From: Jan Stancek @ 2013-04-24 6:53 UTC (permalink / raw)
To: Mike Frysinger; +Cc: ltp-list
----- Original Message -----
> From: "Mike Frysinger" <vapier@gentoo.org>
> To: ltp-list@lists.sourceforge.net
> Cc: "Jan Stancek" <jstancek@redhat.com>
> Sent: Tuesday, 23 April, 2013 6:13:31 PM
> Subject: Re: [LTP] [PATCH] syscalls/cma: add runtime check to setup()
>
> On Tuesday 23 April 2013 04:17:15 Jan Stancek wrote:
> > __NR_process_vm_readv / __NR_process_vm_writev defined doesn't
> > guarantee, that kernel supports these syscalls. Add check to setup(),
> > which uses ltp_syscall(). If syscall isn't supported it will
> > end the testcase with TCONF.
>
> delete all the "#else" branches since you're now using
> linux_syscall_numbers.h
Without that check in parent, you can end up in situation where some child
aborts first and then parent reports failure. By doing it early in setup() you can
avoid allocating resources that won't go away when process later terminates with TCONF.
Regards,
Jan
------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [LTP] [PATCH] syscalls/cma: add runtime check to setup()
2013-04-24 6:53 ` Jan Stancek
@ 2013-04-24 15:52 ` Mike Frysinger
2013-04-24 15:58 ` chrubis
0 siblings, 1 reply; 7+ messages in thread
From: Mike Frysinger @ 2013-04-24 15:52 UTC (permalink / raw)
To: Jan Stancek; +Cc: ltp-list
[-- Attachment #1.1: Type: Text/Plain, Size: 987 bytes --]
On Wednesday 24 April 2013 02:53:52 Jan Stancek wrote:
> From: "Mike Frysinger" <vapier@gentoo.org>
> > On Tuesday 23 April 2013 04:17:15 Jan Stancek wrote:
> > > __NR_process_vm_readv / __NR_process_vm_writev defined doesn't
> > > guarantee, that kernel supports these syscalls. Add check to setup(),
> > > which uses ltp_syscall(). If syscall isn't supported it will
> > > end the testcase with TCONF.
> >
> > delete all the "#else" branches since you're now using
> > linux_syscall_numbers.h
>
> Without that check in parent, you can end up in situation where some child
> aborts first and then parent reports failure. By doing it early in setup()
> you can avoid allocating resources that won't go away when process later
> terminates with TCONF.
by including linux_syscall_numbers.h, you've guaranteed that
__NR_process_vm_readv will always be defined, thus the code under "#ifndef
__NR_process_vm_readv" will never be run, thus you should delete it.
-mike
[-- Attachment #1.2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
[-- Attachment #2: Type: text/plain, Size: 421 bytes --]
------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr
[-- Attachment #3: Type: text/plain, Size: 155 bytes --]
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [LTP] [PATCH] syscalls/cma: add runtime check to setup()
2013-04-24 15:52 ` Mike Frysinger
@ 2013-04-24 15:58 ` chrubis
0 siblings, 0 replies; 7+ messages in thread
From: chrubis @ 2013-04-24 15:58 UTC (permalink / raw)
To: Mike Frysinger; +Cc: ltp-list
Hi!
> > > delete all the "#else" branches since you're now using
> > > linux_syscall_numbers.h
> >
> > Without that check in parent, you can end up in situation where some child
> > aborts first and then parent reports failure. By doing it early in setup()
> > you can avoid allocating resources that won't go away when process later
> > terminates with TCONF.
>
> by including linux_syscall_numbers.h, you've guaranteed that
> __NR_process_vm_readv will always be defined, thus the code under "#ifndef
> __NR_process_vm_readv" will never be run, thus you should delete it.
Not until these are added to at least one of the in files and
linux_syscall_numbers.h are regenerated.
Which is why we started to fiddle with the kernel/include directory in
the first place.
--
Cyril Hrubis
chrubis@suse.cz
------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2013-04-24 15:57 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-23 8:17 [LTP] [PATCH] syscalls/cma: add runtime check to setup() Jan Stancek
2013-04-23 10:29 ` chrubis
[not found] ` <956651177.1121108.1366719315370.JavaMail.root@redhat.com>
2013-04-23 12:45 ` chrubis
2013-04-23 16:13 ` Mike Frysinger
2013-04-24 6:53 ` Jan Stancek
2013-04-24 15:52 ` Mike Frysinger
2013-04-24 15:58 ` chrubis
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox