]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Prefer switching the memory stack from user to kernel *before* switching
authormarcel <marcel@FreeBSD.org>
Sat, 14 May 2011 14:55:15 +0000 (14:55 +0000)
committermarcel <marcel@FreeBSD.org>
Sat, 14 May 2011 14:55:15 +0000 (14:55 +0000)
commit8f1059ecb57c351a33f35dc535a32037e62755fa
treec62b1a26637e90e3ee6cb496cb96cfe194a43d18
parentdce7f9162949af4d10251f74426f436b34356d90
Prefer switching the memory stack from user to kernel *before* switching
the register stack. While the ordering doesn't matter, it creates an
invariant not previously there: the memory stack pointer will always be
larger than the register stack pointer. With this invariant in place,
it's easier to add instrumentation code that detects a stack overflow
because in such a scenario the memory stack pointer and register stack
pointers have crossed each other.

Aside: basic kernel operation needs about half the stack size (~16K)
at most. We have plenty of head room on the kernel stack...
sys/ia64/ia64/syscall.S