mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
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...
This commit is contained in:
parent
65385d6d79
commit
767ca6ed1a
1 changed files with 4 additions and 3 deletions
|
|
@ -239,21 +239,22 @@ ENTRY_NOPROFILE(epc_syscall, 8)
|
|||
;;
|
||||
}
|
||||
{ .mmi
|
||||
mov ar.bspstore=r15
|
||||
mov r13=ar.k4
|
||||
add r30=-SIZEOF_TRAPFRAME,r14
|
||||
mov r20=sp
|
||||
;;
|
||||
}
|
||||
{ .mii
|
||||
mov r13=ar.k4
|
||||
mov r21=ar.unat
|
||||
dep r30=0,r30,0,10
|
||||
;;
|
||||
add sp=-16,r30
|
||||
;;
|
||||
}
|
||||
{ .mmi
|
||||
mov ar.bspstore=r15
|
||||
;;
|
||||
mov ar.rnat=r19
|
||||
mov r21=ar.unat
|
||||
add r31=8,r30
|
||||
;;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue