perf/x86/msr: Fix possible Spectre-v1 indexing in the MSR driver
authorPeter Zijlstra <peterz@infradead.org>
Fri, 20 Apr 2018 12:23:36 +0000 (14:23 +0200)
committerIngo Molnar <mingo@kernel.org>
Sat, 5 May 2018 06:37:29 +0000 (08:37 +0200)
commit06ce6e9b6d6c09d4129c6e24a1314a395d816c10
tree3b7e42aa15470dccdf7ec2463ace66f814440eaa
parent46b1b577229a091b137831becaa0fae8690ee15a
perf/x86/msr: Fix possible Spectre-v1 indexing in the MSR driver

> arch/x86/events/msr.c:178 msr_event_init() warn: potential spectre issue 'msr' (local cap)

Userspace controls @attr, sanitize cfg (attr->config) before using it
to index an array.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: <stable@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Vince Weaver <vincent.weaver@maine.edu>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
arch/x86/events/msr.c