syscalls/cma: test case should return TCONF if syscall doesn't exist
PATCH 1/1 syscalls/cma: test case should return TCONF if syscall doesn't exist
The original code returns TFAIL when process_vm_readv/_writev syscalls do not exist, while we are expecting a TCONF. During investigation, we find it is due to '#if defined(__NR_process_vm_readv/_writev)' fails to work as expected. We fix this issue by using ltp_syscall() function in setup function. BTW, we don't use new tst_syscall() interface due to compatibility issue exists between old apis and new ones.
--- testcases/kernel/syscalls/cma/process_vm.h | 62 ---------------------- testcases/kernel/syscalls/cma/process_vm01.c | 30 ++++------- testcases/kernel/syscalls/cma/process_vm_readv02.c | 12 ++--- testcases/kernel/syscalls/cma/process_vm_readv03.c | 14 ++--- .../kernel/syscalls/cma/process_vm_writev02.c | 12 ++--- 5 files changed, 30 insertions(+), 100 deletions(-) delete mode 100644 testcases/kernel/syscalls/cma/process_vm.h
testcases/kernel/syscalls/cma/process_vm.h deleted +0 -62
@@ -1,62 +0,0 @@ -/* -* Copyright (C) 2012 Linux Test Project, Inc. -* -* This program is free software; you can redistribute it and/or -* modify it under the terms of version 2 of the GNU General Public -* License as published by the Free Software Foundation. -* -* This program is distributed in the hope that it would be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -* -* Further, this software is distributed without any warranty that it -* is free of the rightful claim of any third person regarding -* infringement or the like. Any license provided herein, whether -* implied or otherwise, applies only to this software file. Patent -* licenses, if any, provided herein do not apply to combinations of -* this program with other software, or any other product whatsoever. -* -* You should have received a copy of the GNU General Public License -* along with this program; if not, write the Free Software -* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -* 02110-1301, USA. -*/ - -#ifndef _PROCESS_VM_H_ -#define _PROCESS_VM_H_ - -#include <sys/types.h> -#include <sys/ipc.h> -#include <sys/sem.h> -#include <sys/syscall.h> -#include <sys/uio.h> -#include <unistd.h> -#include "lapi/semun.h" - -static inline ssize_t test_process_vm_readv (pid_t pid, -const struct iovec *lvec,unsigned long liovcnt, -const struct iovec *rvec,unsigned long riovcnt, -unsigned long flags) -{ -#if defined(__NR_process_vm_readv) -return syscall (__NR_process_vm_readv, pid, lvec, liovcnt, - rvec, riovcnt, flags); -#else -return syscall (-1 ); -#endif -} - -static inline ssize_t test_process_vm_writev (pid_t pid, -const struct iovec *lvec,unsigned long liovcnt, -const struct iovec *rvec,unsigned long riovcnt, -unsigned long flags) -{ -#if defined(__NR_process_vm_writev) -return syscall (__NR_process_vm_writev, pid, lvec, liovcnt, - rvec, riovcnt, flags); -#else -return syscall (-1 ); -#endif -} - -#endif /* _PROCESS_VM_H_ */
testcases/kernel/syscalls/cma/process_vm01.c +11 -19
@@ -42,7 +42,7 @@#include "config.h" #include "test.h" #include "safe_macros.h" -#include "process_vm.h" +#include "lapi/syscalls.h" struct process_vm_params {int len;
@@ -103,20 +103,10 @@ static void setup(char *argv[]) " at the same time."); else if (rflag) {TCID = TCID_readv; -#if defined(__NR_process_vm_readv) cma_test_params = cma_test_params_read; -#else -tst_brkm (TCONF ,NULL ,"process_vm_readv does not" -" exist on your system." ); -#endif } else if (wflag) {TCID = TCID_writev; -#if defined(__NR_process_vm_writev) cma_test_params = cma_test_params_write; -#else -tst_brkm (TCONF ,NULL ,"process_vm_writev does not" -" exist on your system." ); -#endif } else tst_brkm(TBROK, NULL, "Parameter missing, required -r or -w.");TEST_PAUSE ;
@@ -134,18 +124,20 @@ static void help(void)static void cma_test_params_read (struct process_vm_params *params) { -TEST (test_process_vm_readv (params->pid, - params->lvec, params->liovcnt, - params->rvec, params->riovcnt, - params->flags)); +TEST (ltp_syscall (__NR_process_vm_readv, + params->pid, + params->lvec, params->liovcnt, + params->rvec, params->riovcnt, + params->flags)); }static void cma_test_params_write (struct process_vm_params *params) { -TEST (test_process_vm_writev (params->pid, - params->lvec, params->liovcnt, - params->rvec, params->riovcnt, - params->flags)); +TEST (ltp_syscall (__NR_process_vm_writev, + params->pid, + params->lvec, params->liovcnt, + params->rvec, params->riovcnt, + params->flags)); }static int cma_check_ret (long expected_ret,long act_ret)
testcases/kernel/syscalls/cma/process_vm_readv02.c +6 -6
@@ -29,7 +29,7 @@#include "test.h" #include "safe_macros.h" -#include "process_vm.h" +#include "lapi/syscalls.h" char *TCID ="process_vm_readv02" ;int TST_TOTAL =1 ;
@@ -134,7 +134,8 @@ static void child_invoke(void) remote.iov_len = len;tst_resm (TINFO ,"child 1: reading string from same memory location." ); -TEST (test_process_vm_readv (pids[0 ], &local,1 , &remote,1 ,0 )); +TEST (ltp_syscall (__NR_process_vm_readv, pids[0 ], + &local,1 , &remote,1 ,0 ));if (TEST_RETURN != len)tst_brkm (TFAIL |TERRNO , tst_exit,"process_vm_readv" );if (strncmp (lp, tst_string, len) !=0 )
@@ -148,10 +149,9 @@ static void setup(void) {tst_require_root (); -#if !defined(__NR_process_vm_readv) -tst_brkm (TCONF ,NULL ,"process_vm_readv does not exist " -"on your system" ); -#endif +/* Just a sanity check of the existence of syscall */ +ltp_syscall (__NR_process_vm_readv,getpid (),NULL ,0 ,NULL ,0 ,0 ); +tst_tmpdir ();TST_CHECKPOINT_INIT (cleanup);
testcases/kernel/syscalls/cma/process_vm_readv03.c +7 -7
@@ -32,7 +32,7 @@#include "test.h" #include "safe_macros.h" -#include "process_vm.h" +#include "lapi/syscalls.h" char *TCID ="process_vm_readv03" ;int TST_TOTAL =1 ;
@@ -180,7 +180,8 @@ static long *fetch_remote_addrs(void) remote.iov_base = foo; remote.iov_len = len; -TEST (test_process_vm_readv (pids[0 ], &local,1 , &remote,1 ,0 )); +TEST (ltp_syscall (__NR_process_vm_readv, pids[0 ], &local, +1 , &remote,1 ,0 ));if (TEST_RETURN != len)tst_brkm (TFAIL |TERRNO , tst_exit,"process_vm_readv" );
@@ -212,7 +213,7 @@ static void child_invoke(int *bufsz_arr)tst_resm (TINFO ,"child 1: %d local iovecs initialized." ,NUM_LOCAL_VECS ); -TEST (test_process_vm_readv (pids[0 ], local,NUM_LOCAL_VECS , +TEST (ltp_syscall (__NR_process_vm_readv, pids[0 ], local,NUM_LOCAL_VECS , remote, nr_iovecs,0 ));if (TEST_RETURN != bufsz)tst_brkm (TBROK |TERRNO , tst_exit,"process_vm_readv" );
@@ -246,14 +247,13 @@ 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 ); + nr_iovecs = nflag ?SAFE_STRTOL (NULL , nr_opt,1 ,IOV_MAX ) :10 ; bufsz = sflag ?SAFE_STRTOL (NULL , sz_opt,NUM_LOCAL_VECS ,LONG_MAX ) :100000 ; -#if !defined(__NR_process_vm_readv) -tst_brkm (TCONF ,NULL ,"process_vm_readv does not exist " -"on your system" ); -#endif tst_tmpdir ();TST_CHECKPOINT_INIT (cleanup);srand (time (NULL ));
testcases/kernel/syscalls/cma/process_vm_writev02.c +6 -6
@@ -30,7 +30,7 @@#include "test.h" #include "safe_macros.h" -#include "process_vm.h" +#include "lapi/syscalls.h" char *TCID ="process_vm_writev02" ;int TST_TOTAL =1 ;
@@ -171,7 +171,8 @@ static void child_write(void) remote.iov_len = bufsz;tst_resm (TINFO ,"child 2: write to the same memory location." ); -TEST (test_process_vm_writev (pids[0 ], &local,1 , &remote,1 ,0 )); +TEST (ltp_syscall (__NR_process_vm_writev, pids[0 ], &local, +1 , &remote,1 ,0 ));if (TEST_RETURN != bufsz)tst_brkm (TFAIL |TERRNO , tst_exit,"process_vm_readv" ); }
@@ -180,14 +181,13 @@ static void setup(void) {tst_require_root (); +/* Just a sanity check of the existence of syscall */ +ltp_syscall (__NR_process_vm_writev,getpid (),NULL ,0 ,NULL ,0 ,0 ); + bufsz = sflag ?SAFE_STRTOL (NULL , sz_opt,1 ,LONG_MAX -PADDING_SIZE *2 ) :100000 ; -#if !defined(__NR_process_vm_readv) -tst_brkm (TCONF ,NULL ,"process_vm_writev does not exist " -"on your system" ); -#endif tst_tmpdir ();TST_CHECKPOINT_INIT (cleanup);
Signature · 1 line
1.8.3.1
PATCH 1/1 syscalls/cma: test case should return TCONF if syscall doesn't exist
----- Original Message -----
Quoted 6 lines
The original code returns TFAIL when process_vm_readv/_writev syscalls do not exist, while we are expecting a TCONF. During investigation, we find it is due to '#if
defined(__NR_process_vm_readv/_writev)' fails to work as expected. We fix this issue by usingltp_syscall()function in setup function. BTW, we don't use newtst_syscall()interface due to compatibility issue exists between old apis and new ones.
Fine by me, but then you should also add syscall numbers to include/lapi/syscalls:
process_vm01.c: In function ‘setup’:
process_vm01.c:97: warning: unused parameter ‘argv’process_vm01.c: In function ‘cma_test_params_read’:
process_vm01.c:127: error: ‘__NR_process_vm_readv’ undeclared (first use in this function) process_vm01.c:127: error: (Each undeclared identifier is reported only once process_vm01.c:127: error: for each function it appears in.)process_vm01.c: In function ‘cma_test_params_write’:
process_vm01.c:136: error: ‘__NR_process_vm_writev’ undeclared (first use in this function)
Regards,
Jan
PATCH 1/1 syscalls/cma: test case should return TCONF if syscall doesn't exist
Quoted 10 lines · Jan Stancek
----- Original Message -----
Quoted 6 lines
The original code returns TFAIL when process_vm_readv/_writev syscalls do not exist, while we are expecting a TCONF. During investigation, we find it is due to '#if
defined(__NR_process_vm_readv/_writev)' fails to work as expected. We fix this issue by usingltp_syscall()function in setup function. BTW, we don't use newtst_syscall()interface due to compatibility issue exists between old apis and new ones.
Quoted 3 lines
Fine by me, but then you should also add syscall numbers to
include/lapi/syscalls:
Thanks.
I have TWO questions:
1. If I use this command #./strip_syscall.awk /usr/include/asm/unistd_64.h > x86_64.in, it will update and add more new syscall numbers into x86_64.in file which includes many other syscall numbers not only process_vm_readv/_writev. To solve this problem, can I just add the process_vm_readv/_writev syscall numbers and let go of other numbers?
2. I don't have so many types of machines that support different architectures like hppa and s390x. So what should I do to know this syscall number on other architectures. I'm running the tests on x86_64 arch.
Jason
Quoted 12 lines
process_vm01.c: In function ‘setup’:
process_vm01.c:97: warning: unused parameter ‘argv’process_vm01.c: In function ‘cma_test_params_read’:
process_vm01.c:127: error: ‘__NR_process_vm_readv’ undeclared (first use in this function) process_vm01.c:127: error: (Each undeclared identifier is reported only once process_vm01.c:127: error: for each function it appears in.)process_vm01.c: In function ‘cma_test_params_write’:
process_vm01.c:136: error: ‘__NR_process_vm_writev’ undeclared (first use in this function)Regards,
Jan
PATCH 1/1 syscalls/cma: test case should return TCONF if syscall doesn't exist
----- Original Message -----
Quoted 20 lines · Jan Stancek
Quoted 10 lines
----- Original Message -----
Quoted 6 lines
The original code returns TFAIL when process_vm_readv/_writev syscalls do not exist, while we are expecting a TCONF. During investigation, we find it is due to '#if
defined(__NR_process_vm_readv/_writev)' fails to work as expected. We fix this issue by usingltp_syscall()function in setup function. BTW, we don't use newtst_syscall()interface due to compatibility issue exists between old apis and new ones.Quoted 3 lines
Fine by me, but then you should also add syscall numbers to
include/lapi/syscalls:Thanks.
I have TWO questions:
Quoted 6 lines
1. If I use this command #./strip_syscall.awk
/usr/include/asm/unistd_64.h> x86_64.in, it will update and add more new syscall numbers into x86_64.in file which includes many other syscall numbers not only process_vm_readv/_writev. To solve this problem, can I just add the process_vm_readv/_writev syscall numbers and let go of other numbers?
Yes, I think updating only syscalls your patch is touching would be preferred.
Quoted 4 lines
2. I don't have so many types of machines that support different architectures like hppa and s390x. So what should I do to know this syscall number on other architectures. I'm running the tests on
x86_64arch.
You can find it in kernel sources, e.g. grep for it, or usually one of first commits mentioning the syscall will also add number.
Regards,
Jan
Quoted 19 lines
Jason
Quoted 15 lines
process_vm01.c: In function ‘setup’:
process_vm01.c:97: warning: unused parameter ‘argv’process_vm01.c: In function ‘cma_test_params_read’:
process_vm01.c:127: error: ‘__NR_process_vm_readv’ undeclared (first use in this function)
process_vm01.c:127: error: (Each undeclared identifier is reported only once
process_vm01.c:127: error: for each function it appears in.)process_vm01.c: In function ‘cma_test_params_write’:
process_vm01.c:136: error: ‘__NR_process_vm_writev’ undeclared (first use in this function)Regards,
Jan
PATCH v2 1/2 syscalls/cma: test case should return TCONF if syscall doesn't exist
The original code returns TFAIL when process_vm_readv/_writev syscalls do not exist, while we are expecting a TCONF. During investigation, we find it is due to '#if defined(__NR_process_vm_readv/_writev)' fails to work as expected. We fix this issue by using ltp_syscall() function in setup function. BTW, we don't use new tst_syscall() interface due to compatibility issue exists between old apis and new ones.
--- testcases/kernel/syscalls/cma/process_vm.h | 62 ---------------------- testcases/kernel/syscalls/cma/process_vm01.c | 30 ++++------- testcases/kernel/syscalls/cma/process_vm_readv02.c | 12 ++--- testcases/kernel/syscalls/cma/process_vm_readv03.c | 14 ++--- .../kernel/syscalls/cma/process_vm_writev02.c | 12 ++--- 5 files changed, 30 insertions(+), 100 deletions(-) delete mode 100644 testcases/kernel/syscalls/cma/process_vm.h
testcases/kernel/syscalls/cma/process_vm.h deleted +0 -62
@@ -1,62 +0,0 @@ -/* -* Copyright (C) 2012 Linux Test Project, Inc. -* -* This program is free software; you can redistribute it and/or -* modify it under the terms of version 2 of the GNU General Public -* License as published by the Free Software Foundation. -* -* This program is distributed in the hope that it would be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -* -* Further, this software is distributed without any warranty that it -* is free of the rightful claim of any third person regarding -* infringement or the like. Any license provided herein, whether -* implied or otherwise, applies only to this software file. Patent -* licenses, if any, provided herein do not apply to combinations of -* this program with other software, or any other product whatsoever. -* -* You should have received a copy of the GNU General Public License -* along with this program; if not, write the Free Software -* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -* 02110-1301, USA. -*/ - -#ifndef _PROCESS_VM_H_ -#define _PROCESS_VM_H_ - -#include <sys/types.h> -#include <sys/ipc.h> -#include <sys/sem.h> -#include <sys/syscall.h> -#include <sys/uio.h> -#include <unistd.h> -#include "lapi/semun.h" - -static inline ssize_t test_process_vm_readv (pid_t pid, -const struct iovec *lvec,unsigned long liovcnt, -const struct iovec *rvec,unsigned long riovcnt, -unsigned long flags) -{ -#if defined(__NR_process_vm_readv) -return syscall (__NR_process_vm_readv, pid, lvec, liovcnt, - rvec, riovcnt, flags); -#else -return syscall (-1 ); -#endif -} - -static inline ssize_t test_process_vm_writev (pid_t pid, -const struct iovec *lvec,unsigned long liovcnt, -const struct iovec *rvec,unsigned long riovcnt, -unsigned long flags) -{ -#if defined(__NR_process_vm_writev) -return syscall (__NR_process_vm_writev, pid, lvec, liovcnt, - rvec, riovcnt, flags); -#else -return syscall (-1 ); -#endif -} - -#endif /* _PROCESS_VM_H_ */
testcases/kernel/syscalls/cma/process_vm01.c +11 -19
@@ -42,7 +42,7 @@#include "config.h" #include "test.h" #include "safe_macros.h" -#include "process_vm.h" +#include "lapi/syscalls.h" struct process_vm_params {int len;
@@ -103,20 +103,10 @@ static void setup(char *argv[]) " at the same time."); else if (rflag) {TCID = TCID_readv; -#if defined(__NR_process_vm_readv) cma_test_params = cma_test_params_read; -#else -tst_brkm (TCONF ,NULL ,"process_vm_readv does not" -" exist on your system." ); -#endif } else if (wflag) {TCID = TCID_writev; -#if defined(__NR_process_vm_writev) cma_test_params = cma_test_params_write; -#else -tst_brkm (TCONF ,NULL ,"process_vm_writev does not" -" exist on your system." ); -#endif } else tst_brkm(TBROK, NULL, "Parameter missing, required -r or -w.");TEST_PAUSE ;
@@ -134,18 +124,20 @@ static void help(void)static void cma_test_params_read (struct process_vm_params *params) { -TEST (test_process_vm_readv (params->pid, - params->lvec, params->liovcnt, - params->rvec, params->riovcnt, - params->flags)); +TEST (ltp_syscall (__NR_process_vm_readv, + params->pid, + params->lvec, params->liovcnt, + params->rvec, params->riovcnt, + params->flags)); }static void cma_test_params_write (struct process_vm_params *params) { -TEST (test_process_vm_writev (params->pid, - params->lvec, params->liovcnt, - params->rvec, params->riovcnt, - params->flags)); +TEST (ltp_syscall (__NR_process_vm_writev, + params->pid, + params->lvec, params->liovcnt, + params->rvec, params->riovcnt, + params->flags)); }static int cma_check_ret (long expected_ret,long act_ret)
testcases/kernel/syscalls/cma/process_vm_readv02.c +6 -6
@@ -29,7 +29,7 @@#include "test.h" #include "safe_macros.h" -#include "process_vm.h" +#include "lapi/syscalls.h" char *TCID ="process_vm_readv02" ;int TST_TOTAL =1 ;
@@ -134,7 +134,8 @@ static void child_invoke(void) remote.iov_len = len;tst_resm (TINFO ,"child 1: reading string from same memory location." ); -TEST (test_process_vm_readv (pids[0 ], &local,1 , &remote,1 ,0 )); +TEST (ltp_syscall (__NR_process_vm_readv, pids[0 ], + &local,1 , &remote,1 ,0 ));if (TEST_RETURN != len)tst_brkm (TFAIL |TERRNO , tst_exit,"process_vm_readv" );if (strncmp (lp, tst_string, len) !=0 )
@@ -148,10 +149,9 @@ static void setup(void) {tst_require_root (); -#if !defined(__NR_process_vm_readv) -tst_brkm (TCONF ,NULL ,"process_vm_readv does not exist " -"on your system" ); -#endif +/* Just a sanity check of the existence of syscall */ +ltp_syscall (__NR_process_vm_readv,getpid (),NULL ,0 ,NULL ,0 ,0 ); +tst_tmpdir ();TST_CHECKPOINT_INIT (cleanup);
testcases/kernel/syscalls/cma/process_vm_readv03.c +7 -7
@@ -32,7 +32,7 @@#include "test.h" #include "safe_macros.h" -#include "process_vm.h" +#include "lapi/syscalls.h" char *TCID ="process_vm_readv03" ;int TST_TOTAL =1 ;
@@ -180,7 +180,8 @@ static long *fetch_remote_addrs(void) remote.iov_base = foo; remote.iov_len = len; -TEST (test_process_vm_readv (pids[0 ], &local,1 , &remote,1 ,0 )); +TEST (ltp_syscall (__NR_process_vm_readv, pids[0 ], &local, +1 , &remote,1 ,0 ));if (TEST_RETURN != len)tst_brkm (TFAIL |TERRNO , tst_exit,"process_vm_readv" );
@@ -212,7 +213,7 @@ static void child_invoke(int *bufsz_arr)tst_resm (TINFO ,"child 1: %d local iovecs initialized." ,NUM_LOCAL_VECS ); -TEST (test_process_vm_readv (pids[0 ], local,NUM_LOCAL_VECS , +TEST (ltp_syscall (__NR_process_vm_readv, pids[0 ], local,NUM_LOCAL_VECS , remote, nr_iovecs,0 ));if (TEST_RETURN != bufsz)tst_brkm (TBROK |TERRNO , tst_exit,"process_vm_readv" );
@@ -246,14 +247,13 @@ 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 ); + nr_iovecs = nflag ?SAFE_STRTOL (NULL , nr_opt,1 ,IOV_MAX ) :10 ; bufsz = sflag ?SAFE_STRTOL (NULL , sz_opt,NUM_LOCAL_VECS ,LONG_MAX ) :100000 ; -#if !defined(__NR_process_vm_readv) -tst_brkm (TCONF ,NULL ,"process_vm_readv does not exist " -"on your system" ); -#endif tst_tmpdir ();TST_CHECKPOINT_INIT (cleanup);srand (time (NULL ));
testcases/kernel/syscalls/cma/process_vm_writev02.c +6 -6
@@ -30,7 +30,7 @@#include "test.h" #include "safe_macros.h" -#include "process_vm.h" +#include "lapi/syscalls.h" char *TCID ="process_vm_writev02" ;int TST_TOTAL =1 ;
@@ -171,7 +171,8 @@ static void child_write(void) remote.iov_len = bufsz;tst_resm (TINFO ,"child 2: write to the same memory location." ); -TEST (test_process_vm_writev (pids[0 ], &local,1 , &remote,1 ,0 )); +TEST (ltp_syscall (__NR_process_vm_writev, pids[0 ], &local, +1 , &remote,1 ,0 ));if (TEST_RETURN != bufsz)tst_brkm (TFAIL |TERRNO , tst_exit,"process_vm_readv" ); }
@@ -180,14 +181,13 @@ static void setup(void) {tst_require_root (); +/* Just a sanity check of the existence of syscall */ +ltp_syscall (__NR_process_vm_writev,getpid (),NULL ,0 ,NULL ,0 ,0 ); + bufsz = sflag ?SAFE_STRTOL (NULL , sz_opt,1 ,LONG_MAX -PADDING_SIZE *2 ) :100000 ; -#if !defined(__NR_process_vm_readv) -tst_brkm (TCONF ,NULL ,"process_vm_writev does not exist " -"on your system" ); -#endif tst_tmpdir ();TST_CHECKPOINT_INIT (cleanup);
Signature · 1 line
1.8.3.1
PATCH v2 2/2 lapi/syscalls: Add syscall numbers for process_vm_readv/_writev
--- include/lapi/syscalls/aarch64.in | 2 ++ include/lapi/syscalls/arm.in | 2 ++ include/lapi/syscalls/hppa.in | 2 ++ include/lapi/syscalls/i386.in | 2 ++ include/lapi/syscalls/ia64.in | 2 ++ include/lapi/syscalls/powerpc.in | 2 ++ include/lapi/syscalls/powerpc64.in | 2 ++ include/lapi/syscalls/s390.in | 2 ++ include/lapi/syscalls/s390x.in | 2 ++ include/lapi/syscalls/sh.in | 2 ++ include/lapi/syscalls/sparc.in | 2 ++ include/lapi/syscalls/sparc64.in | 2 ++ include/lapi/syscalls/x86_64.in | 2 ++ 13 files changed, 26 insertions(+)
include/lapi/syscalls/aarch64.in +2 -0
@@ -253,6 +253,8 @@ clock_adjtime 266 syncfs 267 setns 268 sendmmsg 269 +process_vm_readv 270 +process_vm_writev 271 kcmp 272 getrandom 278 memfd_create 279
include/lapi/syscalls/arm.in +2 -0
@@ -334,6 +334,8 @@ accept4 (__NR_SYSCALL_BASE+366) fanotify_init (__NR_SYSCALL_BASE+367) fanotify_mark (__NR_SYSCALL_BASE+368) prlimit64 (__NR_SYSCALL_BASE+369) +process_vm_readv(__NR_SYSCALL_BASE+376) +process_vm_writev(__NR_SYSCALL_BASE+377) kcmp (__NR_SYSCALL_BASE+378) sched_setattr (__NR_SYSCALL_BASE+380) sched_getattr (__NR_SYSCALL_BASE+381)
include/lapi/syscalls/hppa.in +2 -0
@@ -16,6 +16,8 @@ faccessat (__NR_openat + 12) splice 291 tee 293 vmsplice 294 +process_vm_readv 330 +process_vm_writev 331 memfd_create 340 membarrier 343 execveat 342
include/lapi/syscalls/i386.in +2 -0
@@ -332,6 +332,8 @@ recvmmsg 337 fanotify_init 338 fanotify_mark 339 prlimit64 340 +process_vm_readv 347 +process_vm_writev 348 kcmp 349 sched_setattr 351 sched_getattr 352
include/lapi/syscalls/ia64.in +2 -0
@@ -293,6 +293,8 @@ recvmmsg 1322 fanotify_init 1323 fanotify_mark 1324 prlimit64 1325 +process_vm_readv 1332 +process_vm_writev 1333 renameat2 1338 getrandom 1339 memfd_create 1340
include/lapi/syscalls/powerpc.in +2 -0
@@ -339,6 +339,8 @@ recvmsg 342 recvmmsg 343 accept4 344 syscalls 345 +process_vm_readv 351 +process_vm_writev 352 kcmp 354 sched_setattr 355 sched_getattr 356
include/lapi/syscalls/powerpc64.in +2 -0
@@ -339,6 +339,8 @@ recvmsg 342 recvmmsg 343 accept4 344 syscalls 345 +process_vm_readv 351 +process_vm_writev 352 kcmp 354 sched_setattr 355 sched_getattr 356
include/lapi/syscalls/s390.in +2 -0
@@ -323,6 +323,8 @@ setgid 214 setfsuid 215 setfsgid 216 newfstatat 293 +process_vm_readv 340 +process_vm_writev 341 kcmp 343 sched_setattr 345 sched_getattr 346
include/lapi/syscalls/s390x.in +2 -0
@@ -323,6 +323,8 @@ setgid 214 setfsuid 215 setfsgid 216 newfstatat 293 +process_vm_readv 340 +process_vm_writev 341 kcmp 343 sched_setattr 345 sched_getattr 346
include/lapi/syscalls/sh.in +2 -0
@@ -360,6 +360,8 @@ accept4 366 fanotify_init 367 fanotify_mark 368 prlimit64 369 +process_vm_readv 376 +process_vm_writev 377 kcmp 378 memfd_create 385 execveat 387
include/lapi/syscalls/sparc.in +2 -0
@@ -330,6 +330,8 @@ recvmmsg 328 fanotify_init 329 fanotify_mark 330 prlimit64 331 +process_vm_readv 338 +process_vm_writev 339 kcmp 341 renameat2 345 getrandom 347
include/lapi/syscalls/sparc64.in +2 -0
@@ -306,6 +306,8 @@ recvmmsg 328 fanotify_init 329 fanotify_mark 330 prlimit64 331 +process_vm_readv 338 +process_vm_writev 339 kcmp 341 renameat2 345 getrandom 347
include/lapi/syscalls/x86_64.in +2 -0
@@ -299,6 +299,8 @@ recvmmsg 299 fanotify_init 300 fanotify_mark 301 prlimit64 302 +process_vm_readv 310 +process_vm_writev 311 kcmp 312 sched_setattr 314 sched_getattr 315
Signature · 1 line
1.8.3.1
PATCH v2 2/2 lapi/syscalls: Add syscall numbers for process_vm_readv/_writev
Hi Jason,
Quoted 3 lines
Signed-off-by Jason Xing <[email protected]>Signed-off-by Caspar Zhang <[email protected]>---
...
include/lapi/syscalls/arm.in accept4 (__NR_SYSCALL_BASE+366) · line 338
Quoted 12 lines
include/lapi/syscalls/aarch64.in +0
-0include/lapi/syscalls/arm.in +2
-0@@ -334,6 +334,8 @@ accept4 (__NR_SYSCALL_BASE+366) fanotify_init (__NR_SYSCALL_BASE+367) fanotify_mark (__NR_SYSCALL_BASE+368) prlimit64 (__NR_SYSCALL_BASE+369) +process_vm_readv(__NR_SYSCALL_BASE+376) +process_vm_writev(__NR_SYSCALL_BASE+377)
This triggered error during generation headers:
invalid line found: process_vm_readv(__NR_SYSCALL_BASE+376) (reproducible by: cd $l/include/lapi/syscalls; ./regen.sh)
and thus build error:../../../../include/lapi/syscalls.h:13: error: unterminated #ifndef
#ifndef __LAPI_SYSCALLS_H__
I fixed it by adding space:
-process_vm_readv(__NR_SYSCALL_BASE+376)
-process_vm_writev(__NR_SYSCALL_BASE+377)
+process_vm_readv (__NR_SYSCALL_BASE+376)
+process_vm_writev (__NR_SYSCALL_BASE+377)
+ put this commit first and pushed.
Thanks for your patches.
Kind regards,
Petr
PATCH v2 2/2 lapi/syscalls: Add syscall numbers for process_vm_readv/_writev
Quoted 29 lines · Petr Vorel
Hi Jason,
Quoted 3 lines
Signed-off-by Jason Xing <[email protected]>Signed-off-by Caspar Zhang <[email protected]>---
...
include/lapi/syscalls/arm.in accept4 (__NR_SYSCALL_BASE+366) · line 338
Quoted 12 lines
include/lapi/syscalls/aarch64.in +0
-0include/lapi/syscalls/arm.in +2
-0@@ -334,6 +334,8 @@ accept4 (__NR_SYSCALL_BASE+366) fanotify_init (__NR_SYSCALL_BASE+367) fanotify_mark (__NR_SYSCALL_BASE+368) prlimit64 (__NR_SYSCALL_BASE+369) +process_vm_readv(__NR_SYSCALL_BASE+376) +process_vm_writev(__NR_SYSCALL_BASE+377)This triggered error during generation headers:
invalid line found:process_vm_readv(__NR_SYSCALL_BASE+376)(reproducible by: cd $l/include/lapi/syscalls; ./regen.sh)and thus build error:
../../../../include/lapi/syscalls.h:13: error: unterminated #ifndef
#ifndef__LAPI_SYSCALLS_H__I fixed it by adding space:
Review
Quoted 6 lines
(quoted diff) +3
-2-process_vm_readv(__NR_SYSCALL_BASE+376) -process_vm_writev(__NR_SYSCALL_BASE+377) +process_vm_readv (__NR_SYSCALL_BASE+376) +process_vm_writev (__NR_SYSCALL_BASE+377) + put this commit first and pushed.
Thanks for your instructions.
Quoted 6 lines
Thanks for your patches.
Kind regards,
Petr
PATCH v2 1/2 syscalls/cma: test case should return TCONF if syscall doesn't exist
In reply to Jason XingHi 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.
--------------------------------
# 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_O2process_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 brokenprocess_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_O0process_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
Signature · 5 lines
Regards, Li Wang -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.linux.it/pipermail/ltp/attachments/20190215/02b113eb/attachment-0001.html>
PATCH v2 1/2 syscalls/cma: test case should return TCONF if syscall doesn't exist
----- Original Message -----
Quoted 10 lines
Hi Jason,
A new failure was occured after applying this new patch.
From our observation, the latest
process_vm_readv03.cfailed withprocess_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
testcases/kernel/syscalls/cma/process_vm_readv03.c +0 -0
@@ -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)
Quoted 57 lines
--------------------------------
# gcc -g -O2 -g -O2 -fno-strict-aliasing -pipe -Wall -W(quoted diff) +0
-2-Wold-style-definition -D_FORTIFY_SOURCE=2 -I../../../../include -I../../../../include -I../../../../include/old/ -L../../../../lib
process_vm_readv03.c-lltp -oprocess_vm_readv03_O2# ./process_vm_readv03_O2
process_vm_readv030 TINFO : child 0: 10 iovecs allocated and initialized.process_vm_readv030 TINFO : child 1: 10 remote iovecs received.process_vm_readv030 TINFO : child 1: 4 local iovecs initialized.process_vm_readv031 TBROK : process_vm_readv03.c:220:process_vm_readv:
errno=EINVAL(22): Invalid argumentprocess_vm_readv032 TBROK : process_vm_readv03.c:220: Remaining cases brokenprocess_vm_readv031 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(quoted diff) +0
-2-Wold-style-definition -D_FORTIFY_SOURCE=2 -I../../../../include -I../../../../include -I../../../../include/old/ -L../../../../lib
process_vm_readv03.c-lltp -oprocess_vm_readv03_O0# ./process_vm_readv03_O0
process_vm_readv030 TINFO : child 0: 10 iovecs allocated and initialized.process_vm_readv030 TINFO : child 1: 10 remote iovecs received.process_vm_readv030 TINFO : child 1: 4 local iovecs initialized.process_vm_readv031 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
Quoted 6 lines
# 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>
PATCH v2 1/2 syscalls/cma: test case should return TCONF if syscall doesn't exist
Quoted 16 lines · Jan Stancek
------------------------------
Hi Jason,
A new failure was occured after applying this new patch.
From our observation, the latest
process_vm_readv03.cfailed withprocess_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.
Quoted 2 lines
One difference is that the extra function promoted int to long.
Good catch.
Quoted 6 lines
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)This change works for me(one comment in below).
But there still have a tiny question, in the syscall tracing log, I noticed a process_vm_readv() calling does not get this failure in function fetch_remote_addrs, what makes it difference with other two calls is something I'm thinking now.
====Tracing log without '0L' change====
12211 process_vm_readv(12211, 0, 0, 0, 0, 140728898420736) = -1 EINVAL (Invalid argument)
...
12213 process_vm_readv(12212, [{"\300\334\0\0\0\0\0\2\335\0\0\0\0\0\340\26\335\0\0\0\0\0\220h\335\0\0\0\0\0"..., 80}], 1, [{0xdc6060, 80}], 1, 0) = 80
...
12213 process_vm_readv(12212, 0x7ffecef1e330, 4, 0xdc60c0, 10, 140728898420736) = -1 EINVAL (Invalid argument)
testcases/kernel/syscalls/cma/process_vm_readv03.c static long *fetch_remote_addrs(void) · line 185
Quoted 13 lines
testcases/kernel/syscalls/cma/process_vm_readv03.c +1
-1@@ -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 ));
To make things more safely, probably we'd better change all the integer parameter too?
- 1, &remote, 1, 0));
+ 1L, &remote, 1L, 0L));
Signature · 5 lines
Regards, Li Wang -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.linux.it/pipermail/ltp/attachments/20190216/ba233afa/attachment-0001.html>
PATCH v2 1/2 syscalls/cma: test case should return TCONF if syscall doesn't exist
----- Original Message -----
Quoted 28 lines · Jan Stancek
Quoted 17 lines
------------------------------
Hi Jason,
A new failure was occured after applying this new patch.
From our observation, the latest
process_vm_readv03.cfailed withprocess_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.Quoted 2 lines
One difference is that the extra function promoted int to long.
Good catch.
Quoted 5 lines
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)
Quoted 6 lines
Quoted 1 line
This change works for me(one comment in below).
But there still have a tiny question, in the syscall tracing log, I noticed a
process_vm_readv()calling does not get this failure in functionfetch_remote_addrs, what makes it difference with other two calls is something I'm thinking now.
"Garbage" on stack most likely. On x86_64, 6th parameter is passed via stack, glibc copies quadword:
ENTRY (syscall)
movq %rdi, %rax /* Syscall number -> rax. */
movq %rsi, %rdi /* shift arg1 - arg5. */
movq %rdx, %rsi
movq %rcx, %rdx
movq %r8, %r10
movq %r9, %r8
movq 8(%rsp),%r9 /* arg6 is on the stack. */
syscall /* Do the system call. */
Quoted 31 lines
====Tracing log without '0L' change====
12211process_vm_readv(12211, 0, 0, 0, 0, 140728898420736)= -1 EINVAL (Invalid argument)
...
12213 process_vm_readv(12212, [{"\300\334\0\0\0\0\0\2\335\0\0\0\0\0\340\26\335\0\0\0\0\0\220h\335\0\0\0\0\0"..., 80}], 1, [{0xdc6060, 80}], 1, 0) = 80
...
12213process_vm_readv(12212, 0x7ffecef1e330, 4, 0xdc60c0, 10, 140728898420736)= -1 EINVAL (Invalid argument)testcases/kernel/syscalls/cma/process_vm_readv03.c static long *fetch_remote_addrs(void) · line 185
Quoted 13 lines
testcases/kernel/syscalls/cma/process_vm_readv03.c +1
-1@@ -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 ));To make things more safely, probably we'd better change all the integer parameter too?
Review
Quoted 2 lines
(quoted diff) +1
-1- 1, &remote, 1, 0)); + 1L, &remote, 1L, 0L));
Agreed, let's match all parameters types as before commit:
9b02cd465f70 ("syscalls/cma: test case should return TCONF if syscall doesn't exist")
Quoted 5 lines
--
Regards,
Li Wang
PATCH v2 1/2 syscalls/cma: test case should return TCONF if syscall doesn't exist
----- Original Message -----
Quoted 83 lines
----- Original Message -----
Quoted 29 lines · Jan Stancek
Quoted 18 lines
------------------------------
Hi Jason,
A new failure was occured after applying this new patch.
From our observation, the latest
process_vm_readv03.cfailed withprocess_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.Quoted 2 lines
One difference is that the extra function promoted int to long.
Good catch.
Quoted 5 lines
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)Quoted 6 lines
Quoted 1 line
This change works for me(one comment in below).
But there still have a tiny question, in the syscall tracing log, I noticed a
process_vm_readv()calling does not get this failure in functionfetch_remote_addrs, what makes it difference with other two calls is something I'm thinking now."Garbage" on stack most likely. On
x86_64, 6th parameter is passed via stack, glibc copies quadword:ENTRY (syscall)
movq %rdi, %rax /* Syscall number -> rax. */
movq %rsi, %rdi /* shift arg1 - arg5. */
movq %rdx, %rsi
movq %rcx, %rdx
movq %r8, %r10
movq %r9, %r8
movq 8(%rsp),%r9 /* arg6 is on the stack. */
syscall /* Do the system call. */Quoted 31 lines
====Tracing log without '0L' change====
12211process_vm_readv(12211, 0, 0, 0, 0, 140728898420736)= -1 EINVAL (Invalid argument)
...
12213 process_vm_readv(12212, [{"\300\334\0\0\0\0\0\2\335\0\0\0\0\0\340\26\335\0\0\0\0\0\220h\335\0\0\0\0\0"..., 80}], 1, [{0xdc6060, 80}], 1, 0) = 80
...
12213process_vm_readv(12212, 0x7ffecef1e330, 4, 0xdc60c0, 10, 140728898420736)= -1 EINVAL (Invalid argument)testcases/kernel/syscalls/cma/process_vm_readv03.c static long *fetch_remote_addrs(void) · line 185
Quoted 13 lines
testcases/kernel/syscalls/cma/process_vm_readv03.c +1
-1@@ -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 ));To make things more safely, probably we'd better change all the integer parameter too?
Quoted 6 lines
Review
Quoted 2 lines
(quoted diff) +1
-1- 1, &remote, 1, 0)); + 1L, &remote, 1L, 0L));Agreed, let's match all parameters types as before commit:
9b02cd465f70("syscalls/cma: test case should return TCONF if syscall doesn't exist")
So, it looks like this thread has stalled. I'll look into posting a patch, unless I hear someone is already working on it.
Regards,
Jan
Quoted 7 lines
Quoted 6 lines
--
Regards,
Li Wang
PATCH v2 1/2 syscalls/cma: test case should return TCONF if syscall doesn't exist
Quoted 3 lines · Jan Stancek
----- Original Message -----
[snip]
Quoted 19 lines
Quoted 19 lines
Quoted 18 lines
testcases/kernel/syscalls/cma/process_vm_readv03.c static long *fetch_remote_addrs(void) · line 185
Quoted 12 lines
testcases/kernel/syscalls/cma/process_vm_readv03.c +1
-1@@ -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 ));To make things more safely, probably we'd better change all the integer parameter too?
(quoted diff) +1
-1- 1, &remote, 1, 0)); + 1L, &remote, 1L, 0L));
Quoted 6 lines
Quoted 3 lines
Agreed, let's match all parameters types as before commit:
9b02cd465f70("syscalls/cma: test case should return TCONF if syscall doesn't exist")So, it looks like this thread has stalled. I'll look into posting a patch, unless I hear someone is already working on it.
Hi Jan,
Jason told me he was looking into it, I'll double confirm with him about the progress. Will update ASAP.
Thanks,
Caspar
PATCH 1/1 syscalls/cma: fix the failure of compiling with O2 option
This issue is triggered by the commit 9b02cd465f70 which I wrote. If compile the process_vm_readv03.c with O2 option and run, it will return TFAIL. By casting the int type to long type in the ltp_syscall calling functions can we avoid this failure.
--- testcases/kernel/syscalls/cma/process_vm_readv03.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
testcases/kernel/syscalls/cma/process_vm_readv03.c +4 -4
@@ -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 )); +1L , &remote,1L ,0L ));if (TEST_RETURN != len)tst_brkm (TFAIL |TERRNO , tst_exit,"process_vm_readv" );
@@ -213,8 +213,8 @@ static void child_invoke(int *bufsz_arr)tst_resm (TINFO ,"child 1: %d local iovecs initialized." ,NUM_LOCAL_VECS ); -TEST (ltp_syscall (__NR_process_vm_readv, pids[0 ], local,NUM_LOCAL_VECS , - remote, nr_iovecs,0 )); +TEST (ltp_syscall (__NR_process_vm_readv, pids[0 ], local, (long )NUM_LOCAL_VECS , + remote, (long )nr_iovecs,0L ));if (TEST_RETURN != bufsz)tst_brkm (TBROK |TERRNO , tst_exit,"process_vm_readv" );
@@ -248,7 +248,7 @@ 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 ,0L ,NULL ,0L ,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)
Signature · 1 line
1.8.3.1
PATCH 1/1 syscalls/cma: fix the failure of compiling with O2 option
Quoted 25 lines · Jason Xing
This issue is triggered by the commit
9b02cd465f70which I wrote. If compile theprocess_vm_readv03.cwith O2 option and run, it will return TFAIL. By casting the int type to long type in theltp_syscallcalling functions can we avoid this failure.Signed-off-by Jason Xing <[email protected]>--- testcases/kernel/syscalls/cma/process_vm_readv03.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)testcases/kernel/syscalls/cma/process_vm_readv03.c +1
-1@@ -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 )); +1L , &remote,1L ,0L ));if (TEST_RETURN != len)tst_brkm (TFAIL |TERRNO , tst_exit,"process_vm_readv" );
testcases/kernel/syscalls/cma/process_vm_readv03.c static void child_invoke(int *bufsz_arr) · line 220
Quoted 10 lines
testcases/kernel/syscalls/cma/process_vm_readv03.c +2
-2@@ -213,8 +213,8 @@ static void child_invoke(int *bufsz_arr)tst_resm (TINFO ,"child 1: %d local iovecs initialized." ,NUM_LOCAL_VECS ); -TEST (ltp_syscall (__NR_process_vm_readv, pids[0 ], local,NUM_LOCAL_VECS , - remote, nr_iovecs,0 )); +TEST (ltp_syscall (__NR_process_vm_readv, pids[0 ], local, (long )NUM_LOCAL_VECS , + remote, (long )nr_iovecs,0L ));
Maybe cast them into 'unsigned long' type is better? otherwise this patch LGTM.
Cut from linux manual page:
------------------ssize_t process_vm_readv(pid_t pid,
const struct iovec *local_iov, unsigned long liovcnt, const struct iovec *remote_iov, unsigned long riovcnt, unsigned long flags);
Signature · 5 lines
Regards, Li Wang -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.linux.it/pipermail/ltp/attachments/20190225/b534ae24/attachment.html>
PATCH 1/1 syscalls/cma: fix the failure of compiling with O2 option
In reply to Jason Xing----- Original Message -----
Quoted 8 lines
This issue is triggered by the commit
9b02cd465f70which I wrote. If compile theprocess_vm_readv03.cwith O2 option and run, it will return TFAIL. By casting the int type to long type in theltp_syscallcalling functions can we avoid this failure.Signed-off-by Jason Xing <[email protected]>--- testcases/kernel/syscalls/cma/process_vm_readv03.c | 8 ++++----
What about other tests that were changed by commit 9b02cd465f70 ?
Quoted 41 lines
1 file changed, 4 insertions(+), 4 deletions(-)testcases/kernel/syscalls/cma/process_vm_readv03.c +4
-5@@ -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 )); +1L , &remote,1L ,0L ));if (TEST_RETURN != len)tst_brkm (TFAIL |TERRNO , tst_exit,"process_vm_readv" );@@ -213,8 +213,8 @@ static void child_invoke(int *bufsz_arr)tst_resm (TINFO ,"child 1: %d local iovecs initialized." ,NUM_LOCAL_VECS ); -TEST (ltp_syscall (__NR_process_vm_readv, pids[0 ], local,NUM_LOCAL_VECS , - remote, nr_iovecs,0 )); +TEST (ltp_syscall (__NR_process_vm_readv, pids[0 ], local, (long )NUM_LOCAL_VECS , + remote, (long )nr_iovecs,0L ));if (TEST_RETURN != bufsz)tst_brkm (TBROK |TERRNO , tst_exit,"process_vm_readv" );@@ -248,7 +248,7 @@ 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 ,0L ,NULL ,0L ,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) --1.8.3.1
PATCH 1/1 syscalls/cma: fix the failure of compiling with O2 option
Quoted 8 lines · Jan Stancek
----- Original Message -----
Quoted 5 lines
This issue is triggered by the commit
9b02cd465f70which I wrote. If compile theprocess_vm_readv03.cwith O2 option and run, it will return TFAIL. By casting the int type to long type in theltp_syscallcalling functions can we avoid this failure.
Quoted 5 lines
Quoted 3 lines
Signed-off-by Jason Xing <[email protected]>--- testcases/kernel/syscalls/cma/process_vm_readv03.c | 8 ++++----What about other tests that were changed by commit
9b02cd465f70?
I downgraded my glibc from 2.17-196 (a centos 7.4 version) to 2.17-157 was able to reproduce this issue. I also tried modifying the params in all TEST(ltp_syscall(__NR_process_vm... calls, seemd that this is the only one causes (and solves) the failure:
TEST(ltp_syscall(__NR_process_vm_readv, pids[0], local, NUM_LOCAL_VECS,
- remote, nr_iovecs, 0));
+ remote, nr_iovecs, 0UL));
If we have enough time we might want to do a bisect between glibc-2.17-157 and 196 to dig into the real problem behind the simple fix, but for now I'm agree to convert all int params to correct unsigned long changed by this commit, so that we can get rid of any potential failures.
Jason, can you make an updated patch to include Li Wang's and Jan's advices?
Thanks,
Caspar
PATCH v2 1/1 syscalls/cma: fix the failure of compiling with O2 option
This issue is triggered by the commit 9b02cd465f70 which I wrote. If compile the process_vm_readv03.c with O2 option and run, it will return TFAIL. By casting the int type to unsigned long type in the ltp_syscall calling functions can we avoid this failure.
--- testcases/kernel/syscalls/cma/process_vm_readv03.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
testcases/kernel/syscalls/cma/process_vm_readv03.c +5 -4
@@ -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 )); +1UL , &remote,1UL ,0UL ));if (TEST_RETURN != len)tst_brkm (TFAIL |TERRNO , tst_exit,"process_vm_readv" );
@@ -213,8 +213,9 @@ static void child_invoke(int *bufsz_arr)tst_resm (TINFO ,"child 1: %d local iovecs initialized." ,NUM_LOCAL_VECS ); -TEST (ltp_syscall (__NR_process_vm_readv, pids[0 ], local,NUM_LOCAL_VECS , - remote, nr_iovecs,0 )); +TEST (ltp_syscall (__NR_process_vm_readv, pids[0 ], local, + (unsigned long )NUM_LOCAL_VECS , remote, + (unsigned long )nr_iovecs,0UL ));if (TEST_RETURN != bufsz)tst_brkm (TBROK |TERRNO , tst_exit,"process_vm_readv" );
@@ -248,7 +249,7 @@ 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 ,0UL ,NULL ,0UL ,0UL ); nr_iovecs = nflag ?SAFE_STRTOL (NULL , nr_opt,1 ,IOV_MAX ) :10 ; bufsz = sflag ? SAFE_STRTOL(NULL, sz_opt, NUM_LOCAL_VECS, LONG_MAX)
Signature · 1 line
1.8.3.1
PATCH v3 1/1 syscalls/cma: fix the failure of compiling with O2 option
This issue is triggered by the commit 9b02cd465f70 which I wrote. If compile the process_vm_readv03.c with O2 option and run, it will return TFAIL. By casting the int type to unsigned long type in the ltp_syscall calling functions can we avoid this failure. Thus I modify all the testcases which might be affected by the previous commit.
--- testcases/kernel/syscalls/cma/process_vm_readv02.c | 4 ++-- testcases/kernel/syscalls/cma/process_vm_readv03.c | 9 +++++---- testcases/kernel/syscalls/cma/process_vm_writev02.c | 4 ++-- 3 files changed, 9 insertions(+), 8 deletions(-)
testcases/kernel/syscalls/cma/process_vm_readv02.c +2 -2
@@ -135,7 +135,7 @@ static void child_invoke(void)tst_resm (TINFO ,"child 1: reading string from same memory location." );TEST (ltp_syscall (__NR_process_vm_readv, pids[0 ], - &local,1 , &remote,1 ,0 )); + &local,1UL , &remote,1UL ,0UL ));if (TEST_RETURN != len)tst_brkm (TFAIL |TERRNO , tst_exit,"process_vm_readv" );if (strncmp (lp, tst_string, len) !=0 )
@@ -150,7 +150,7 @@ 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 ,0UL ,NULL ,0UL ,0UL );tst_tmpdir ();TST_CHECKPOINT_INIT (cleanup);
testcases/kernel/syscalls/cma/process_vm_readv03.c +5 -4
@@ -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 )); +1UL , &remote,1UL ,0UL ));if (TEST_RETURN != len)tst_brkm (TFAIL |TERRNO , tst_exit,"process_vm_readv" );
@@ -213,8 +213,9 @@ static void child_invoke(int *bufsz_arr)tst_resm (TINFO ,"child 1: %d local iovecs initialized." ,NUM_LOCAL_VECS ); -TEST (ltp_syscall (__NR_process_vm_readv, pids[0 ], local,NUM_LOCAL_VECS , - remote, nr_iovecs,0 )); +TEST (ltp_syscall (__NR_process_vm_readv, pids[0 ], local, + (unsigned long )NUM_LOCAL_VECS , remote, + (unsigned long )nr_iovecs,0UL ));if (TEST_RETURN != bufsz)tst_brkm (TBROK |TERRNO , tst_exit,"process_vm_readv" );
@@ -248,7 +249,7 @@ 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 ,0UL ,NULL ,0UL ,0UL ); nr_iovecs = nflag ?SAFE_STRTOL (NULL , nr_opt,1 ,IOV_MAX ) :10 ; bufsz = sflag ? SAFE_STRTOL(NULL, sz_opt, NUM_LOCAL_VECS, LONG_MAX)
testcases/kernel/syscalls/cma/process_vm_writev02.c +2 -2
@@ -172,7 +172,7 @@ static void child_write(void)tst_resm (TINFO ,"child 2: write to the same memory location." );TEST (ltp_syscall (__NR_process_vm_writev, pids[0 ], &local, -1 , &remote,1 ,0 )); +1UL , &remote,1UL ,0UL ));if (TEST_RETURN != bufsz)tst_brkm (TFAIL |TERRNO , tst_exit,"process_vm_readv" ); }
@@ -182,7 +182,7 @@ static void setup(void)tst_require_root ();/* Just a sanity check of the existence of syscall */ -ltp_syscall (__NR_process_vm_writev,getpid (),NULL ,0 ,NULL ,0 ,0 ); +ltp_syscall (__NR_process_vm_writev,getpid (),NULL ,0UL ,NULL ,0UL ,0UL ); bufsz = sflag ? SAFE_STRTOL(NULL, sz_opt, 1, LONG_MAX - PADDING_SIZE * 2)
Signature · 1 line
1.8.3.1
PATCH v3 1/1 syscalls/cma: fix the failure of compiling with O2 option
Quoted 8 lines · Jason Xing
This issue is triggered by the commit
9b02cd465f70which I wrote. If compile theprocess_vm_readv03.cwith O2 option and run, it will return TFAIL. By casting the int type to unsigned long type in theltp_syscallcalling functions can we avoid this failure. Thus I modify all the testcases which might be affected by the previous commit.Signed-off-by Jason Xing <[email protected]>
Signature · 5 lines
Regards, Li Wang -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.linux.it/pipermail/ltp/attachments/20190226/a7ad216d/attachment.html>
PATCH v3 1/1 syscalls/cma: fix the failure of compiling with O2 option
In reply to Jason Xing----- Original Message -----
Quoted 7 lines
This issue is triggered by the commit
9b02cd465f70which I wrote. If compile theprocess_vm_readv03.cwith O2 option and run, it will return TFAIL. By casting the int type to unsigned long type in theltp_syscallcalling functions can we avoid this failure. Thus I modify all the testcases which might be affected by the previous commit.Signed-off-by Jason Xing <[email protected]>
Pushed.
Thanks,
Jan
PATCH 1/1 syscalls/cma: fix the failure of compiling with O2 option
In reply to Jan StancekQuoted 8 lines · Jan Stancek
----- Original Message -----
Quoted 5 lines
This issue is triggered by the commit
9b02cd465f70which I wrote. If compile theprocess_vm_readv03.cwith O2 option and run, it will return TFAIL. By casting the int type to long type in theltp_syscallcalling functions can we avoid this failure.
Quoted 6 lines
Quoted 3 lines
Signed-off-by Jason Xing <[email protected]>--- testcases/kernel/syscalls/cma/process_vm_readv03.c | 8 ++++----What about other tests that were changed by commit
9b02cd465f70?
After testing all the process_vm_* cases with O0 and O2 options, we find that only process_vm_readv03 encounters this problem.
Quoted 41 lines
Quoted 41 lines
1 file changed, 4 insertions(+), 4 deletions(-)testcases/kernel/syscalls/cma/process_vm_readv03.c +4
-5@@ -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 )); +1L , &remote,1L ,0L ));if (TEST_RETURN != len)tst_brkm (TFAIL |TERRNO , tst_exit,"process_vm_readv" );@@ -213,8 +213,8 @@ static void child_invoke(int *bufsz_arr)tst_resm (TINFO ,"child 1: %d local iovecs initialized." ,NUM_LOCAL_VECS ); -TEST (ltp_syscall (__NR_process_vm_readv, pids[0 ], local,NUM_LOCAL_VECS , - remote, nr_iovecs,0 )); +TEST (ltp_syscall (__NR_process_vm_readv, pids[0 ], local, (long )NUM_LOCAL_VECS , + remote, (long )nr_iovecs,0L ));if (TEST_RETURN != bufsz)tst_brkm (TBROK |TERRNO , tst_exit,"process_vm_readv" );@@ -248,7 +248,7 @@ 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 ,0L ,NULL ,0L ,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) --1.8.3.1