lkml.org 
[lkml]   [2019]   [Jul]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [GIT pull] x86/pti for 5.3-rc1
On Mon, Jul 8, 2019 at 2:22 AM Thomas Gleixner <tglx@linutronix.de> wrote:
>
> @@ -643,9 +644,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];
> + index = array_index_nospec(index, HBP_NUM);
> + struct perf_event *bp = thread->ptrace_bps[index];

This causes a new warning:

warning: ISO C90 forbids mixed declarations and code

and I'm fixing it up in the merge as follows:

@@@ -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;

Holler if I did something stupid.

Linus

\
 
 \ /
  Last update: 2019-07-08 21:25    [W:0.092 / U:3.116 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site