[RFC 1/1] Fix varargs in prctl syscall

Hans-Christian Egtvedt hans-christian.egtvedt at atmel.com
Mon Jul 27 06:19:37 UTC 2009


On Mon, 20 Jul 2009 08:50:25 -0400
Mike Frysinger <vapier at gentoo.org> wrote:

> On Friday 12 September 2008 09:34:14 Hans-Christian Egtvedt wrote:
> > prctl is defined to use varargs in the header file, but implemented
> > to use varargs in the source.
> 
> i'm guessing you meant "not implemented" in the second part ...
> 

Yes

> > 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.

> 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[1].

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

-- 
Best regards,
Hans-Christian Egtvedt


More information about the uClibc mailing list