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>
This commit is contained in:
parent
8c0932cd81
commit
61263fbe57
1 changed files with 1 additions and 2 deletions
|
@ -698,11 +698,10 @@ static unsigned long ptrace_get_debugreg(struct task_struct *tsk, int n)
|
||||||
{
|
{
|
||||||
struct thread_struct *thread = &tsk->thread;
|
struct thread_struct *thread = &tsk->thread;
|
||||||
unsigned long val = 0;
|
unsigned long val = 0;
|
||||||
int index = n;
|
|
||||||
|
|
||||||
if (n < HBP_NUM) {
|
if (n < HBP_NUM) {
|
||||||
|
int index = array_index_nospec(n, HBP_NUM);
|
||||||
struct perf_event *bp = thread->ptrace_bps[index];
|
struct perf_event *bp = thread->ptrace_bps[index];
|
||||||
index = array_index_nospec(index, HBP_NUM);
|
|
||||||
|
|
||||||
if (bp)
|
if (bp)
|
||||||
val = bp->hw.info.address;
|
val = bp->hw.info.address;
|
||||||
|
|
Loading…
Add table
Reference in a new issue