Merge branch 'x86/urgent' into x86/asm, to pick up fixes
authorIngo Molnar <mingo@kernel.org>
Thu, 18 Aug 2016 16:41:12 +0000 (18:41 +0200)
committerIngo Molnar <mingo@kernel.org>
Thu, 18 Aug 2016 16:41:12 +0000 (18:41 +0200)
Signed-off-by: Ingo Molnar <mingo@kernel.org>
1  2 
arch/x86/entry/entry_64.S

index 8956eae04c2582e2ff155aeb6b234258259cf262,d172c619c44931b34b01d34b1dd09379ba26a5b4..f6b40e5c88f12d70f3a6fccefb137def156dcbe1
@@@ -288,11 -288,15 +288,15 @@@ return_from_SYSCALL_64
        jne     opportunistic_sysret_failed
  
        /*
-        * SYSRET can't restore RF.  SYSRET can restore TF, but unlike IRET,
-        * restoring TF results in a trap from userspace immediately after
-        * SYSRET.  This would cause an infinite loop whenever #DB happens
-        * with register state that satisfies the opportunistic SYSRET
-        * conditions.  For example, single-stepping this user code:
+        * SYSCALL clears RF when it saves RFLAGS in R11 and SYSRET cannot
+        * restore RF properly. If the slowpath sets it for whatever reason, we
+        * need to restore it correctly.
+        *
+        * SYSRET can restore TF, but unlike IRET, restoring TF results in a
+        * trap from userspace immediately after SYSRET.  This would cause an
+        * infinite loop whenever #DB happens with register state that satisfies
+        * the opportunistic SYSRET conditions.  For example, single-stepping
+        * this user code:
         *
         *           movq       $stuck_here, %rcx
         *           pushfq
@@@ -347,7 -351,8 +351,7 @@@ ENTRY(stub_ptregs_64
        jmp     entry_SYSCALL64_slow_path
  
  1:
 -      /* Called from C */
 -      jmp     *%rax                           /* called from C */
 +      jmp     *%rax                           /* Called from C */
  END(stub_ptregs_64)
  
  .macro ptregs_stub func
@@@ -600,9 -605,20 +604,20 @@@ apicinterrupt3 \num trace(\sym) smp_tra
  .endm
  #endif
  
+ /* Make sure APIC interrupt handlers end up in the irqentry section: */
+ #if defined(CONFIG_FUNCTION_GRAPH_TRACER) || defined(CONFIG_KASAN)
+ # define PUSH_SECTION_IRQENTRY        .pushsection .irqentry.text, "ax"
+ # define POP_SECTION_IRQENTRY .popsection
+ #else
+ # define PUSH_SECTION_IRQENTRY
+ # define POP_SECTION_IRQENTRY
+ #endif
  .macro apicinterrupt num sym do_sym
+ PUSH_SECTION_IRQENTRY
  apicinterrupt3 \num \sym \do_sym
  trace_apicinterrupt \num \sym
+ POP_SECTION_IRQENTRY
  .endm
  
  #ifdef CONFIG_SMP