3 ms·
Don't GNU C's closures/nested functions require an executable stack or something? I remember GNU GRUB going through and getting rid of all of them.
by geofft 7y ago
Don't GNU C's closures/nested functions require an executable stack or something?
I remember GNU GRUB going through and getting rid of all of them.
- saagarjha 7y agoYes, because that’s where they put trampolines that are generated on the fly. (They don’t need to do this, but that’s how it’s currently implemented.)
- Gibbon1 7y agoI use them. The executable stack bit doesn't bother me since I'm on an ARM Cortex. Would be nice if they fixed that because they are kinda handy once you get used to them.
- geofft 7y ago> The executable stack bit doesn't bother me since I'm on an ARM Cortex. I'm not familiar enough with ARM - what does ARM Cortex give you here?
- Gibbon1 7y agoIt's what it doesn't give me. Doesn't have a memory management unit, so no stack execution protection. So no protection against classic stack smashing attacks. I saw a talk about weird machines. The upshot of it is if you can clobber the return address on the stack you can usually create a weird machine that you can then program[1]. Leads me to believe that if you are putting entrusted data and return addresses on the same stack you're in a state of sin security wise. https://en.wikipedia.org/wiki/Weird_machine https://en.wikipedia.org/wiki/Weird_machine [1] Also saw an exploit on an embedded system where they leveraged that even though the memory was locked you could set the program counter and read/write registers via jtag. Using that they were able in short order to recover the devices security keys and re-flash it with their own code.
- a1369209993 7y agoThe implementation uses a executable stack, but they could do it differently if they cared. Eg, https://news.ycombinator.com/item?id=21635551 https://news.ycombinator.com/item?id=21635551 with alternating ro+x and rw-x pages holding thunks and fptr+data pairs.