From: Al Viro <viro@ZenIV.linux.org.uk>
To: "Maciej W. Rozycki" <macro@codesourcery.com>
Cc: David Daney <ddaney@caviumnetworks.com>,
Al Viro <viro@ftp.linux.org.uk>,
ralf@linux-mips.org, linux-kernel@vger.kernel.org,
linux-arch@vger.kernel.org,
"Maciej W. Rozycki" <macro@linux-mips.org>
Subject: Re: [PATCH 3/5] mips: sanitize restart logics
Date: Fri, 8 Oct 2010 06:36:56 +0100 [thread overview]
Message-ID: <20101008053656.GU19804@ZenIV.linux.org.uk> (raw)
In-Reply-To: <alpine.DEB.1.10.1009300218380.25860@tp.orcam.me.uk>
On Thu, Sep 30, 2010 at 02:50:17AM +0100, Maciej W. Rozycki wrote:
> On Wed, 29 Sep 2010, David Daney wrote:
> Not exactly. These GNU C library functions rely on the magic value of
> "1" there to recognise contexts they created themselves and which must
> therefore be handled by themselves internally (these contexts are not
> complete and only preserve the call-saved registers as specified by the
> respective MIPS ABIs, and are therefore unsafe to be passed to the
> rt_sigreturn(2) syscall). All the other values, including of course "0",
> are not treated specially and the context is passed to rt_sigreturn(2) as
> usually. This only matters in cases where e.g. setcontext(3) is used to
> exit from or return to a signal handler.
Nothing has changed in that respect; setup_sigcontext() (and its counterparts)
do _not_ use regs->regs[0]. Note
err |= __put_user(0, &sc->sc_regs[0]);
for (i = 1; i < 32; i++)
err |= __put_user(regs->regs[i], &sc->sc_regs[i]);
in there. The whole point of ->regs[0] uses (both original and modified)
is that $0 is constant 0 and thus the kernel is free to use that member
of pt_regs to indicate that syscall restart might be needed. So's libc,
for that matter (to distinguish between sigreturn and setcontext ones).
When sigframe is created we still discard the value - the fragment above
is not modified at all.
BTW, with original code regs->regs[0] *can* be 1, if you are leaving syscall
with -EINVAL. It won't reach the userland, though.
next prev parent reply other threads:[~2010-10-08 5:37 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-28 17:50 Al Viro
2010-09-29 18:28 ` David Daney
2010-09-30 1:50 ` Maciej W. Rozycki
2010-10-08 5:36 ` Al Viro [this message]
2010-10-16 0:25 ` Maciej W. Rozycki
2010-10-14 14:44 ` Ralf Baechle
2010-10-16 4:24 ` Shane McDonald
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=20101008053656.GU19804@ZenIV.linux.org.uk \
--to=viro@zeniv.linux.org.uk \
--cc=ddaney@caviumnetworks.com \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=macro@codesourcery.com \
--cc=macro@linux-mips.org \
--cc=ralf@linux-mips.org \
--cc=viro@ftp.linux.org.uk \
/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
Powered by JetHome