public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: "H.J. Lu" <hjl.tools@gmail.com>
To: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Cc: GNU C Library <libc-alpha@sourceware.org>
Subject: Re: [PATCH v4 4/4] i386: Fix i386 sigaction sa_restorer initialization (BZ#21269)
Date: Mon, 19 Feb 2018 18:23:00 -0000	[thread overview]
Message-ID: <CAMe9rOrCtHEHCfjNPEYCtVEbwUG2zv+4thEQQMhQS=J+THf6CQ@mail.gmail.com> (raw)
In-Reply-To: <1518439345-6013-4-git-send-email-adhemerval.zanella@linaro.org>

On Mon, Feb 12, 2018 at 4:42 AM, Adhemerval Zanella
<adhemerval.zanella@linaro.org> wrote:
> This patch fixes the i386 sa_restorer field initialization for sigaction
> syscall for kernel with vDSO.  As described in bug report, x86_32 Linux
> (and compat on x86_64) interprets SA_RESTORER clear with nonzero
> sa_restorer as a request for stack switching if the SS segment is 'funny'
> This means that anything that tries to mix glibc's signal handling with
> segmentation (for instance through modify_ldt syscall) is randomly broken
> depending on what values lands in sa_restorer.
>
> The testcase added  is based on Linux test tools/testing/selftests/x86/ldt_gdt.c,
> more specifically in do_multicpu_tests function.  The main changes are:
>
>   - C11 atomics instead of plain access.
>
>   - Remove x86_64 support which simplifies the syscall handling and fallbacks.
>
>   - Replicate only the test required to trigger the issue.
>
> (I added some comments of my understanding of how the testcase is triggering
> the issue, so if someone with more x86 knowledge could check if I get this
> right I will be grateful)
>
> Checked on i686-linux-gnu.
>
>         [BZ #21269]
>         * sysdeps/unix/sysv/linux/i386/Makefile (tests): Add tst-bz21269.
>         * sysdeps/unix/sysv/linux/i386/sigaction.c (SET_SA_RESTORER): Clear
>         sa_restorer for vDSO case.
>         * sysdeps/unix/sysv/linux/i386/tst-bz21269.c: New file.
>
> Signed-off-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>

LGTM.

Thanks.

-- 
H.J.

  parent reply	other threads:[~2018-02-19 17:54 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-12 12:42 [PATCH v4 1/4] Rename nptl-signals.h to internal-signals.h Adhemerval Zanella
2018-02-12 12:49 ` [PATCH v4 2/4] Filter out NPTL internal signals (BZ #22391) Adhemerval Zanella
2018-02-19 17:51   ` Adhemerval Zanella
2018-04-03 14:24     ` Adhemerval Zanella
2018-04-03 15:12       ` Zack Weinberg
2018-04-03 16:14         ` Adhemerval Zanella
2018-02-12 12:53 ` [PATCH v4 3/4] linux: Consolidate sigaction implementation Adhemerval Zanella
2018-02-19 17:54   ` Adhemerval Zanella
2018-04-05 18:23     ` Adhemerval Zanella
2018-02-12 14:02 ` [PATCH v4 4/4] i386: Fix i386 sigaction sa_restorer initialization (BZ#21269) Adhemerval Zanella
2018-02-19 18:08   ` Adhemerval Zanella
2018-02-19 18:23   ` H.J. Lu [this message]
2018-02-19 17:51 ` [PATCH v4 1/4] Rename nptl-signals.h to internal-signals.h Adhemerval Zanella
2018-02-20 13:00 ` Florian Weimer
2018-02-20 13:45   ` Adhemerval Zanella

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='CAMe9rOrCtHEHCfjNPEYCtVEbwUG2zv+4thEQQMhQS=J+THf6CQ@mail.gmail.com' \
    --to=hjl.tools@gmail.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).