diff options
| -rw-r--r-- | arch/x86/kernel/entry_64.S | 47 |
1 files changed, 22 insertions, 25 deletions
diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S index eac9b81edfe1..be846d2468f7 100644 --- a/arch/x86/kernel/entry_64.S +++ b/arch/x86/kernel/entry_64.S | |||
| @@ -1203,8 +1203,15 @@ apicinterrupt IRQ_WORK_VECTOR \ | |||
| 1203 | /* | 1203 | /* |
| 1204 | * Exception entry points. | 1204 | * Exception entry points. |
| 1205 | */ | 1205 | */ |
| 1206 | .macro idtentry sym do_sym has_error_code:req paranoid=0 | 1206 | #define INIT_TSS_IST(x) PER_CPU_VAR(init_tss) + (TSS_ist + ((x) - 1) * 8) |
| 1207 | |||
| 1208 | .macro idtentry sym do_sym has_error_code:req paranoid=0 shift_ist=-1 | ||
| 1207 | ENTRY(\sym) | 1209 | ENTRY(\sym) |
| 1210 | /* Sanity check */ | ||
| 1211 | .if \shift_ist != -1 && \paranoid == 0 | ||
| 1212 | .error "using shift_ist requires paranoid=1" | ||
| 1213 | .endif | ||
| 1214 | |||
| 1208 | .if \has_error_code | 1215 | .if \has_error_code |
| 1209 | XCPT_FRAME | 1216 | XCPT_FRAME |
| 1210 | .else | 1217 | .else |
| @@ -1230,8 +1237,12 @@ ENTRY(\sym) | |||
| 1230 | DEFAULT_FRAME 0 | 1237 | DEFAULT_FRAME 0 |
| 1231 | 1238 | ||
| 1232 | .if \paranoid | 1239 | .if \paranoid |
| 1240 | .if \shift_ist != -1 | ||
| 1241 | TRACE_IRQS_OFF_DEBUG /* reload IDT in case of recursion */ | ||
| 1242 | .else | ||
| 1233 | TRACE_IRQS_OFF | 1243 | TRACE_IRQS_OFF |
| 1234 | .endif | 1244 | .endif |
| 1245 | .endif | ||
| 1235 | 1246 | ||
| 1236 | movq %rsp,%rdi /* pt_regs pointer */ | 1247 | movq %rsp,%rdi /* pt_regs pointer */ |
| 1237 | 1248 | ||
| @@ -1242,8 +1253,16 @@ ENTRY(\sym) | |||
| 1242 | xorl %esi,%esi /* no error code */ | 1253 | xorl %esi,%esi /* no error code */ |
| 1243 | .endif | 1254 | .endif |
| 1244 | 1255 | ||
| 1256 | .if \shift_ist != -1 | ||
| 1257 | subq $EXCEPTION_STKSZ, INIT_TSS_IST(\shift_ist) | ||
| 1258 | .endif | ||
| 1259 | |||
| 1245 | call \do_sym | 1260 | call \do_sym |
| 1246 | 1261 | ||
| 1262 | .if \shift_ist != -1 | ||
| 1263 | addq $EXCEPTION_STKSZ, INIT_TSS_IST(\shift_ist) | ||
| 1264 | .endif | ||
| 1265 | |||
| 1247 | .if \paranoid | 1266 | .if \paranoid |
| 1248 | jmp paranoid_exit /* %ebx: no swapgs flag */ | 1267 | jmp paranoid_exit /* %ebx: no swapgs flag */ |
| 1249 | .else | 1268 | .else |
| @@ -1254,28 +1273,6 @@ ENTRY(\sym) | |||
| 1254 | END(\sym) | 1273 | END(\sym) |
| 1255 | .endm | 1274 | .endm |
| 1256 | 1275 | ||
| 1257 | #define INIT_TSS_IST(x) PER_CPU_VAR(init_tss) + (TSS_ist + ((x) - 1) * 8) | ||
| 1258 | .macro paranoidzeroentry_ist sym do_sym ist | ||
| 1259 | ENTRY(\sym) | ||
| 1260 | INTR_FRAME | ||
| 1261 | ASM_CLAC | ||
| 1262 | PARAVIRT_ADJUST_EXCEPTION_FRAME | ||
| 1263 | pushq_cfi $-1 /* ORIG_RAX: no syscall to restart */ | ||
| 1264 | subq $ORIG_RAX-R15, %rsp | ||
| 1265 | CFI_ADJUST_CFA_OFFSET ORIG_RAX-R15 | ||
| 1266 | call save_paranoid | ||
| 1267 | DEFAULT_FRAME 0 | ||
| 1268 | TRACE_IRQS_OFF_DEBUG | ||
| 1269 | movq %rsp,%rdi /* pt_regs pointer */ | ||
| 1270 | xorl %esi,%esi /* no error code */ | ||
| 1271 | subq $EXCEPTION_STKSZ, INIT_TSS_IST(\ist) | ||
| 1272 | call \do_sym | ||
| 1273 | addq $EXCEPTION_STKSZ, INIT_TSS_IST(\ist) | ||
| 1274 | jmp paranoid_exit /* %ebx: no swapgs flag */ | ||
| 1275 | CFI_ENDPROC | ||
| 1276 | END(\sym) | ||
| 1277 | .endm | ||
| 1278 | |||
| 1279 | #ifdef CONFIG_TRACING | 1276 | #ifdef CONFIG_TRACING |
| 1280 | .macro trace_idtentry sym do_sym has_error_code:req | 1277 | .macro trace_idtentry sym do_sym has_error_code:req |
| 1281 | idtentry trace(\sym) trace(\do_sym) has_error_code=\has_error_code | 1278 | idtentry trace(\sym) trace(\do_sym) has_error_code=\has_error_code |
| @@ -1460,8 +1457,8 @@ apicinterrupt3 HYPERVISOR_CALLBACK_VECTOR \ | |||
| 1460 | */ | 1457 | */ |
| 1461 | .pushsection .kprobes.text, "ax" | 1458 | .pushsection .kprobes.text, "ax" |
| 1462 | 1459 | ||
| 1463 | paranoidzeroentry_ist debug do_debug DEBUG_STACK | 1460 | idtentry debug do_debug has_error_code=0 paranoid=1 shift_ist=DEBUG_STACK |
| 1464 | paranoidzeroentry_ist int3 do_int3 DEBUG_STACK | 1461 | idtentry int3 do_int3 has_error_code=0 paranoid=1 shift_ist=DEBUG_STACK |
| 1465 | idtentry stack_segment do_stack_segment has_error_code=1 paranoid=1 | 1462 | idtentry stack_segment do_stack_segment has_error_code=1 paranoid=1 |
| 1466 | #ifdef CONFIG_XEN | 1463 | #ifdef CONFIG_XEN |
| 1467 | idtentry xen_debug do_debug has_error_code=0 | 1464 | idtentry xen_debug do_debug has_error_code=0 |
