File tree Expand file tree Collapse file tree 1 file changed +19
-2
lines changed
src/aero_kernel/src/arch/x86_64/interrupts Expand file tree Collapse file tree 1 file changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -97,6 +97,23 @@ pub(super) fn page_fault(stack: &mut InterruptErrorStack) {
97
97
log:: error!( "stack: {:#x?}" , stack) ;
98
98
} ;
99
99
100
+ if reason. contains ( PageFaultErrorCode :: PROTECTION_VIOLATION ) && !reason. contains ( PageFaultErrorCode :: USER_MODE ) {
101
+ if controlregs:: smap_enabled ( ) {
102
+ unwind:: prepare_panic ( ) ;
103
+
104
+ log:: error!( "SMAP violation page fault" ) ;
105
+ print_info ( ) ;
106
+
107
+ controlregs:: with_userspace_access ( ||unwind:: unwind_stack_trace ( ) ) ;
108
+
109
+ unsafe {
110
+ loop {
111
+ super :: halt ( ) ;
112
+ }
113
+ }
114
+ }
115
+ }
116
+
100
117
if accessed_address < userland_last_address && scheduler:: is_initialized ( )
101
118
|| stack. stack . iret . is_user ( )
102
119
{
@@ -130,7 +147,7 @@ pub(super) fn page_fault(stack: &mut InterruptErrorStack) {
130
147
scheduler:: get_scheduler ( ) . log_ptable ( ) ;
131
148
}
132
149
133
- unwind:: unwind_stack_trace ( ) ;
150
+ controlregs :: with_userspace_access ( || unwind:: unwind_stack_trace ( ) ) ;
134
151
135
152
let task = scheduler:: get_scheduler ( ) . current_task ( ) ;
136
153
task. signal ( aero_syscall:: signal:: SIGSEGV ) ;
@@ -147,7 +164,7 @@ pub(super) fn page_fault(stack: &mut InterruptErrorStack) {
147
164
log:: error!( "Page fault" ) ;
148
165
print_info ( ) ;
149
166
150
- unwind:: unwind_stack_trace ( ) ;
167
+ controlregs :: with_userspace_access ( || unwind:: unwind_stack_trace ( ) ) ;
151
168
152
169
unsafe {
153
170
loop {
You can’t perform that action at this time.
0 commit comments