Merge branch 'x86-pti-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
authorLinus Torvalds <torvalds@linux-foundation.org>
Mon, 8 Jul 2019 19:23:00 +0000 (12:23 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Mon, 8 Jul 2019 19:23:00 +0000 (12:23 -0700)
Pull x86 pti updates from Thomas Gleixner:
 "The speculative paranoia departement delivers a few more plugs for
  possible (probably theoretical) spectre/mds leaks"

* 'x86-pti-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  x86/tls: Fix possible spectre-v1 in do_get_thread_area()
  x86/ptrace: Fix possible spectre-v1 in ptrace_get_debugreg()
  x86/speculation/mds: Eliminate leaks by trace_hardirqs_on()

1  2 
arch/x86/kernel/ptrace.c

index 53f34121fdcab39e54db6d76964cb72126a440fe,cbac64659dc41b80667e33c7c736d3830d1a4628..ee9099061d0190e93c5ec012fb0aec5259da1e19
@@@ -633,9 -644,11 +634,10 @@@ static unsigned long ptrace_get_debugre
  {
        struct thread_struct *thread = &tsk->thread;
        unsigned long val = 0;
 -      int index = n;
  
        if (n < HBP_NUM) {
-               struct perf_event *bp = thread->ptrace_bps[n];
 -              index = array_index_nospec(index, HBP_NUM);
++              int index = array_index_nospec(n, HBP_NUM);
+               struct perf_event *bp = thread->ptrace_bps[index];
  
                if (bp)
                        val = bp->hw.info.address;