News for hackers. Stuff that matters.
Re:Let’s write a simple Kernel (2014) by throwaway613834 on Friday October 20, 2017 @11:46AM (#15516665)
Doesn't red-zoning break the fundamental contract of a stack pointer -- i.e., that it marks the end of the stack (and hence the location of the next item to be pushed)? This feature sounds like a bug to me...
Re:Let’s write a simple Kernel (2014) by DSMan195276 on Friday October 20, 2017 @01:36PM (#15517639)
In some ways yes, but it is only applied to functions where they call no other functions and thus "nobody" will ever know they never moved the stack pointer anyway. In those situations moving the stack pointer is just pointless extra work because it is a value that will never be used and then just restored to its original value.

I say "nobody" because in particular signal handlers (Which are basically just userland interrupts) can interrupt any part of userland code. However since they are generated entirely by the kernel it is easy enough for the kernel to obey the redzone and place the signal handler 128 bytes above the stack pointer, so in practice this isn't that big of a deal.