This is the mail archive of the libc-ports@sources.redhat.com mailing list for the libc-ports project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH][BZ #15054] MIPS: Fix syscall wrappers for syscall restart support


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]