From: Jan Stancek <jstancek@redhat.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v2 1/2] syscalls/cma: test case should return TCONF if syscall doesn't exist
Date: Fri, 15 Feb 2019 08:53:29 -0500 (EST) [thread overview]
Message-ID: <853398062.984884.1550238809858.JavaMail.zimbra@redhat.com> (raw)
In-Reply-To: <CAEemH2fvR1WQBEmwPM_rpy4z3xN6Ueeqk9Ri8BHrFoPQgaAJqw@mail.gmail.com>
----- Original Message -----
> Hi Jason,
> A new failure was occured after applying this new patch.
> From our observation, the latest process_vm_readv03.c failed with
> process_vm_readv() Invalid argument error on rhel7.3 platfrom. We suspect
> that this problem maybe caused by glibc or compiler, because if compile the
> test program with -O0 it get pass, but with the ltp default optimization -O2
> it get fail. Also, if we revert this new patch, the test PASS whatever with
> -O2 and -O0, that's very strange.
One difference is that the extra function promoted int to long.
Can you try with patch below? (Note that I dropped also root requirement, man page
says that it has same requirements as ptrace - you should be able to read from processes you own)
Regards,
Jan
diff --git a/testcases/kernel/syscalls/cma/process_vm_readv03.c b/testcases/kernel/syscalls/cma/process_vm_readv03.c
index 45f7c92e499c..1cec442b3456 100644
--- a/testcases/kernel/syscalls/cma/process_vm_readv03.c
+++ b/testcases/kernel/syscalls/cma/process_vm_readv03.c
@@ -181,7 +181,7 @@ static long *fetch_remote_addrs(void)
remote.iov_len = len;
TEST(ltp_syscall(__NR_process_vm_readv, pids[0], &local,
- 1, &remote, 1, 0));
+ 1, &remote, 1, 0L));
if (TEST_RETURN != len)
tst_brkm(TFAIL | TERRNO, tst_exit, "process_vm_readv");
@@ -214,7 +214,7 @@ static void child_invoke(int *bufsz_arr)
NUM_LOCAL_VECS);
TEST(ltp_syscall(__NR_process_vm_readv, pids[0], local, NUM_LOCAL_VECS,
- remote, nr_iovecs, 0));
+ remote, nr_iovecs, 0L));
if (TEST_RETURN != bufsz)
tst_brkm(TBROK | TERRNO, tst_exit, "process_vm_readv");
@@ -245,10 +245,8 @@ static void child_invoke(int *bufsz_arr)
static void setup(void)
{
- tst_require_root();
-
/* Just a sanity check of the existence of syscall */
- ltp_syscall(__NR_process_vm_readv, getpid(), NULL, 0, NULL, 0, 0);
+ ltp_syscall(__NR_process_vm_readv, getpid(), NULL, 0, NULL, 0, 0L);
nr_iovecs = nflag ? SAFE_STRTOL(NULL, nr_opt, 1, IOV_MAX) : 10;
bufsz = sflag ? SAFE_STRTOL(NULL, sz_opt, NUM_LOCAL_VECS, LONG_MAX)
> --------------------------------
> # gcc -g -O2 -g -O2 -fno-strict-aliasing -pipe -Wall -W
> -Wold-style-definition -D_FORTIFY_SOURCE=2 -I../../../../include
> -I../../../../include -I../../../../include/old/ -L../../../../lib
> process_vm_readv03.c -lltp -o process_vm_readv03_O2
> # ./process_vm_readv03_O2
> process_vm_readv03 0 TINFO : child 0: 10 iovecs allocated and initialized.
> process_vm_readv03 0 TINFO : child 1: 10 remote iovecs received.
> process_vm_readv03 0 TINFO : child 1: 4 local iovecs initialized.
> process_vm_readv03 1 TBROK : process_vm_readv03.c:220: process_vm_readv:
> errno=EINVAL(22): Invalid argument
> process_vm_readv03 2 TBROK : process_vm_readv03.c:220: Remaining cases broken
> process_vm_readv03 1 TFAIL : process_vm_readv03.c:103: child 1 returns 512
> # strace -f ./process_vm_readv03_O2
> ...
> [pid 14676] process_vm_readv(14675, 0x7ffe40232ea0, 4, 0x7640c0, 10,
> 140728898420736) = -1 EINVAL (Invalid argument)
> [pid 14676] write(1, "process_vm_readv03 1 \33[1;31m"...,
> 125process_vm_readv03 1 TBROK : process_vm_readv03.c:220: process_vm_readv:
> errno=EINVAL(22): Invalid argument
> ) = 125
> ...
> --------------------------------------------
> # gcc -g -O0 -g -O0 -fno-strict-aliasing -pipe -Wall -W
> -Wold-style-definition -D_FORTIFY_SOURCE=2 -I../../../../include
> -I../../../../include -I../../../../include/old/ -L../../../../lib
> process_vm_readv03.c -lltp -o process_vm_readv03_O0
> # ./process_vm_readv03_O0
> process_vm_readv03 0 TINFO : child 0: 10 iovecs allocated and initialized.
> process_vm_readv03 0 TINFO : child 1: 10 remote iovecs received.
> process_vm_readv03 0 TINFO : child 1: 4 local iovecs initialized.
> process_vm_readv03 1 TPASS : child 1: all bytes are correctly received.
> # strace -f ./process_vm_readv03_O0
> ...
> [pid 14703] process_vm_readv(14702,
> [{"\0\1\2\3\4\5\6\7\10\t\n\v\f\r\16\17\20\21\22\23\24\25\26\27\30\31\32\33\34\35\36\37"...,
> 43269},
> {"\5\6\7\10\t\n\v\f\r\16\17\20\21\22\23\24\25\26\27\30\31\32\33\34\35\36\37
> !\"#$"..., 18907},
> {"\340\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357\360\361\362\363\364\365\366\367\370\371\372\373\374\375\376\377"...,
> 3203}, {"cdefghijklmnopqrstuvwxyz{|}~\177\200\201\202"..., 34621}], 4,
> [{0x9570c0, 24638}, {0x95d110, 35640}, {0x965c50, 19802}, {0x96a9c0, 490},
> {0x96abc0, 8624}, {0x96cd80, 3571}, {0x96db80, 2114}, {0x96e3d0, 2374},
> {0x96ed20, 1139}, {0x96f1a0, 1608}], 10, 0) = 100000
> [pid 14703] write(1, "process_vm_readv03 1 \33[1;32m"...,
> 89process_vm_readv03 1 TPASS : child 1: all bytes are correctly received.
> ) = 89
> ...
> # uname -r
> 3.10.0-514.55.4.el7.x86_64
> # rpm -q glibc
> glibc-2.17-157.el7_3.5.x86_64
> --
> Regards,
> Li Wang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20190215/21715672/attachment.html>
next prev parent reply other threads:[~2019-02-15 13:53 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-03 9:43 [LTP] [PATCH] syscalls/cma: test case should return TCONF if syscall doesn't exist Jason Xing
2018-12-03 9:58 ` Jan Stancek
2018-12-04 2:49 ` Jason Xing
2018-12-04 8:54 ` Jan Stancek
2018-12-05 13:43 ` [LTP] [PATCH v2 1/2] " Jason Xing
2018-12-05 13:43 ` [LTP] [PATCH v2 2/2] lapi/syscalls: Add syscall numbers for process_vm_readv/_writev Jason Xing
2018-12-05 22:07 ` Petr Vorel
2018-12-06 3:37 ` Jason Xing
2019-02-15 10:50 ` [LTP] [PATCH v2 1/2] syscalls/cma: test case should return TCONF if syscall doesn't exist Li Wang
2019-02-15 13:53 ` Jan Stancek [this message]
2019-02-16 7:18 ` Li Wang
2019-02-16 10:28 ` Jan Stancek
2019-02-22 18:29 ` Jan Stancek
2019-02-23 6:21 ` Caspar Zhang
2019-02-25 8:22 ` [LTP] [PATCH] syscalls/cma: fix the failure of compiling with O2 option Jason Xing
2019-02-25 10:34 ` Li Wang
2019-02-25 10:47 ` Jan Stancek
2019-02-25 13:16 ` Caspar Zhang
2019-02-26 1:42 ` [LTP] [PATCH v2] " Jason Xing
2019-02-26 2:22 ` [LTP] [PATCH v3] " Jason Xing
2019-02-26 3:17 ` Li Wang
2019-02-26 16:03 ` Jan Stancek
2019-02-26 2:00 ` [LTP] [PATCH] " Jason Xing
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=853398062.984884.1550238809858.JavaMail.zimbra@redhat.com \
--to=jstancek@redhat.com \
--cc=ltp@lists.linux.it \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox