Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Nested functions are not supported on MacOSX

Name: Anonymous 2006-01-03 17:24

You wanted a programming thread?


(This, by the way, refers to nested functions in C code. A gcc extension)

"gcc's implementation of nested functions involves placing code on the stack and then executing it. Stack execution is a common operation in malicious code, particularly as a side effect of buffer overflows. While the proper fix is of course to not make buffer overflows possible in the first place, disabling stack execution decreases the likelihood that a buffer overflow or other stack-smashing attack will be exploitable."

"In future releases of Mac OS X, we may disable stack execution. (Obviously we'll have to keep binary compatibility in mind when or if we do that.) Nested functions were disabled to help prepare for that change."

"As for whether nested functions will be re-enabled, if someone contributes a patch to GCC to change the nested function implementation to not rely on stack execution, presumably there'd be a chance they'd be re-enabled."


Are Apple evil or awesome for doing this? (discussion!)

How would you go about implementing nested functions without using stack execution? (technical challenge!)

Or we could go back to flaming Java.

Name: Anonymous 2006-01-05 16:40

Welp, I suppose teh mac won't be supporting any languages that rely on trampolines for other reasons either. That's that for the likes of e.g. forth and... well I'm sure there are others, trampolines are just too good a technique to pass up. Maybe there needs to be a, you know, second stack in the ABI that's used exclusively for trampolines, is not connected to the ordinary stack in any way and thus can't be used for stack smashing attacks?

Then again I've been up for 35 hours now, if this sort of thing makes sense to me then it likely looks like fucking crap to the rest of you...

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List