public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Jan Stancek <jstancek@redhat.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v3 3/3] syscalls/ioctl_ns0[156]: align stack and wait for child
Date: Thu, 13 Jun 2019 06:16:28 -0400 (EDT)	[thread overview]
Message-ID: <1320546599.27920597.1560420988025.JavaMail.zimbra@redhat.com> (raw)
In-Reply-To: <CAEemH2frt_zGSdSRL3d_J+km74p8ruQTNF6bVhEpaiTdMLCC6A@mail.gmail.com>



----- Original Message -----
> On Thu, Jun 13, 2019 at 3:25 PM Jan Stancek <jstancek@redhat.com> wrote:
> 
> > Test crashes (SIGBUS) when using child stack have been observed for
> > ioctl_ns01. This is because stack isn't aligned. Use ltp_alloc_stack()
> > for stack allocation.
> >
> > Add SIGCHLD to clone flags, so that LTP library can reap all children
> > and check their return code.  Also check ltp_clone() return value.
> >
> > Suppress warning for unused *arg in child().
> >
> > Signed-off-by: Jan Stancek <jstancek@redhat.com>
> > ---
> >  testcases/kernel/syscalls/ioctl/ioctl_ns01.c | 13 +++++++++----
> >  testcases/kernel/syscalls/ioctl/ioctl_ns05.c | 12 +++++++++---
> >  testcases/kernel/syscalls/ioctl/ioctl_ns06.c | 15 +++++++++++----
> >  3 files changed, 29 insertions(+), 11 deletions(-)
> >
> > diff --git a/testcases/kernel/syscalls/ioctl/ioctl_ns01.c
> > b/testcases/kernel/syscalls/ioctl/ioctl_ns01.c
> > index dfde4da6c5d6..d241a5d0fa53 100644
> > --- a/testcases/kernel/syscalls/ioctl/ioctl_ns01.c
> > +++ b/testcases/kernel/syscalls/ioctl/ioctl_ns01.c
> > @@ -23,7 +23,7 @@
> >
> >  #define STACK_SIZE (1024 * 1024)
> >
> > -static char child_stack[STACK_SIZE];
> > +static char *child_stack;
> >
> >  static void setup(void)
> >  {
> > @@ -31,6 +31,10 @@ static void setup(void)
> >
> >         if (exists < 0)
> >                 tst_res(TCONF, "namespace not available");
> > +
> > +       child_stack = ltp_alloc_stack(STACK_SIZE);
> >
> 
> As you commented that "User is responsible for freeing allocated memory",
> but you forget to do that in each of these test cases :).

I omitted it on purpose. OS will clean it up on exit, since it's called
only in setup() it's not going to keep leaking more memory.

> 
> We need free(child_stack) in the cleanup function.

Can you elaborate?

> 
> --
> Regards,
> Li Wang
> 

  reply	other threads:[~2019-06-13 10:16 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-13  7:23 [LTP] [PATCH v3 1/3] lib: add ltp_alloc_stack() Jan Stancek
2019-06-13  7:24 ` [LTP] [PATCH v3 2/3] lib: rename ltp_clone_malloc to ltp_clone_alloc Jan Stancek
2019-06-13  8:55   ` Li Wang
2019-06-13 13:57     ` Cyril Hrubis
2019-06-14  2:46       ` Li Wang
2019-06-14 15:24         ` Cyril Hrubis
2019-06-13  7:24 ` [LTP] [PATCH v3 3/3] syscalls/ioctl_ns0[156]: align stack and wait for child Jan Stancek
2019-06-13  8:25   ` Li Wang
2019-06-13 10:16     ` Jan Stancek [this message]
2019-06-13 11:26       ` Li Wang
2019-06-13 14:17       ` Cyril Hrubis
2019-06-13 14:57         ` Jan Stancek
2019-06-13 15:14           ` Cyril Hrubis
2019-06-16  7:34             ` Jan Stancek
2019-06-17  8:50               ` Cyril Hrubis
2019-06-17 14:38                 ` Jan Stancek
2019-06-18 16:00                   ` Amir Goldstein

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=1320546599.27920597.1560420988025.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