All of lore.kernel.org
 help / color / mirror / Atom feed
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: Sat, 16 Feb 2019 05:28:05 -0500 (EST)	[thread overview]
Message-ID: <1937154233.1109562.1550312885136.JavaMail.zimbra@redhat.com> (raw)
In-Reply-To: <CAEemH2cFhdjMMF9RTyRHTBcLR7SqXNWNf41R+RLbdOY7CBOwpQ@mail.gmail.com>



----- Original Message -----
> On Fri, Feb 15, 2019 at 9:53 PM Jan Stancek <jstancek@redhat.com> wrote:
> 
> >
> >
> > ------------------------------
> >
> > 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.
> >
> 
> Good catch.
> 
> > 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.

"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.  */

> 
> ====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)
> 
> 
> 
> >
> > 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));
> >
> 
> To make things more safely, probably we'd better change all the integer
> parameter too?
> 
> -                        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")

> 
> --
> Regards,
> Li Wang
> 

  reply	other threads:[~2019-02-16 10:28 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
2019-02-16  7:18             ` Li Wang
2019-02-16 10:28               ` Jan Stancek [this message]
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=1937154233.1109562.1550312885136.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.