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 v2] mtest06/mmap1: rewrite to newlib
Date: Tue, 27 Nov 2018 03:54:42 -0500 (EST)	[thread overview]
Message-ID: <1068520574.79012810.1543308882560.JavaMail.zimbra@redhat.com> (raw)
In-Reply-To: <CAEemH2eOUxC+M17kagF=9fOPeEBHJFEFYYBO20LnhUtwa+qmNA@mail.gmail.com>


----- Original Message -----
> On Mon, Nov 26, 2018 at 4:21 PM Jan Stancek <jstancek@redhat.com> wrote:
> 
> > +static void sig_handler(int signal, siginfo_t *info,
> > +       LTP_ATTRIBUTE_UNUSED void *ut)
> > +{
> > +       int ar_m, ar_u;
> > +
> > +       switch (signal) {
> > +       case SIGSEGV:
> > +               /* if we hit SIGSEGV between map/unmap, something is wrong
> > */
> > +               ar_u = tst_atomic_load(&unmapcnt);
> > +               ar_m = tst_atomic_load(&mapcnt);
> > +               if (was_area_mapped(br_map, br_unmap, ar_m, ar_u)) {
> > +                       tst_res(TFAIL, "got sigsegv while mapped");
> > +                       _exit(TFAIL);
> 
> why not use tst_brk() here?

Because it calls exit(), which is not advised to do in signal handler.
(doc/test-writing-guidelines.txt, line 841)

> 
> > +               }
> > +
> > +               mapped_sigsegv_count++;
> > +               longjmp(jmpbuf, 1);
> > +               break;
> > +       default:
> > +               tst_res(TFAIL, "Unexpected signal - %d, addr: %p,
> > exiting\n",
> > +                       signal, info->si_addr);
> > +               _exit(TBROK);
> 
> tst_brk() ?
> 
> > +       }
> > +}
> > +
> > +void *map_write_unmap(void *ptr)
> > +{
> > +       long *args = ptr;
> > +       void *tmp;
> 
> remove tmp pointer?

It introduces warning in safe_munmap(), because map_address is volatile.
That is why I kept 'tmp'.

> 
> Beside these tiny issues, patch v2 looks good to me.
> 
> Reviewed-by: Li Wang <liwang@redhat.com>

Thanks,
Jan

> 
> --
> Regards,
> Li Wang
> 

  reply	other threads:[~2018-11-27  8:54 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-26  8:21 [LTP] [PATCH v2] mtest06/mmap1: rewrite to newlib Jan Stancek
2018-11-27  6:37 ` Li Wang
2018-11-27  8:54   ` Jan Stancek [this message]
2018-11-29 13:44 ` Cyril Hrubis
2018-11-30  9:46   ` Jan Stancek
2019-02-04  8:34     ` Naresh Kamboju
2019-02-04  9:05       ` Jan Stancek
2019-02-05  6:46         ` Jan Stancek

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