kernel oops loading i915 after "x86/asm: Pin sensitive CR4 bits" (873d50d58)

From: Xi Ruoyao
Date: Wed Jul 10 2019 - 01:44:29 EST


Hello,

When I try to build and run the latest mainline kernel, it Oops loading i915
module:

BUG: unable to handle page fault for address: ffffffff9edc1598
#PF: supervisor write access in kernel mode
#PF: error_code(0x0003) - permissions violation
PGD 1a20c067 P4D 1a20c067 PUD 1a20d063 PMD 8000000019e000e1
Oops: 0003 [#1] SMP PTI

The complete log is attached.

Bisection tells "x86/asm: Pin sensitive CR4 bits" (873d50d58) is the first "bad"
commit. I can revert it and also "x86/asm: Pin sensitive CR0 bits" (8dbec27a2)
to make the kernel "seems to" work.

I'm not a kernel expert so I can't tell if there is a bug in Kees' patch, or his
patch exploits a bug in i915 or module loader.

My CPU is an i3-3217u. If a kdump is helpful I'll try to gather it.
--
Xi Ruoyao <xry111@xxxxxxxxxxxxxxxx>
School of Aerospace Science and Technology, Xidian University
Jul 10 12:58:52 xry111-laptop kernel: BUG: unable to handle page fault for address: ffffffff9edc1598
Jul 10 12:58:52 xry111-laptop kernel: #PF: supervisor write access in kernel mode
Jul 10 12:58:52 xry111-laptop kernel: #PF: error_code(0x0003) - permissions violation
Jul 10 12:58:52 xry111-laptop kernel: PGD 1a20c067 P4D 1a20c067 PUD 1a20d063 PMD 8000000019e000e1
Jul 10 12:58:52 xry111-laptop kernel: Oops: 0003 [#1] SMP PTI
Jul 10 12:58:52 xry111-laptop kernel: CPU: 2 PID: 151 Comm: systemd-udevd Not tainted 5.2.0+ #54
Jul 10 12:58:52 xry111-laptop kernel: Hardware name: LENOVO 20175/INVALID, BIOS 66CN54WW 01/21/2013
Jul 10 12:58:52 xry111-laptop kernel: RIP: 0010:static_key_set_mod.isra.0+0x10/0x30
Jul 10 12:58:52 xry111-laptop kernel: Code: 48 8b 37 83 e6 03 48 09 c6 48 89 37 c3 66 66 2e 0f 1f 84 00 00 00 00 00 66 90 48 89 f0 a8 03 75 0d 48 8b 37 83 e6 03 48 09 c6 <48> 89 37 c3 0f 0b 48 8b 37 83 e6 03 48 09 c6 48 89 37 c3 66 66 2e
Jul 10 12:58:52 xry111-laptop kernel: RSP: 0000:ffffa606c032bc98 EFLAGS: 00010286
Jul 10 12:58:52 xry111-laptop kernel: RAX: ffff9981ddce30a0 RBX: ffffffff9edc1590 RCX: 0000000000000000
Jul 10 12:58:52 xry111-laptop kernel: RDX: 0000000000000020 RSI: ffff9981ddce30a0 RDI: ffffffff9edc1598
Jul 10 12:58:52 xry111-laptop kernel: RBP: ffffffffc06f4000 R08: ffff9981e6003980 R09: ffff9981ddce30a0
Jul 10 12:58:52 xry111-laptop kernel: R10: 0000000000000000 R11: 0000000000028b56 R12: ffffffffc06f8880
Jul 10 12:58:52 xry111-laptop kernel: R13: ffff9981ddce3080 R14: ffffffffc06f4008 R15: ffffffffc06f6dc0
Jul 10 12:58:52 xry111-laptop kernel: FS: 00007f992dd9a680(0000) GS:ffff9981e7080000(0000) knlGS:0000000000000000
Jul 10 12:58:52 xry111-laptop kernel: CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
Jul 10 12:58:52 xry111-laptop kernel: CR2: ffffffff9edc1598 CR3: 00000002233aa001 CR4: 00000000001606e0
Jul 10 12:58:52 xry111-laptop kernel: Call Trace:
Jul 10 12:58:52 xry111-laptop kernel: jump_label_module_notify+0x1e7/0x2b0
Jul 10 12:58:52 xry111-laptop kernel: notifier_call_chain+0x44/0x70
Jul 10 12:58:52 xry111-laptop kernel: blocking_notifier_call_chain+0x43/0x60
Jul 10 12:58:52 xry111-laptop kernel: load_module+0x1bcb/0x2490
Jul 10 12:58:52 xry111-laptop kernel: ? vfs_read+0x11f/0x150
Jul 10 12:58:52 xry111-laptop kernel: ? __do_sys_finit_module+0xbf/0xe0
Jul 10 12:58:52 xry111-laptop kernel: __do_sys_finit_module+0xbf/0xe0
Jul 10 12:58:52 xry111-laptop kernel: do_syscall_64+0x43/0x110
Jul 10 12:58:52 xry111-laptop kernel: entry_SYSCALL_64_after_hwframe+0x44/0xa9
Jul 10 12:58:52 xry111-laptop kernel: RIP: 0033:0x7f992e2eeaf9
Jul 10 12:58:52 xry111-laptop kernel: Code: 00 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 67 73 0d 00 f7 d8 64 89 01 48
Jul 10 12:58:52 xry111-laptop kernel: RSP: 002b:00007ffca220d288 EFLAGS: 00000246 ORIG_RAX: 0000000000000139
Jul 10 12:58:52 xry111-laptop kernel: RAX: ffffffffffffffda RBX: 00000000009b8da0 RCX: 00007f992e2eeaf9
Jul 10 12:58:52 xry111-laptop kernel: RDX: 0000000000000000 RSI: 00007f992e464885 RDI: 0000000000000010
Jul 10 12:58:52 xry111-laptop kernel: RBP: 0000000000020000 R08: 0000000000000000 R09: 00000000009c45c0
Jul 10 12:58:52 xry111-laptop kernel: R10: 0000000000000010 R11: 0000000000000246 R12: 00007f992e464885
Jul 10 12:58:52 xry111-laptop kernel: R13: 0000000000000000 R14: 00000000009acc50 R15: 00000000009b8da0
Jul 10 12:58:52 xry111-laptop kernel: Modules linked in: kvm_intel(+) kvm irqbypass hid_sensor_hub crc32_pclmul mfd_core i2c_i801 snd_hda_intel i915(+) intel_gtt snd_hda_codec i2c_algo_bit snd_hwdep snd_hda_core drm_kms_helper snd_pcm syscopyarea sysfillrect sysimgblt fb_sys_fops drm hid_multitouch ideapad_laptop sparse_keymap hid_generic wmi efivarfs
Jul 10 12:58:52 xry111-laptop kernel: CR2: ffffffff9edc1598
Jul 10 12:58:52 xry111-laptop kernel: ---[ end trace dbeb7e66daa9bdca ]---
Jul 10 12:58:52 xry111-laptop kernel: RIP: 0010:static_key_set_mod.isra.0+0x10/0x30
Jul 10 12:58:52 xry111-laptop kernel: Code: 48 8b 37 83 e6 03 48 09 c6 48 89 37 c3 66 66 2e 0f 1f 84 00 00 00 00 00 66 90 48 89 f0 a8 03 75 0d 48 8b 37 83 e6 03 48 09 c6 <48> 89 37 c3 0f 0b 48 8b 37 83 e6 03 48 09 c6 48 89 37 c3 66 66 2e
Jul 10 12:58:52 xry111-laptop kernel: RSP: 0000:ffffa606c032bc98 EFLAGS: 00010286
Jul 10 12:58:52 xry111-laptop kernel: RAX: ffff9981ddce30a0 RBX: ffffffff9edc1590 RCX: 0000000000000000
Jul 10 12:58:52 xry111-laptop kernel: RDX: 0000000000000020 RSI: ffff9981ddce30a0 RDI: ffffffff9edc1598
Jul 10 12:58:52 xry111-laptop kernel: RBP: ffffffffc06f4000 R08: ffff9981e6003980 R09: ffff9981ddce30a0
Jul 10 12:58:52 xry111-laptop kernel: R10: 0000000000000000 R11: 0000000000028b56 R12: ffffffffc06f8880
Jul 10 12:58:52 xry111-laptop kernel: R13: ffff9981ddce3080 R14: ffffffffc06f4008 R15: ffffffffc06f6dc0
Jul 10 12:58:52 xry111-laptop kernel: FS: 00007f992dd9a680(0000) GS:ffff9981e7080000(0000) knlGS:0000000000000000
Jul 10 12:58:52 xry111-laptop kernel: CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
Jul 10 12:58:52 xry111-laptop kernel: CR2: ffffffff9edc1598 CR3: 00000002233aa001 CR4: 00000000001606e0