public inbox for libffi-discuss@sourceware.org
 help / color / mirror / Atom feed
* "closures" not working on OS X 10.8 (Mountain Lion)?
@ 2012-08-13 18:28 Nathan Rajlich
  2012-08-14 14:40 ` Andrew Haley
  0 siblings, 1 reply; 7+ messages in thread
From: Nathan Rajlich @ 2012-08-13 18:28 UTC (permalink / raw)
  To: libffi-discuss

Hello all,

It seems to me that closures are no longer working on OS X v10.8
(a.k.a. Mountain Lion). I first noticed this when the node-ffi test
suite started failing with a "Bus Error", so just now I ran a simple
closure example from the internet and encounter the same error when I
try to run that. Note that this is using the libffi v3.0.11 tag. My
test case and shell session are outlined in this gist here:
https://gist.github.com/3342783.

I don't personally know what's going on here, but am hoping somebody
on this list will. I can provide any more additional information
necessary. Cheers and thanks in advance!

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: "closures" not working on OS X 10.8 (Mountain Lion)?
  2012-08-13 18:28 "closures" not working on OS X 10.8 (Mountain Lion)? Nathan Rajlich
@ 2012-08-14 14:40 ` Andrew Haley
  2012-08-14 15:19   ` Reini Urban
  0 siblings, 1 reply; 7+ messages in thread
From: Andrew Haley @ 2012-08-14 14:40 UTC (permalink / raw)
  To: Nathan Rajlich; +Cc: libffi-discuss

On 08/13/2012 07:28 PM, Nathan Rajlich wrote:
> It seems to me that closures are no longer working on OS X v10.8
> (a.k.a. Mountain Lion). I first noticed this when the node-ffi test
> suite started failing with a "Bus Error", so just now I ran a simple
> closure example from the internet and encounter the same error when I
> try to run that. Note that this is using the libffi v3.0.11 tag. My
> test case and shell session are outlined in this gist here:
> https://gist.github.com/3342783.
> 
> I don't personally know what's going on here, but am hoping somebody
> on this list will. I can provide any more additional information
> necessary. Cheers and thanks in advance!

This is probably because of heap execute protection.  Unfortunately I
don't know how it works on OS X: you need an Apple export.

Andrew.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: "closures" not working on OS X 10.8 (Mountain Lion)?
  2012-08-14 14:40 ` Andrew Haley
@ 2012-08-14 15:19   ` Reini Urban
  2012-08-15  5:23     ` Nathan Rajlich
  0 siblings, 1 reply; 7+ messages in thread
From: Reini Urban @ 2012-08-14 15:19 UTC (permalink / raw)
  To: Andrew Haley; +Cc: Nathan Rajlich, libffi-discuss

On Tue, Aug 14, 2012 at 9:40 AM, Andrew Haley <aph@redhat.com> wrote:
> On 08/13/2012 07:28 PM, Nathan Rajlich wrote:
>> It seems to me that closures are no longer working on OS X v10.8
>> (a.k.a. Mountain Lion). I first noticed this when the node-ffi test
>> suite started failing with a "Bus Error", so just now I ran a simple
>> closure example from the internet and encounter the same error when I
>> try to run that. Note that this is using the libffi v3.0.11 tag. My
>> test case and shell session are outlined in this gist here:
>> https://gist.github.com/3342783.
>>
>> I don't personally know what's going on here, but am hoping somebody
>> on this list will. I can provide any more additional information
>> necessary. Cheers and thanks in advance!
>
> This is probably because of heap execute protection.  Unfortunately I
> don't know how it works on OS X: you need an Apple export.

--no_pie is needed.

