Why do user processes sometimes fault above the stack pointer?
You might notice that, in the stack growth tests, the user program faults on an address that is above the user program’s current stack pointer, even though the PUSH and PUSHA instructions would cause faults 4 and 32 bytes below the current stack pointer. This is not unusual. The PUSH and PUSHA instructions are not the only instructions that can trigger user stack growth. For instance, a user program may allocate stack space by decrementing the stack pointer using a SUB $n, %esp instruction, and then use a MOV …, m(%esp) instruction to write to a stack location within the allocated space that is m bytes above the current stack pointer. Such accesses are perfectly valid, and your kernel must grow the user program’s stack to allow those accesses to succeed.
Related Questions
- I have a number of processes that require being started as part of a configuration and that must be run with different user logins. How do I manage this in AppCenter?
- When would the user be able to receive the
=3 response (recognised power fault, calls inhibited)? - What Is An Accumulator, Status Register And Stack Pointer?