Re: PROBLEM: syzkaller found / reduced C repro for non-fatal unchecked MSR access error

From: Peter Zijlstra
Date: Fri Jan 11 2019 - 08:59:55 EST


On Fri, Jan 11, 2019 at 01:37:50PM +0000, Esme wrote:
> âââââââ Original Message âââââââ
> On Friday, January 11, 2019 5:02 AM, Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:
>
> > On Thu, Jan 10, 2019 at 11:21:16PM +0000, Esme wrote:
> >
> > > Attached is a fairly small C repro I did not see any references to
> > > this possible flaw (unchecked MSR access) in relation to
> > > __NR_perf_event_open
> > > Attached is the config directly extracted from proc. This is the call
> > > stack in relation to the MSR access error (5.0.0-rc1+), I get a very
> > > similar stack running this test case on a stock Ubuntu
> > > "4.18.0-11-generic" (pasted after this one).
> >
> > > -- Esme
> > > [ 70.228744] unchecked MSR access error: WRMSR to 0xc0010000 (tried to write 0x0000020000130076) at rIP: 0xffffffff812dde28 (native_write_msr+0x8/0x30)
> >
> > That's K7_EVNTSEL0. What kind of hardware are you running this on?
>
> QEMU emulator version 3.0.93 (v3.1.0-rc3-dirty)
> [ 0.000000] DMI: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.12.0-0-ga698c8995f-prebuilt.qemu.org 04/01/2014
>
>
> [ 0.000000] Linux version 4.18.0-11-generic (buildd@lcy01-amd64-027) (gcc version 8.2.0 (Ubuntu 8.2.0-7ubuntu1)) #12-Ubuntu SMP Tue Oct 23 19:22:37 UTC 2018 (Ubuntu 4.18.0-11.12-generic 4.18.12)
> [ 0.000000] Command line: BOOT_IMAGE=/boot/vmlinuz-4.18.0-11-generic root=UUID=3a43ccb9-a433-4296-8dc5-0443f2a32128 ro quiet splash vt.handoff=1
> [ 0.000000] KERNEL supported cpus:
> [ 0.000000] Intel GenuineIntel
> [ 0.000000] AMD AuthenticAMD
> [ 0.000000] Centaur CentaurHauls
> [ 0.000000] random: get_random_u32 called from bsp_init_amd+0x205/0x2a0 with crng_init=0
> [ 0.000000] x86/fpu: Supporting XSAVE feature 0x001: 'x87 floating point registers'
> [ 0.000000] x86/fpu: Supporting XSAVE feature 0x002: 'SSE registers'
> [ 0.000000] x86/fpu: Supporting XSAVE feature 0x004: 'AVX registers'
> [ 0.000000] x86/fpu: xstate_offset[2]: 576, xstate_sizes[2]: 256
> [ 0.000000] x86/fpu: Enabled xstate features 0x7, context size is 832 bytes, using 'standard' format.

Feh, then you get to figure out how the heck it passes
check_hw_exists().

Stupid virt crap _again_.