See also http://code.google.com/p/address-sanitizer/issues/detail?id=29
how to disable ASLR with various MacOSX versions:
e.g. export DYLD_NO_PIE=1 on 10.6
link with --no_pie since 10.7
-- 
Reini Urban
http://cpanel.net/   http://www.perl-compiler.org/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: "closures" not working on OS X 10.8 (Mountain Lion)?
  2012-08-14 15:19   ` Reini Urban
@ 2012-08-15  5:23     ` Nathan Rajlich
  2012-09-13  0:51       ` Nathan Rajlich
  0 siblings, 1 reply; 7+ messages in thread
From: Nathan Rajlich @ 2012-08-15  5:23 UTC (permalink / raw)
  To: libffi-discuss; +Cc: Andrew Haley, Reini Urban

Bobby, I believe that that patch has indeed been merged upstream in
https://github.com/atgreen/libffi/commit/236c9391321f83ad40daf03f40c35c9ebc1da6b3.
So I guess it's not that.

Reini, that sounded like a good idea to me but it doesn't seem to
change anything for me. This is what I did:

  $ cd libffi   # still the v3.0.11 tag
  $ CFLAGS="-Xlinker -no_pie" CXXFLAGS="-Xlinker -no_pie"
LDFLAGS="-no_pie" ./configure --enable-static --disable-shared
--disable-builddir --with-pic
  $ CFLAGS="-Xlinker -no_pie" CXXFLAGS="-Xlinker -no_pie" LDFLAGS="-no_pie" make
  $ gcc -o closure-test closure.c .libs/libffi.a -Iinclude -Xlinker -no_pie
  $ ./closure-test
  Bus error: 10

Andrew, well shucks :)

Anybody else have any ideas?

On Tue, Aug 14, 2012 at 8:18 AM, Reini Urban <rurban@x-ray.at> wrote:
> On Tue, Aug 14, 2012 at 9:40 AM, Andrew Haley <aph@redhat.com> wrote:
>> On 08/13/2012 07:28 PM, Nathan Rajlich wrote:
>>> It seems to me that closures are no longer working on OS X v10.8
>>> (a.k.a. Mountain Lion). I first noticed this when the node-ffi test
>>> suite started failing with a "Bus Error", so just now I ran a simple
>>> closure example from the internet and encounter the same error when I
>>> try to run that. Note that this is using the libffi v3.0.11 tag. My
>>> test case and shell session are outlined in this gist here:
>>> https://gist.github.com/3342783.
>>>
>>> I don't personally know what's going on here, but am hoping somebody
>>> on this list will. I can provide any more additional information
>>> necessary. Cheers and thanks in advance!
>>
>> This is probably because of heap execute protection.  Unfortunately I
>> don't know how it works on OS X: you need an Apple export.
>
> --no_pie is needed.
>
> See also http://code.google.com/p/address-sanitizer/issues/detail?id=29
> how to disable ASLR with various MacOSX versions:
> e.g. export DYLD_NO_PIE=1 on 10.6
> link with --no_pie since 10.7
> --
> Reini Urban
> http://cpanel.net/   http://www.perl-compiler.org/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: "closures" not working on OS X 10.8 (Mountain Lion)?
  2012-08-15  5:23     ` Nathan Rajlich
@ 2012-09-13  0:51       ` Nathan Rajlich
  2012-09-16 21:10         ` Nathan Rajlich
  0 siblings, 1 reply; 7+ messages in thread
From: Nathan Rajlich @ 2012-09-13  0:51 UTC (permalink / raw)
  To: libffi-discuss

So does anybody else have any suggestions for diagnosing this? Things
work fine on Leopard, Snow Leopard, and Lion, just not Mountain Lion.
I'm stumped as for a way to make any progress here.

