diff options
author | marcel <marcel@FreeBSD.org> | 2003-05-23 23:55:31 +0000 |
---|---|---|
committer | marcel <marcel@FreeBSD.org> | 2003-05-23 23:55:31 +0000 |
commit | 23cc51994d12de2a932bf9ce2672d966e1d1c31b (patch) | |
tree | 9fecd114fa14135940a108d3a3b2260e350a8ff5 /usr.bin/telnet | |
parent | 3c92bdad80f3c5a47974bb2498852b95bb93bab5 (diff) | |
download | FreeBSD-src-23cc51994d12de2a932bf9ce2672d966e1d1c31b.zip FreeBSD-src-23cc51994d12de2a932bf9ce2672d966e1d1c31b.tar.gz |
Fix a (new) source of instability:
When interrupting a kernel context, we don't need to switch stacks
(memory nor register). As such, we were also not restoring the
register stack pointer (ar.bspstore). This, however, fails to be
valid in 1 situation: when we interrupt a register stack switch as
is being done in restorectx(). The problem is that restorectx()
needs to have ar.bsp == ar.bspstore before it can assign the new
value to ar.bspstore. This is achieved by doing a loadrs prior to
assigning to ar.bspstore. If we take an interrupt in between the
loadrs and the assignment and we don't make sure we restore the
ar.bspstore prior to returning from the interrupt, we switch
stacks with possibly non-zero dirty registers, which means that
the new frame pointer (ar.bsp) will be invalid.
So, instead of jumping over the restoration of the register frame
pointer and related registers, we conditionalize it based on whether
we return to kernel context or user context. A future performance
tweak is possible by only restoring ar.bspstore when returning to
kernel mode *and* when the RSE is in enforced lazy mode. One cannot
assume ar.bsp == ar.bspstore if the RSE is not in enforced lazy mode
anyway.
While here (well, not quite) don't unconditionally assign to
ar.bspstore in exception_save. Only do that when we actually switch
stacks. It can only harm us to do it unconditionally.
Approved by: re@ (blanket)
Diffstat (limited to 'usr.bin/telnet')
0 files changed, 0 insertions, 0 deletions