On Wed, Nov 05, 2008 at 12:28:53PM +0000, Paul LeoNerd Evans wrote:
> On Tue, Nov 04, 2008 at 03:53:57PM -0500, Jan Harkes wrote:
> > Yes, the libc version of makecontext is (was?) broken on amd64 and it
> > was corrupting pointers passed as arguments. I think the high bits of
> > the pointer were either cleared or filled with random data, not sure
> > anymore.
> 
> Actually, I've just read makecontext(3):
> 
>        When this context is later activated (using setcontext(2)  or  swapcon‐
>        text())  the  function func is called, and passed the series of integer
>        (int) arguments that follow argc; the caller must specify the number of
>        these  arguments  in  argc.   When this function returns, the successor
>        context is activated.  If the successor context pointer  is  NULL,  the
>        thread exits.

While Linux / glibc's manpage isn't too clear on the subject, the
following comment comes from NetBSD's version:

     The standard does not clearly define the type of integer arguments passed
     to func via makecontext(); portable applications should not rely on the
     implementation detail that it may be possible to pass pointer arguments
     to functions.  This may be clarified in a future revision of the stan-
     dard.

http://www.daemon-systems.org/man/makecontext.3.html

> That sounds to me like it won't guarantee to pass a pointer around
> anyway, only an int.

-- 
Paul "LeoNerd" Evans

[EMAIL PROTECTED]
ICQ# 4135350       |  Registered Linux# 179460
http://www.leonerd.org.uk/

Attachment: signature.asc
Description: Digital signature

Reply via email to