[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Mon, 8 Aug 2016 11:21:20 -0700
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Borislav Petkov <bp@...en8.de>
Cc: Ville Syrjälä <ville.syrjala@...ux.intel.com>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
"the arch/x86 maintainers" <x86@...nel.org>,
Borislav Petkov <bp@...e.de>,
"H . Peter Anvin" <hpa@...or.com>,
Andy Lutomirski <luto@...capital.net>,
Brian Gerst <brgerst@...il.com>,
Denys Vlasenko <dvlasenk@...hat.com>,
Peter Zijlstra <peterz@...radead.org>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...nel.org>, Jiri Kosina <jkosina@...e.cz>
Subject: Re: [PATCH] x86/hweight: Don't clobber %rdi
On Mon, Aug 8, 2016 at 11:04 AM, Borislav Petkov <bp@...en8.de> wrote:
>
> Hmm, I've been staring at asm for the last hours and my head is spinning
> now, so can you please point me at the exact where this happens. I can't
> find it in x86_perf_event_update().
The corruption could easily have happened long long before.
With a random register clobbered (by a function that is *not* a C
function - it's a replacement for the "popcnt %rdi, %rax"
instruction), you might end up with memory corruption somewhere, and
then an oops much later.
That said, in this case it's likely something like the the
intel_pmu_init() doing
c->weight = hweight64(c->idxmsk64);
in arch/x86/events/intel/core.c, which then corrupts something related
to the event constraints, and then you get the oops in
x86_perf_event_update() later.
> In any case, it is not a good idea to do the compiler's work. :-\
The compiler has absolutely nothing to do with this. It's all assembly
language and an inline asm.
We *used* to try to have the compiler generate the code. That's what
caused problems.
Linus
Powered by blists - more mailing lists