Merge tag 'v4.0-rc7' into x86/asm, to resolve conflicts
authorIngo Molnar <mingo@kernel.org>
Wed, 8 Apr 2015 07:01:54 +0000 (09:01 +0200)
committerIngo Molnar <mingo@kernel.org>
Wed, 8 Apr 2015 07:01:54 +0000 (09:01 +0200)
Conflicts:
arch/x86/kernel/entry_64.S

Signed-off-by: Ingo Molnar <mingo@kernel.org>
1  2 
arch/x86/kernel/entry_64.S
arch/x86/kernel/kgdb.c
tools/testing/selftests/Makefile

@@@ -699,14 -792,28 +699,28 @@@ retint_swapgs:          /* return to user-spac
        shr $__VIRTUAL_MASK_SHIFT, %rcx
        jnz opportunistic_sysret_failed
  
 -      cmpq $__USER_CS,(CS-R11)(%rsp)          /* CS must match SYSRET */
 +      cmpq $__USER_CS,CS(%rsp)        /* CS must match SYSRET */
        jne opportunistic_sysret_failed
  
 -      movq (R11-ARGOFFSET)(%rsp), %r11
 -      cmpq %r11,(EFLAGS-ARGOFFSET)(%rsp)      /* R11 == RFLAGS */
 +      movq R11(%rsp),%r11
 +      cmpq %r11,EFLAGS(%rsp)          /* R11 == RFLAGS */
        jne opportunistic_sysret_failed
  
-       testq $X86_EFLAGS_RF,%r11       /* sysret can't restore RF */
+       /*
+        * 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:
+        *
+        *           movq $stuck_here,%rcx
+        *           pushfq
+        *           popq %r11
+        *   stuck_here:
+        *
+        * would never get past 'stuck_here'.
+        */
+       testq $(X86_EFLAGS_RF|X86_EFLAGS_TF), %r11
        jnz opportunistic_sysret_failed
  
        /* nothing to check for RSP */
Simple merge
Simple merge