[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20191120222426.3060.18462.stgit@localhost.localdomain>
Date: Wed, 20 Nov 2019 14:25:53 -0800
From: Alexander Duyck <alexander.duyck@...il.com>
To: tglx@...utronix.de, linux-kernel@...r.kernel.org
Cc: bp@...en8.de, mingo@...nel.org, luto@...nel.org
Subject: [x86/iopl PATCH] x86/ioperm: Fix use of deprecated config option
From: Alexander Duyck <alexander.h.duyck@...ux.intel.com>
In "x86/ioperm: Extend IOPL config to control ioperm()" the config option
X86_IOPL_EMULATION was replaced with X86_IOPL_IOPERM. However it appears
that there was at least one spot missed as tss_update_io_bitmap still had a
reference to it contained in the code.
The result of this is that it exposed a NULL pointer dereference as seen
below with a linux-next next-20191120 kernel:
[ 17.626562] BUG: kernel NULL pointer dereference, address: 0000000000000000
[ 17.626563] #PF: supervisor read access in kernel mode
[ 17.626564] #PF: error_code(0x0000) - not-present page
[ 17.626564] PGD 0 P4D 0
[ 17.626566] Oops: 0000 [#1] SMP PTI
[ 17.626568] CPU: 5 PID: 1542 Comm: ovs-vswitchd Tainted: G W
5.4.0-rc8-next-20191120 #125
[ 17.626568] Hardware name: ASUSTeK COMPUTER INC. Z10PE-D8 WS/Z10PE-D8 WS,
BIOS 3903 09/11/2018
[ 17.626570] RIP: 0010:tss_update_io_bitmap+0x4e/0x180
[ 17.626572] Code: 10 31 c0 65 48 03 1d 69 54 5d 6d 65 48 8b 04 25 40 8c 01 00
48 8b 10 f7 c2 00 00 40 00 0f 84 8c 00 00 00 4c 8b a0 c0 22 00 00 <49> 8b 04 24
48 39 43 68 74 2e 8b 53 70 41 39 54 24 0c 48 8d 7b 78
[ 17.626572] RSP: 0018:ffffb8888a0ebf08 EFLAGS: 00010006
[ 17.626573] RAX: ffff8a429811a680 RBX: ffff8a4c3f946000 RCX: 0000000000000011
[ 17.626574] RDX: 0000000000400080 RSI: 0000000000400080 RDI: 0000000000000000
[ 17.626575] RBP: ffffb8888a0ebf30 R08: 00007ffffb5d7ce0 R09: 0000000000000000
[ 17.626576] R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000
[ 17.626576] R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
[ 17.626578] FS: 00007f68a9635c40(0000) GS:ffff8a4c3f940000(0000)
knlGS:0000000000000000
[ 17.626578] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 17.626579] CR2: 0000000000000000 CR3: 000000103572a001 CR4: 00000000001606e0
[ 17.626580] Call Trace:
[ 17.626582] ? syscall_slow_exit_work+0x39/0xdb
[ 17.626584] do_syscall_64+0x1a5/0x200
[ 17.626586] entry_SYSCALL_64_after_hwframe+0x44/0xa9
[ 17.626587] RIP: 0033:0x7f68a7aff797
[ 17.626588] Code: 73 01 c3 48 8b 0d d9 86 2c 00 f7 d8 64 89 01 48 83 c8 ff c3
66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 b8 ac 00 00 00 0f 05 <48> 3d 01 f0
ff ff 73 01 c3 48 8b 0d a9 86 2c 00 f7 d8 64 89 01 48
[ 17.626588] RSP: 002b:00007ffffb5d8218 EFLAGS: 00000202 ORIG_RAX:
00000000000000ac
[ 17.626589] RAX: 0000000000000000 RBX: 0000000000000014 RCX: 00007f68a7aff797
[ 17.626590] RDX: 00007ffffb5d8370 RSI: 00007ffffb5d8358 RDI: 0000000000000003
[ 17.626590] RBP: 00000000000000e6 R08: 0000000000000000 R09: 0000000000000000
[ 17.626591] R10: 00007ffffb5d7ce0 R11: 0000000000000202 R12: 0000564c9e3e2d80
[ 17.626592] R13: 00007ffffb5d8370 R14: 00007ffffb5d8358 R15: 0000000000000002
[ 17.626593] Modules linked in: iptable_filter sb_edac(+) acpi_cpufreq(-)
pcc_cpufreq(-) x86_pkg_temp_thermal intel_powerclamp coretemp kvm_intel
snd_hda_codec_realtek snd_hda_codec_generic ledtrig_audio kvm snd_hda_intel
snd_intel_dspcfg irqbypass snd_hda_codec snd_hda_core snd_hwdep crct10dif_pclmul
eeepc_wmi crc32_pclmul snd_seq asus_wmi vfat snd_seq_device sparse_keymap rfkill
snd_pcm ghash_clmulni_intel video wmi_bmof mxm_wmi fat aesni_intel snd_timer
crypto_simd ixgbe snd cryptd mei_me mdio glue_helper pcspkr joydev dca i2c_i801
lpc_ich soundcore mei ipmi_si ipmi_devintf ipmi_msghandler wmi acpi_power_meter
acpi_pad ip_tables xfs libcrc32c ast drm_vram_helper drm_ttm_helper ttm
drm_kms_helper syscopyarea sysfillrect sysimgblt fb_sys_fops drm ahci libahci
crc32c_intel libata nvme nvme_core dm_mod
[ 17.626619] CR2: 0000000000000000
[ 17.626633] ---[ end trace e5d62f4aae005116 ]---
Fixes: 111e7b15cf10 ("x86/ioperm: Extend IOPL config to control ioperm() as well")
Signed-off-by: Alexander Duyck <alexander.h.duyck@...ux.intel.com>
---
arch/x86/kernel/process.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c
index 7964d7db9366..bd2a11ca5dd6 100644
--- a/arch/x86/kernel/process.c
+++ b/arch/x86/kernel/process.c
@@ -382,8 +382,7 @@ void tss_update_io_bitmap(void)
if (test_thread_flag(TIF_IO_BITMAP)) {
struct thread_struct *t = ¤t->thread;
- if (IS_ENABLED(CONFIG_X86_IOPL_EMULATION) &&
- t->iopl_emul == 3) {
+ if (IS_ENABLED(CONFIG_X86_IOPL_IOPERM) && t->iopl_emul == 3) {
*base = IO_BITMAP_OFFSET_VALID_ALL;
} else {
struct io_bitmap *iobm = t->io_bitmap;
Powered by blists - more mailing lists