From: Linus Torvalds Date: Mon, 8 Jul 2019 19:23:00 +0000 (-0700) Subject: Merge branch 'x86-pti-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git... X-Git-Tag: v5.4-rc1~681 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=223cea6a4f0552b86fb25e3b8bbd00469816cd7a;p=platform%2Fkernel%2Flinux-rpi.git Merge branch 'x86-pti-for-linus' of git://git./linux/kernel/git/tip/tip 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() --- 223cea6a4f0552b86fb25e3b8bbd00469816cd7a diff --cc arch/x86/kernel/ptrace.c index 53f3412,cbac646..ee90990 --- a/arch/x86/kernel/ptrace.c +++ b/arch/x86/kernel/ptrace.c @@@ -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;