syscalls/cma: write also null term. byte to address pipe
PATCH 1/1 syscalls/cma: write also null term. byte to address pipe
Problem is that first child doesn't write null term. byte and other child doesn't initialise buffer it reads into, so occasionally there's garbage that makes address longer and therefore invalid and test fails:
process_vm_readv02 0 TINFO : child 1: reading string from same memory location. process_vm_readv02 1 TFAIL : process_vm_readv02.c:143: process_vm_readv: errno=EFAULT(14): Bad address process_vm_readv02 0 TINFO : child 0: memory allocated and initialized. process_vm_readv02 1 TFAIL : process_vm_readv02.c:86: child 1 returns 256
Signed-off-by Jan Stancek <[email protected]>
--- testcases/kernel/syscalls/cma/process_vm_readv02.c | 2 +- testcases/kernel/syscalls/cma/process_vm_readv03.c | 2 +- testcases/kernel/syscalls/cma/process_vm_writev02.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
testcases/kernel/syscalls/cma/process_vm_readv02.c +1 -1
@@ -107,7 +107,7 @@ static void child_alloc(void)/* passing addr of string "foo" via pipe */ SAFE_CLOSE (tst_exit, pipe_fd[0 ]);snprintf (buf,BUFSIZ ,"%p" , foo); -SAFE_WRITE (tst_exit,1 , pipe_fd[1 ], buf,strlen (buf)); +SAFE_WRITE (tst_exit,1 , pipe_fd[1 ], buf,strlen (buf) +1 );SAFE_CLOSE (tst_exit, pipe_fd[1 ]);/* wait until child_invoke is done reading from our VM */
testcases/kernel/syscalls/cma/process_vm_readv03.c +1 -1
@@ -152,7 +152,7 @@ static void child_alloc(int *bufsz_arr)/* passing addr via pipe */ SAFE_CLOSE (tst_exit, pipe_fd[0 ]);snprintf (buf,BUFSIZ ,"%p" , (void *)foo); -SAFE_WRITE (tst_exit,1 , pipe_fd[1 ], buf,strlen (buf)); +SAFE_WRITE (tst_exit,1 , pipe_fd[1 ], buf,strlen (buf) +1 );SAFE_CLOSE (tst_exit, pipe_fd[1 ]);/* wait until child_invoke is done reading from our VM */
testcases/kernel/syscalls/cma/process_vm_writev02.c +1 -1
@@ -121,7 +121,7 @@ static void child_init_and_verify(void)/* passing addr of string "foo" via pipe */ SAFE_CLOSE (tst_exit, pipe_fd[0 ]);snprintf (buf, bufsz,"%p" , foo); -SAFE_WRITE (tst_exit,1 , pipe_fd[1 ], buf,strlen (buf)); +SAFE_WRITE (tst_exit,1 , pipe_fd[1 ], buf,strlen (buf) +1 );SAFE_CLOSE (tst_exit, pipe_fd[1 ]);/* wait until child_write() is done writing to our VM */
Signature · 1 line
1.8.3.1
PATCH 1/1 syscalls/cma: write also null term. byte to address pipe
Hi!
Looks obviously correct to me.
Signature · 2 lines
Cyril Hrubis [email protected]
PATCH 1/1 syscalls/cma: write also null term. byte to address pipe
----- Original Message -----
Quoted 2 lines
Hi!
Looks obviously correct to me.
Pushed.
Regards,
Jan