diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-09-04 12:27:18 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-09-06 10:22:23 +0200 |
commit | b307f99dca5ab33edc1e04b9b479bcb0852ff85f (patch) | |
tree | e037af3796eac1127120a3b3a94f8064d6f0e7b1 /arch | |
parent | 3b26fa9e3ec3973b5747ce53031414229e1bb8e7 (diff) | |
download | linux-stable-b307f99dca5ab33edc1e04b9b479bcb0852ff85f.tar.gz linux-stable-b307f99dca5ab33edc1e04b9b479bcb0852ff85f.tar.bz2 linux-stable-b307f99dca5ab33edc1e04b9b479bcb0852ff85f.zip |
x86/ptrace: fix up botched merge of spectrev1 fix
I incorrectly merged commit 31a2fbb390fe ("x86/ptrace: Fix possible
spectre-v1 in ptrace_get_debugreg()") when backporting it, as was
graciously pointed out at
https://grsecurity.net/teardown_of_a_failed_linux_lts_spectre_fix.php
Resolve the upstream difference with the stable kernel merge to properly
protect things.
Reported-by: Brad Spengler <spender@grsecurity.net>
Cc: Dianzhang Chen <dianzhangchen0@gmail.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: <bp@alien8.de>
Cc: <hpa@zytor.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/x86/kernel/ptrace.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/arch/x86/kernel/ptrace.c b/arch/x86/kernel/ptrace.c index aeba77881d85..516ec7586a5f 100644 --- a/arch/x86/kernel/ptrace.c +++ b/arch/x86/kernel/ptrace.c @@ -652,11 +652,10 @@ static unsigned long ptrace_get_debugreg(struct task_struct *tsk, int n) { struct thread_struct *thread = &tsk->thread; unsigned long val = 0; - int index = n; if (n < HBP_NUM) { + int index = array_index_nospec(n, HBP_NUM); struct perf_event *bp = thread->ptrace_bps[index]; - index = array_index_nospec(index, HBP_NUM); if (bp) val = bp->hw.info.address; |