From: DJ Delorie <dj@redhat.com>
To: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Cc: libc-alpha@sourceware.org
Subject: Re: [PATCH v3] i386: Use pthread_barrier for synchronization on tst-bz21269
Date: Mon, 27 Feb 2023 17:21:54 -0500 [thread overview]
Message-ID: <xnr0ua7nr1.fsf@greed.delorie.com> (raw)
In-Reply-To: <20230224161528.997-1-adhemerval.zanella@linaro.org>
Adhemerval Zanella <adhemerval.zanella@linaro.org> writes:
> static void *
> threadproc (void *ctx)
> {
> - while (1)
> + for (int i = 0; i < NITER; i++)
Ok.
> - futex ((int *) &ftx, FUTEX_WAIT, 1, NULL, NULL, 0);
> - while (atomic_load (&ftx) != 2)
> - {
> - if (atomic_load (&ftx) >= 3)
> - return NULL;
> - }
> + xpthread_barrier_wait (&barrier);
- parent up to this point has set up the LDT
block 1 - thread waits for parent;
> /* clear LDT entry 0. */
> const struct user_desc desc = { 0 };
> xmodify_ldt (1, &desc, sizeof (desc));
>
> - /* If ftx == 2, set it to zero, If ftx == 100, quit. */
> - if (atomic_fetch_add (&ftx, -2) != 2)
> - return NULL;
> + /* Wait for 'ss' set in main thread. */
> + xpthread_barrier_wait (&barrier);
block 2 - child sets ldt, parent does nothing
- post, parent sets SS. This still isn't doing what the original test
case was doing.
The original code did this:
Parent changes LDT and sets SS
- force a task switch, which should segfault
- sigaction's handler either works, or fails <-- important part
- child resets LDT
Do you have a version of libc newer than the patch in BZ#21269 that you
can test the modified test against, to make sure it still detects the
failing case?
Thinking about it, I suspect this change shouldn't be done:
> - TEST_VERIFY_EXIT (sigaction (sig, &sa, 0) == 0);
> + xsigaction (sig, &sa, 0);
Although they do the same things, since it's sigaction we're actually
testing here, hiding it in an xfunction isn't appropriate.
next prev parent reply other threads:[~2023-02-27 22:21 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-24 16:15 Adhemerval Zanella
2023-02-27 22:21 ` DJ Delorie [this message]
2023-02-28 14:29 ` Adhemerval Zanella Netto
2023-03-02 5:10 ` DJ Delorie
2023-03-02 17:00 ` Adhemerval Zanella Netto
2023-03-02 20:21 ` DJ Delorie
2023-03-08 18:01 ` Adhemerval Zanella Netto
2023-05-10 21:31 ` DJ Delorie
2023-05-15 18:33 ` Adhemerval Zanella Netto
2023-05-16 19:10 ` DJ Delorie
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=xnr0ua7nr1.fsf@greed.delorie.com \
--to=dj@redhat.com \
--cc=adhemerval.zanella@linaro.org \
--cc=libc-alpha@sourceware.org \
/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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).