diff options
author | Ed Maste <emaste@FreeBSD.org> | 2013-11-14 15:37:20 +0000 |
---|---|---|
committer | Ed Maste <emaste@FreeBSD.org> | 2013-11-14 15:37:20 +0000 |
commit | 3d271aaab007f9553acd8de27e555f4928a2c6a9 (patch) | |
tree | e176fc3a1f9254f29a0794cb5f498dea6487cc1e /sys/pc98 | |
parent | e4e01d9ceca35fc787ca6d0cf91acaf66ccd8e09 (diff) | |
download | src-3d271aaab007f9553acd8de27e555f4928a2c6a9.tar.gz src-3d271aaab007f9553acd8de27e555f4928a2c6a9.zip |
x86: Allow users to change PSL_RF via ptrace(PT_SETREGS...)
Debuggers may need to change PSL_RF. Note that tf_eflags is already stored
in the signal context during signal handling and PSL_RF previously could be
modified via sigreturn, so this change should not provide any new ability
to userspace.
For background see the thread at:
http://lists.freebsd.org/pipermail/freebsd-i386/2007-September/005910.html
Reviewed by: jhb, kib
Sponsored by: DARPA, AFRL
Notes
Notes:
svn path=/head/; revision=258135
Diffstat (limited to 'sys/pc98')
-rw-r--r-- | sys/pc98/pc98/machdep.c | 36 |
1 files changed, 3 insertions, 33 deletions
diff --git a/sys/pc98/pc98/machdep.c b/sys/pc98/pc98/machdep.c index 443518697cb1..a4887c6a47dd 100644 --- a/sys/pc98/pc98/machdep.c +++ b/sys/pc98/pc98/machdep.c @@ -773,17 +773,7 @@ osigreturn(td, uap) /* * Don't allow users to change privileged or reserved flags. */ - /* - * XXX do allow users to change the privileged flag PSL_RF. - * The cpu sets PSL_RF in tf_eflags for faults. Debuggers - * should sometimes set it there too. tf_eflags is kept in - * the signal context during signal handling and there is no - * other place to remember it, so the PSL_RF bit may be - * corrupted by the signal handler without us knowing. - * Corruption of the PSL_RF bit at worst causes one more or - * one less debugger trap, so allowing it is fairly harmless. - */ - if (!EFL_SECURE(eflags & ~PSL_RF, regs->tf_eflags & ~PSL_RF)) { + if (!EFL_SECURE(eflags, regs->tf_eflags)) { return (EINVAL); } @@ -899,17 +889,7 @@ freebsd4_sigreturn(td, uap) /* * Don't allow users to change privileged or reserved flags. */ - /* - * XXX do allow users to change the privileged flag PSL_RF. - * The cpu sets PSL_RF in tf_eflags for faults. Debuggers - * should sometimes set it there too. tf_eflags is kept in - * the signal context during signal handling and there is no - * other place to remember it, so the PSL_RF bit may be - * corrupted by the signal handler without us knowing. - * Corruption of the PSL_RF bit at worst causes one more or - * one less debugger trap, so allowing it is fairly harmless. - */ - if (!EFL_SECURE(eflags & ~PSL_RF, regs->tf_eflags & ~PSL_RF)) { + if (!EFL_SECURE(eflags, regs->tf_eflags)) { uprintf("pid %d (%s): freebsd4_sigreturn eflags = 0x%x\n", td->td_proc->p_pid, td->td_name, eflags); return (EINVAL); @@ -1013,17 +993,7 @@ sys_sigreturn(td, uap) /* * Don't allow users to change privileged or reserved flags. */ - /* - * XXX do allow users to change the privileged flag PSL_RF. - * The cpu sets PSL_RF in tf_eflags for faults. Debuggers - * should sometimes set it there too. tf_eflags is kept in - * the signal context during signal handling and there is no - * other place to remember it, so the PSL_RF bit may be - * corrupted by the signal handler without us knowing. - * Corruption of the PSL_RF bit at worst causes one more or - * one less debugger trap, so allowing it is fairly harmless. - */ - if (!EFL_SECURE(eflags & ~PSL_RF, regs->tf_eflags & ~PSL_RF)) { + if (!EFL_SECURE(eflags, regs->tf_eflags)) { uprintf("pid %d (%s): sigreturn eflags = 0x%x\n", td->td_proc->p_pid, td->td_name, eflags); return (EINVAL); |