[RFC 1/1] Fix varargs in prctl syscall

Mike Frysinger vapier at gentoo.org
Mon Jul 27 06:46:45 UTC 2009


On Monday 27 July 2009 02:19:37 Hans-Christian Egtvedt wrote:
> On Mon, 20 Jul 2009 08:50:25 -0400 Mike Frysinger wrote:
> > On Friday 12 September 2008 09:34:14 Hans-Christian Egtvedt wrote:
> > > This patch properly handles the variodic argument
> > > before the syscall is passed to the kernel.
> >
> > i dont see why this is needed ?  are you seeing an actual bug or you
> > just noticed it and thought you'd fix it ?
>
> Yes, on AVR32 you must properly handle variadic arguments, as the
> arguments are passed on the stack.

the location of the arguments (stack/register) really doesnt matter by 
themselves, only in relation to the normal function calling convention.

i'm guessing what you mean to say is that the people who implemented the avr32 
ABI made a stupid decision and decided to not have variadic arguments follow 
the normal function calling convention.

> > afaict, there is nothing wrong here.  variodic function calls have
> > the same calling convention as non-variodic function calls.
> > presumably the kernel isnt going to check arg2 unless the option is
> > appropriate, and passing along a non- zero value shouldnt be a
> > problem anyways.
>
> Well, works by accident for most architectures, but when using variadic
> arguments you must grab the arguments passed to the function
> appropriately.

if the majority of arches are doing the sane thing, then the odd balls should 
not force them to suffer.  in other words, the bloat here is not OK.  instead, 
add a new "__UCLIBC_VARARGS_REQUIRED__" or something to uClibc_arch_features.h 
and you can key off of that.

also, the method for calling syscalls has changed and your code is still using 
the old method.  the return should read:
	return INLINE_SYSCALL(prctl, 5, option, arg2, 0, 0, 0);

> http://www.gnu.org/software/libc/manual/html_node/Variadic-Example.html#Var
>iadic-Example

i know how to write variadic code.  that isnt the issue here.
-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/20090727/5eccfd99/attachment.pgp>


More information about the uClibc mailing list