<html><body><div style="font-family: times new roman, new york, times, serif; font-size: 12pt; color: #000000"><div><br></div><div><br></div><hr id="zwchr"><blockquote style="border-left:2px solid #1010FF;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-size:small">Hi Jason,</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">A new failure was occured after applying this new patch.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">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.</div></div></div></div></div></div></div></div></div></blockquote><div><br></div><div>One difference is that the extra function promoted int to long.<br></div><div>Can you try with patch below? (Note that I dropped also root requirement, man page</div><div>says that it has same requirements as ptrace - you should be able to read from processes you own)<br></div><div><br></div><div>Regards,<br></div><div>Jan<br></div><div><br></div><div>diff --git a/testcases/kernel/syscalls/cma/process_vm_readv03.c b/testcases/kernel/syscalls/cma/process_vm_readv03.c<br>index 45f7c92e499c..1cec442b3456 100644<br>--- a/testcases/kernel/syscalls/cma/process_vm_readv03.c<br>+++ b/testcases/kernel/syscalls/cma/process_vm_readv03.c<br>@@ -181,7 +181,7 @@ static long *fetch_remote_addrs(void)<br> remote.iov_len = len;<br> <br> TEST(ltp_syscall(__NR_process_vm_readv, pids[0], &local,<br>- 1, &remote, 1, 0));<br>+ 1, &remote, 1, 0L));<br> if (TEST_RETURN != len)<br> tst_brkm(TFAIL | TERRNO, tst_exit, "process_vm_readv");<br> <br>@@ -214,7 +214,7 @@ static void child_invoke(int *bufsz_arr)<br> NUM_LOCAL_VECS);<br> <br> TEST(ltp_syscall(__NR_process_vm_readv, pids[0], local, NUM_LOCAL_VECS,<br>- remote, nr_iovecs, 0));<br>+ remote, nr_iovecs, 0L));<br> if (TEST_RETURN != bufsz)<br> tst_brkm(TBROK | TERRNO, tst_exit, "process_vm_readv");<br> <br>@@ -245,10 +245,8 @@ static void child_invoke(int *bufsz_arr)<br> <br> static void setup(void)<br> {<br>- tst_require_root();<br>-<br> /* Just a sanity check of the existence of syscall */<br>- ltp_syscall(__NR_process_vm_readv, getpid(), NULL, 0, NULL, 0, 0);<br>+ ltp_syscall(__NR_process_vm_readv, getpid(), NULL, 0, NULL, 0, 0L);<br> <br> nr_iovecs = nflag ? SAFE_STRTOL(NULL, nr_opt, 1, IOV_MAX) : 10;<br> bufsz = sflag ? SAFE_STRTOL(NULL, sz_opt, NUM_LOCAL_VECS, LONG_MAX)<br><br></div><div><br></div><div><br></div><blockquote style="border-left:2px solid #1010FF;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div class="gmail_default"><div class="gmail_default" style="font-size:small"><div><br></div><div>--------------------------------</div></div><div class="gmail_default"><div class="gmail_default" style="font-size:small"># 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</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small"># ./process_vm_readv03_O2 </div><div class="gmail_default" style="font-size:small">process_vm_readv03 0 TINFO : child 0: 10 iovecs allocated and initialized.</div><div class="gmail_default" style="font-size:small">process_vm_readv03 0 TINFO : child 1: 10 remote iovecs received.</div><div class="gmail_default" style="font-size:small">process_vm_readv03 0 TINFO : child 1: 4 local iovecs initialized.</div><div class="gmail_default" style="font-size:small">process_vm_readv03 1 TBROK : process_vm_readv03.c:220: process_vm_readv: errno=EINVAL(22): Invalid argument</div><div class="gmail_default" style="font-size:small">process_vm_readv03 2 TBROK : process_vm_readv03.c:220: Remaining cases broken</div><div class="gmail_default" style="font-size:small">process_vm_readv03 1 TFAIL : process_vm_readv03.c:103: child 1 returns 512</div><div style="font-size:small"><br></div><div># strace -f ./process_vm_readv03_O2<br></div><div>...</div><div><div>[pid 14676] process_vm_readv(14675, 0x7ffe40232ea0, 4, 0x7640c0, 10, 140728898420736) = -1 EINVAL (Invalid argument)</div><div>[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</div><div>) = 125</div></div><div>...</div><div style="font-size:small"><br></div><div style="font-size:small">--------------------------------------------</div><div style="font-size:small"><div># 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</div><div><br></div><div># ./process_vm_readv03_O0 </div><div>process_vm_readv03 0 TINFO : child 0: 10 iovecs allocated and initialized.</div><div>process_vm_readv03 0 TINFO : child 1: 10 remote iovecs received.</div><div>process_vm_readv03 0 TINFO : child 1: 4 local iovecs initialized.</div><div>process_vm_readv03 1 TPASS : child 1: all bytes are correctly received.</div></div></div></div></div><div><br></div><div><div class="gmail_default" style="font-size:small"># strace -f ./process_vm_readv03_O0</div><div class="gmail_default" style="font-size:small">...</div></div><div><div class="gmail_default" style="font-size:small">[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</div><div class="gmail_default">[pid 14703] write(1, "process_vm_readv03 1 \33[1;32m"..., 89process_vm_readv03 1 TPASS : child 1: all bytes are correctly received.</div><div class="gmail_default">) = 89</div><div class="gmail_default" style="font-size:small">...</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small"># uname -r</div><div class="gmail_default">3.10.0-514.55.4.el7.x86_64</div><div class="gmail_default"><br></div><div class="gmail_default"># rpm -q glibc</div><div class="gmail_default">glibc-2.17-157.el7_3.5.x86_64</div><br></div>-- <br><div dir="ltr" class="gmail-m_2660818172560792445gmail_signature"><div dir="ltr"><div>Regards,<br></div><div>Li Wang<br></div></div></div></div></div></div></div></div></div></div></blockquote><div><br></div></div></body></html>