[RFC 1/1] Fix varargs in prctl syscall

Mike Frysinger vapier at gentoo.org
Thu Aug 13 11:16:13 UTC 2009


On Tuesday 28 July 2009 10:07:38 Hans-Christian Egtvedt wrote:
> On Tue, 28 Jul 2009 09:43:21 -0400 Mike Frysinger wrote:
> > On Tuesday 28 July 2009 02:25:03 Hans-Christian Egtvedt wrote:
> > > On Mon, 27 Jul 2009 13:24:25 -0400 Mike Frysinger wrote:
> > > > i'm guessing your syscall.S is doing something similar.  how
> > > > exactly does your code know how many things have been passed ?
> > > > or does it blindly assume 6 args have been specified ?
> > >
> > > The patch I sent grabs the number of arguments depending on what
> > > prctl call was made.
> >
> > i'm talking about syscall() now, not prctl()
>
> The kernel syscall defines 5 arguments for prctl, AFAICT it does not
> expect the arguments to be filled, unless the specific prctl call
> requires an argument.
>
> AFAIK all architectures will behave like that, given how prctl is
> defined in kernel/sys.c?

i dont care so much about the arguments here, although it'd be a lot simpler 
if your vararg code simply assumed complete args and loaded up 5.  is there a 
realistic system where this would be problematic ?  i.e. user did:
prctl(1, 2);
but uclibc ran va_arg() 5 times anyways

> For syscalls with 6 arguments the AVR32 arch will grab the 6th argument
> from the stack and put it into r3. Handled by
> arch/avr32/kernel/syscall-stubs.S.

syscall() is declared as a variadic function, so wouldnt all the optional 6 
arguments have to come off the stack just like prctl() ?  in fact, if you have 
to implement prctl() with varargs, then you could have syscall() simply be an 
alias to the prctl() function on avr32 ...
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.busybox.net/pipermail/uclibc/attachments/20090813/ec59b6a0/attachment.pgp>


More information about the uClibc mailing list