|
|
@@ -24,6 +24,7 @@
|
|
|
#include <linux/rcupdate.h>
|
|
|
#include <linux/export.h>
|
|
|
#include <linux/context_tracking.h>
|
|
|
+#include <linux/nospec.h>
|
|
|
|
|
|
#include <linux/uaccess.h>
|
|
|
#include <asm/pgtable.h>
|
|
|
@@ -651,9 +652,11 @@ 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) {
|
|
|
- struct perf_event *bp = thread->ptrace_bps[n];
|
|
|
+ struct perf_event *bp = thread->ptrace_bps[index];
|
|
|
+ index = array_index_nospec(index, HBP_NUM);
|
|
|
|
|
|
if (bp)
|
|
|
val = bp->hw.info.address;
|