diff options
author | emaste <emaste@FreeBSD.org> | 2013-11-25 15:58:48 +0000 |
---|---|---|
committer | emaste <emaste@FreeBSD.org> | 2013-11-25 15:58:48 +0000 |
commit | b0519089ed0efd8b8d92d24e9d972cfdb513232a (patch) | |
tree | 1700a610df043601614f2bd2a345a3bca0ec7cd6 /sys/i386/linux | |
parent | 79f55b704935cf6e1a4f60d33d1ce87bcf710f08 (diff) | |
download | FreeBSD-src-b0519089ed0efd8b8d92d24e9d972cfdb513232a.zip FreeBSD-src-b0519089ed0efd8b8d92d24e9d972cfdb513232a.tar.gz |
MFC r258135: 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
Approved by: re (gjb)
Diffstat (limited to 'sys/i386/linux')
-rw-r--r-- | sys/i386/linux/linux_sysvec.c | 24 |
1 files changed, 2 insertions, 22 deletions
diff --git a/sys/i386/linux/linux_sysvec.c b/sys/i386/linux/linux_sysvec.c index 71417e0..0ad6791 100644 --- a/sys/i386/linux/linux_sysvec.c +++ b/sys/i386/linux/linux_sysvec.c @@ -684,17 +684,7 @@ linux_sigreturn(struct thread *td, struct linux_sigreturn_args *args) */ #define EFLAGS_SECURE(ef, oef) ((((ef) ^ (oef)) & ~PSL_USERCHANGE) == 0) eflags = frame.sf_sc.sc_eflags; - /* - * 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 (!EFLAGS_SECURE(eflags & ~PSL_RF, regs->tf_eflags & ~PSL_RF)) + if (!EFLAGS_SECURE(eflags, regs->tf_eflags)) return(EINVAL); /* @@ -785,17 +775,7 @@ linux_rt_sigreturn(struct thread *td, struct linux_rt_sigreturn_args *args) */ #define EFLAGS_SECURE(ef, oef) ((((ef) ^ (oef)) & ~PSL_USERCHANGE) == 0) eflags = context->sc_eflags; - /* - * 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 (!EFLAGS_SECURE(eflags & ~PSL_RF, regs->tf_eflags & ~PSL_RF)) + if (!EFLAGS_SECURE(eflags, regs->tf_eflags)) return(EINVAL); /* |