From: "Maciej W. Rozycki" <macro@codesourcery.com>
To: Ralf Baechle <ralf@linux-mips.org>, Mike Frysinger <vapier@gentoo.org>
Cc: <libc-ports@sourceware.org>
Subject: Re: [PATCH][BZ #15054] MIPS: Fix syscall wrappers for syscall restart support
Date: Tue, 29 Jan 2013 18:12:00 -0000 [thread overview]
Message-ID: <alpine.DEB.1.10.1301291811090.4409@tp.orcam.me.uk> (raw)
In-Reply-To: <201301231317.34359.vapier@gentoo.org>
On Wed, 23 Jan 2013, Mike Frysinger wrote:
> > > > We have an issue with the INTERNAL_SYSCALL_NCS wrapper in that it does
> > > > not respect the kernel's syscall restart convention.
> > > >
> > > > That convention requires the instruction immediately preceding SYSCALL
> > > > to initialize $v0 with the syscall number. Then if a restart triggers,
> > > > $v0 will have been clobbered by the syscall interrupted, and needs to
> > > > be reinititalized. The kernel will decrement the PC by 4 before
> > > > switching back to the user mode so that $v0 has been reloaded before
> > > > SYSCALL is executed again. This implies the place $v0 is loaded from
> > > > must be preserved across a syscall, e.g. an immediate, static
> > > > register, stack slot, etc.
> > >
> > > naïvely, but why can't the mips kernel paths take care of the reload
> > > itself ? other arches have scratch space in their pt_regs for doing just
> > > this (a bunch of arches use the orig_<reg> convention).
> >
> > I agree it would be the most reasonable approach if designing from
> > scratch; unfortunately what we have is how the ABI has been set back in
> > 1994. You won't be able to patch up all the kernel binaries out there,
> > sigh...
>
> sure, you won't be able to retroactively fixing kernels. but you'll be able to
> make future kernels more robust against shady userlands. as you've pointed
> out, this is an extremely subtle bug that can easily go unnoticed for a long
> time which simply injects random flakiness into the runtime system.
That's not unreasonable, I agree. Ralf, what do you think?
Maciej
next prev parent reply other threads:[~2013-01-29 18:12 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-23 3:09 Maciej W. Rozycki
2013-01-23 5:05 ` Mike Frysinger
2013-01-23 5:40 ` Maciej W. Rozycki
2013-01-23 18:13 ` Mike Frysinger
2013-01-29 18:12 ` Maciej W. Rozycki [this message]
2013-01-29 19:04 ` Ralf Baechle
2013-01-29 19:12 ` Maciej W. Rozycki
2013-01-30 1:26 ` Ralf Baechle
2013-01-30 6:50 ` Mike Frysinger
2013-01-23 17:06 ` Joseph S. Myers
2013-01-24 12:47 ` Maciej W. Rozycki
2013-01-24 16:31 ` Joseph S. Myers
2013-01-29 18:10 ` Maciej W. Rozycki
2013-01-29 23:59 ` Joseph S. Myers
2013-02-05 15:26 ` Maciej W. Rozycki
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=alpine.DEB.1.10.1301291811090.4409@tp.orcam.me.uk \
--to=macro@codesourcery.com \
--cc=libc-ports@sourceware.org \
--cc=ralf@linux-mips.org \
--cc=vapier@gentoo.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).