From: Andreas Schwab <schwab@linux-m68k.org>
To: Szabolcs Nagy via Libc-alpha <libc-alpha@sourceware.org>
Cc: Szabolcs Nagy <szabolcs.nagy@arm.com>
Subject: Re: [PATCH] arm: Fix an incorrect check in ____longjmp_chk [BZ #27709]
Date: Mon, 12 Apr 2021 14:45:41 +0200 [thread overview]
Message-ID: <87im4r7jt6.fsf@igel.home> (raw)
In-Reply-To: <20210408174724.19063-1-szabolcs.nagy@arm.com> (Szabolcs Nagy via Libc-alpha's message of "Thu, 8 Apr 2021 18:47:24 +0100")
On Apr 08 2021, Szabolcs Nagy via Libc-alpha wrote:
> An incorrect check in __longjmp_chk could fail on valid code causing
>
> FAIL: debug/tst-longjmp_chk2
>
> The original check was
>
> altstack_sp + altstack_size - setjmp_sp > altstack_size
>
> i.e. sp at setjmp was outside of the altstack range. Here we know that
> longjmp is called from a signal handler on the altstack (SS_ONSTACK),
> and that it jumps in the wrong direction (sp decreases), so the check
> wants to ensure the jump goes to another stack.
>
> The check is wrong when altstack_sp == setjmp_sp which can happen
> when the altstack is a local buffer in the function that calls setjmp,
> so the patch allows == too. This fixes bug 27709.
>
> Note that the generic __longjmp_chk check seems to be different.
> (it checks if longjmp was on the altstack but does not check setjmp,
> so it would not catch incorrect longjmp use within the signal handler).
Ok.
Andreas.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1
"And now for something completely different."
prev parent reply other threads:[~2021-04-12 12:45 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-08 17:47 Szabolcs Nagy
2021-04-12 12:45 ` Andreas Schwab [this message]
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=87im4r7jt6.fsf@igel.home \
--to=schwab@linux-m68k.org \
--cc=libc-alpha@sourceware.org \
--cc=szabolcs.nagy@arm.com \
/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).