Re: Darwin-kernel Digest, Vol 6, Issue 174
Re: Darwin-kernel Digest, Vol 6, Issue 174
- Subject: Re: Darwin-kernel Digest, Vol 6, Issue 174
- From: mogambo <email@hidden>
- Date: Mon, 30 Nov 2009 00:57:38 -0800
I cannot believe that it can be that simple. I tried building with -mno-red-zone and it works! I am able to mount/unmount (at least for more than 1000 iterations in a row) without seeing the stack corruption.
Thank you so much for your help. I hope someone at Apple looks into this.
------------------------------
Date: Wed, 25 Nov 2009 00:39:18 -0800
From: Michael Crawford <email@hidden>
Subject: Re: Kernel stack size and kernel memory debugger
To: email@hidden
Message-ID:
<email@hidden">email@hidden>
Content-Type: text/plain; charset=ISO-8859-1
Make sure that the AMD64 ABI Red Zone is disabled. I found that it
wasn't in my 64-bit build, even though it is documented to be set when
-mkernel is enabled.
Just try rebuilding your kext with -mno-red-zone
I filed a bug with Apple, and got a really snarky reply telling me
that Xcode was working as designed, and that there was no bug. This
gentleman closed the bug without even investigating. But in my
experience the bug persisted, and I had to use -mno-red-zone even
though I shouldn't have had to.
The AMD64 Red Zone is a 128-byte area below the stack pointer that may
not be touched by signal or interrupt handlers. It gives leaf
functions some local storage without the runtime and code size of
decrementing the stack pointer. (Yes, Really.) While a really scary
optimization, it works well provided everyone agrees to either respect
it, or not use it at all if it's not respected.
The Snow Leopard 64-bit kernel doesn't respect the Red Zone, so you
have to disable it in your build. That snarky engineer told me that
it was disabled in *my* build, but it clearly wasn't until I added
-mno-red-zone.
(The Linux kernel doesn't respect it either.)
Mike
--
Michael David Crawford
mdcrawford at gmail dot com
GoingWare's Bag of Programming Tricks
http://www.goingware.com/tips/
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden