Skip to content

Commit

Permalink
perf/x86: Fix broken LBR fixup code
Browse files Browse the repository at this point in the history
I noticed that the LBR fixups were not working anymore
on programs where they used to. I tracked this down to
a recent change to copy_from_user_nmi():

 db0dc75 ("perf/x86: Check user address explicitly in copy_from_user_nmi()")

This commit added a call to __range_not_ok() to the
copy_from_user_nmi() routine. The problem is that the logic
of the test must be reversed. __range_not_ok() returns 0 if the
range is VALID. We want to return early from copy_from_user_nmi()
if the range is NOT valid.

Signed-off-by: Stephane Eranian <[email protected]>
Signed-off-by: Peter Zijlstra <[email protected]>
Acked-by: Arun Sharma <[email protected]>
Link: http://lkml.kernel.org/r/20120611134426.GA7542@quad
Signed-off-by: Ingo Molnar <[email protected]>
  • Loading branch information
Stephane Eranian authored and Ingo Molnar committed Jun 13, 2012
1 parent 9ee6ddc commit 25f4298
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion arch/x86/lib/usercopy.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ copy_from_user_nmi(void *to, const void __user *from, unsigned long n)
void *map;
int ret;

if (__range_not_ok(from, n, TASK_SIZE) == 0)
if (__range_not_ok(from, n, TASK_SIZE))
return len;

do {
Expand Down

0 comments on commit 25f4298

Please sign in to comment.