On Tue, Aug 14, 2012 at 10:23 PM, Nathan Rajlich <nathan@tootallnate.net> wrote:
> Bobby, I believe that that patch has indeed been merged upstream in
> https://github.com/atgreen/libffi/commit/236c9391321f83ad40daf03f40c35c9ebc1da6b3.
> So I guess it's not that.
>
> Reini, that sounded like a good idea to me but it doesn't seem to
> change anything for me. This is what I did:
>
>   $ cd libffi   # still the v3.0.11 tag
>   $ CFLAGS="-Xlinker -no_pie" CXXFLAGS="-Xlinker -no_pie"
> LDFLAGS="-no_pie" ./configure --enable-static --disable-shared
> --disable-builddir --with-pic
>   $ CFLAGS="-Xlinker -no_pie" CXXFLAGS="-Xlinker -no_pie" LDFLAGS="-no_pie" make
>   $ gcc -o closure-test closure.c .libs/libffi.a -Iinclude -Xlinker -no_pie
>   $ ./closure-test
>   Bus error: 10
>
> Andrew, well shucks :)
>
> Anybody else have any ideas?
>
> On Tue, Aug 14, 2012 at 8:18 AM, Reini Urban <rurban@x-ray.at> wrote:
>> On Tue, Aug 14, 2012 at 9:40 AM, Andrew Haley <aph@redhat.com> wrote:
>>> On 08/13/2012 07:28 PM, Nathan Rajlich wrote:
>>>> It seems to me that closures are no longer working on OS X v10.8
>>>> (a.k.a. Mountain Lion). I first noticed this when the node-ffi test
>>>> suite started failing with a "Bus Error", so just now I ran a simple
>>>> closure example from the internet and encounter the same error when I
>>>> try to run that. Note that this is using the libffi v3.0.11 tag. My
>>>> test case and shell session are outlined in this gist here:
>>>> https://gist.github.com/3342783.
>>>>
>>>> I don't personally know what's going on here, but am hoping somebody
>>>> on this list will. I can provide any more additional information
>>>> necessary. Cheers and thanks in advance!
>>>
>>> This is probably because of heap execute protection.  Unfortunately I
>>> don't know how it works on OS X: you need an Apple export.
>>
>> --no_pie is needed.
>>
>> See also http://code.google.com/p/address-sanitizer/issues/detail?id=29
>> how to disable ASLR with various MacOSX versions:
>> e.g. export DYLD_NO_PIE=1 on 10.6
>> link with --no_pie since 10.7
>> --
>> Reini Urban
>> http://cpanel.net/   http://www.perl-compiler.org/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: "closures" not working on OS X 10.8 (Mountain Lion)?
  2012-09-13  0:51       ` Nathan Rajlich
@ 2012-09-16 21:10         ` Nathan Rajlich
  2012-10-30 18:19           ` Anthony Green
  0 siblings, 1 reply; 7+ messages in thread
From: Nathan Rajlich @ 2012-09-16 21:10 UTC (permalink / raw)
  To: libffi-discuss

So it looks like there's a problem with the ./configure script on
Mountain Lion now, such that it doesn't properly define
FFI_MMAP_EXEC_WRIT.

It seems that 236c9391321f83ad40daf03f40c35c9ebc1da6b3 is inadequate,
and once I applied the Mozilla patch that Bobby linked to above then
things worked as expected:
https://github.com/rbranson/node-ffi/commit/c1c5ad02a0e03d1727824d9d6f99a9ff6f976be1

Just thought I'd let you know of my findings, cheers!

On Wed, Sep 12, 2012 at 5:50 PM, Nathan Rajlich <nathan@tootallnate.net> wrote:
> So does anybody else have any suggestions for diagnosing this? Things
> work fine on Leopard, Snow Leopard, and Lion, just not Mountain Lion.
> I'm stumped as for a way to make any progress here.
>
> On Tue, Aug 14, 2012 at 10:23 PM, Nathan Rajlich <nathan@tootallnate.net> wrote:
>> Bobby, I believe that that patch has indeed been merged upstream in
>> https://github.com/atgreen/libffi/commit/236c9391321f83ad40daf03f40c35c9ebc1da6b3.
>> So I guess it's not that.
>>
>> Reini, that sounded like a good idea to me but it doesn't seem to
>> change anything for me. This is what I did:
>>
>>   $ cd libffi   # still the v3.0.11 tag
>>   $ CFLAGS="-Xlinker -no_pie" CXXFLAGS="-Xlinker -no_pie"
>> LDFLAGS="-no_pie" ./configure --enable-static --disable-shared
>> --disable-builddir --with-pic
>>   $ CFLAGS="-Xlinker -no_pie" CXXFLAGS="-Xlinker -no_pie" LDFLAGS="-no_pie" make
>>   $ gcc -o closure-test closure.c .libs/libffi.a -Iinclude -Xlinker -no_pie
>>   $ ./closure-test
>>   Bus error: 10
>>
>> Andrew, well shucks :)
>>
>> Anybody else have any ideas?
>>
>> On Tue, Aug 14, 2012 at 8:18 AM, Reini Urban <rurban@x-ray.at> wrote:
>>> On Tue, Aug 14, 2012 at 9:40 AM, Andrew Haley <aph@redhat.com> wrote:
>>>> On 08/13/2012 07:28 PM, Nathan Rajlich wrote:
>>>>> It seems to me that closures are no longer working on OS X v10.8
>>>>> (a.k.a. Mountain Lion). I first noticed this when the node-ffi test
>>>>> suite started failing with a "Bus Error", so just now I ran a simple
>>>>> closure example from the internet and encounter the same error when I
>>>>> try to run that. Note that this is using the libffi v3.0.11 tag. My
>>>>> test case and shell session are outlined in this gist here:
>>>>> https://gist.github.com/3342783.
>>>>>
>>>>> I don't personally know what's going on here, but am hoping somebody
>>>>> on this list will. I can provide any more additional information
>>>>> necessary. Cheers and thanks in advance!
>>>>
>>>> This is probably because of heap execute protection.  Unfortunately I
>>>> don't know how it works on OS X: you need an Apple export.
>>>
>>> --no_pie is needed.
>>>
>>> See also http://code.google.com/p/address-sanitizer/issues/detail?id=29
>>> how to disable ASLR with various MacOSX versions:
>>> e.g. export DYLD_NO_PIE=1 on 10.6
>>> link with --no_pie since 10.7
>>> --
>>> Reini Urban
>>> http://cpanel.net/   http://www.perl-compiler.org/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: "closures" not working on OS X 10.8 (Mountain Lion)?
  2012-09-16 21:10         ` Nathan Rajlich
