summaryrefslogtreecommitdiffstats
path: root/sys/x86
diff options
context:
space:
mode:
authoremaste <emaste@FreeBSD.org>2013-11-25 15:58:48 +0000
committeremaste <emaste@FreeBSD.org>2013-11-25 15:58:48 +0000
commitb0519089ed0efd8b8d92d24e9d972cfdb513232a (patch)
tree1700a610df043601614f2bd2a345a3bca0ec7cd6 /sys/x86
parent79f55b704935cf6e1a4f60d33d1ce87bcf710f08 (diff)
downloadFreeBSD-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/x86')
-rw-r--r--sys/x86/include/psl.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/sys/x86/include/psl.h b/sys/x86/include/psl.h
index 12d05c5..47851e0 100644
--- a/sys/x86/include/psl.h
+++ b/sys/x86/include/psl.h
@@ -77,8 +77,16 @@
* is undesirable but it may as well be allowed since users can inflict
* it on the kernel directly. Changes to PSL_AC are silently ignored on
* 386's.
+ *
+ * Users are allowed 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.
*/
#define PSL_USERCHANGE (PSL_C | PSL_PF | PSL_AF | PSL_Z | PSL_N | PSL_T \
- | PSL_D | PSL_V | PSL_NT | PSL_AC | PSL_ID)
+ | PSL_D | PSL_V | PSL_NT | PSL_RF | PSL_AC | PSL_ID)
#endif /* !_MACHINE_PSL_H_ */
OpenPOWER on IntegriCloud