Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F107746895
D30578.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D30578.diff
View Options
diff --git a/sys/amd64/amd64/trap.c b/sys/amd64/amd64/trap.c
--- a/sys/amd64/amd64/trap.c
+++ b/sys/amd64/amd64/trap.c
@@ -236,25 +236,31 @@
* interrupts disabled until they are accidentally
* enabled later.
*/
- if (TRAPF_USERMODE(frame))
+ if (TRAPF_USERMODE(frame)) {
uprintf(
"pid %ld (%s): trap %d with interrupts disabled\n",
(long)curproc->p_pid, curthread->td_name, type);
- else if (type != T_NMI && type != T_BPTFLT &&
- type != T_TRCTRAP) {
- /*
- * XXX not quite right, since this may be for a
- * multiple fault in user mode.
- */
- printf("kernel trap %d with interrupts disabled\n",
- type);
-
- /*
- * We shouldn't enable interrupts while holding a
- * spin lock.
- */
- if (td->td_md.md_spinlock_count == 0)
- enable_intr();
+ } else {
+ switch (type) {
+ case T_NMI:
+ case T_BPTFLT:
+ case T_TRCTRAP:
+ case T_PROTFLT:
+ case T_SEGNPFLT:
+ case T_STKFLT:
+ break;
+ default:
+ printf(
+ "kernel trap %d with interrupts disabled\n",
+ type);
+
+ /*
+ * We shouldn't enable interrupts while holding a
+ * spin lock.
+ */
+ if (td->td_md.md_spinlock_count == 0)
+ enable_intr();
+ }
}
}
@@ -444,6 +450,8 @@
* Magic '5' is the number of qwords occupied by
* the hardware trap frame.
*/
+ KASSERT((read_rflags() & PSL_I) == 0,
+ ("interrupts enabled"));
if (frame->tf_rip == (long)doreti_iret) {
frame->tf_rip = (long)doreti_iret_fault;
if ((PCPU_GET(curpmap)->pm_ucr3 !=
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Jan 18, 10:45 PM (21 h, 42 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15901034
Default Alt Text
D30578.diff (1 KB)
Attached To
Mode
D30578: amd64: Avoid enabling interrupts when handling kernel mode prot faults
Attached
Detach File
Event Timeline
Log In to Comment