@ 2012-10-30 18:19           ` Anthony Green
  0 siblings, 0 replies; 7+ messages in thread
From: Anthony Green @ 2012-10-30 18:19 UTC (permalink / raw)
  To: Nathan Rajlich; +Cc: libffi-discuss

The FFI_MMAP_EXEC_WRIT issue should be resolved for Mountain Lion now,
although  I don't have access to any Apple systems to test with.

Thanks!

Anthony Green

On Sun, Sep 16, 2012 at 5:09 PM, Nathan Rajlich <nathan@tootallnate.net> wrote:
> So it looks like there's a problem with the ./configure script on
> Mountain Lion now, such that it doesn't properly define
> FFI_MMAP_EXEC_WRIT.
>
> It seems that 236c9391321f83ad40daf03f40c35c9ebc1da6b3 is inadequate,
> and once I applied the Mozilla patch that Bobby linked to above then
> things worked as expected:
> https://github.com/rbranson/node-ffi/commit/c1c5ad02a0e03d1727824d9d6f99a9ff6f976be1
>
> Just thought I'd let you know of my findings, cheers!
>
> On Wed, Sep 12, 2012 at 5:50 PM, Nathan Rajlich <nathan@tootallnate.net> wrote:
>> So does anybody else have any suggestions for diagnosing this? Things
>> work fine on Leopard, Snow Leopard, and Lion, just not Mountain Lion.
>> I'm stumped as for a way to make any progress here.
>>
>> On Tue, Aug 14, 2012 at 10:23 PM, Nathan Rajlich <nathan@tootallnate.net> wrote:
>>> Bobby, I believe that that patch has indeed been merged upstream in
>>> https://github.com/atgreen/libffi/commit/236c9391321f83ad40daf03f40c35c9ebc1da6b3.
>>> So I guess it's not that.
>>>
>>> Reini, that sounded like a good idea to me but it doesn't seem to
>>> change anything for me. This is what I did:
>>>
>>>   $ cd libffi   # still the v3.0.11 tag
>>>   $ CFLAGS="-Xlinker -no_pie" CXXFLAGS="-Xlinker -no_pie"
>>> LDFLAGS="-no_pie" ./configure --enable-static --disable-shared
>>> --disable-builddir --with-pic
>>>   $ CFLAGS="-Xlinker -no_pie" CXXFLAGS="-Xlinker -no_pie" LDFLAGS="-no_pie" make
>>>   $ gcc -o closure-test closure.c .libs/libffi.a -Iinclude -Xlinker -no_pie
>>>   $ ./closure-test
>>>   Bus error: 10
>>>
>>> Andrew, well shucks :)
>>>
>>> Anybody else have any ideas?
>>>
>>> On Tue, Aug 14, 2012 at 8:18 AM, Reini Urban <rurban@x-ray.at> wrote:
>>>> On Tue, Aug 14, 2012 at 9:40 AM, Andrew Haley <aph@redhat.com> wrote:
>>>>> On 08/13/2012 07:28 PM, Nathan Rajlich wrote:
>>>>>> It seems to me that closures are no longer working on OS X v10.8
>>>>>> (a.k.a. Mountain Lion). I first noticed this when the node-ffi test
>>>>>> suite started failing with a "Bus Error", so just now I ran a simple
>>>>>> closure example from the internet and encounter the same error when I
>>>>>> try to run that. Note that this is using the libffi v3.0.11 tag. My
>>>>>> test case and shell session are outlined in this gist here:
>>>>>> https://gist.github.com/3342783.
>>>>>>
>>>>>> I don't personally know what's going on here, but am hoping somebody
>>>>>> on this list will. I can provide any more additional information
>>>>>> necessary. Cheers and thanks in advance!
>>>>>
>>>>> This is probably because of heap execute protection.  Unfortunately I
>>>>> don't know how it works on OS X: you need an Apple export.
>>>>
>>>> --no_pie is needed.
>>>>
>>>> See also http://code.google.com/p/address-sanitizer/issues/detail?id=29
>>>> how to disable ASLR with various MacOSX versions:
>>>> e.g. export DYLD_NO_PIE=1 on 10.6
>>>> link with --no_pie since 10.7
>>>> --
>>>> Reini Urban
>>>> http://cpanel.net/   http://www.perl-compiler.org/

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2012-10-30 18:19 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-13 18:28 "closures" not working on OS X 10.8 (Mountain Lion)? Nathan Rajlich
2012-08-14 14:40 ` Andrew Haley
2012-08-14 15:19   ` Reini Urban
2012-08-15  5:23     ` Nathan Rajlich
2012-09-13  0:51       ` Nathan Rajlich
2012-09-16 21:10         ` Nathan Rajlich
2012-10-30 18:19           ` Anthony Green

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).