[artful] panic in update_stack_state when reading /proc/<pid>/stack on i386
Bug #1747263 reported by
Andy Whitcroft
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
linux (Ubuntu) |
In Progress
|
High
|
Unassigned | ||
Artful |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
It seems that when reading /proc/<pid>/stack we can sometimes triggers a panic on i386. This is triggered by an unsafe pointer access when validating the stack in the stack unwinder. This is reproducible in a 4 cpu 32bit VM with the stress-ng /proc stressor.
CVE References
Changed in linux (Ubuntu): | |
importance: | Undecided → High |
Changed in linux (Ubuntu Artful): | |
status: | New → Fix Committed |
To post a comment you must log in.
The below commit has been confirmed as the fix for this:
commit 62dd86ac01f9fb6 386d7f8c6b389c3 ea4582a50a
Author: Josh Poimboeuf <email address hidden>
Date: Mon Oct 9 20:20:02 2017 -0500
x86/unwind: Fix dereference of untrusted pointer
Tetsuo Handa and Fengguang Wu reported a panic in the unwinder:
BUG: unable to handle kernel NULL pointer dereference at 000001f2 stack_state+ 0xd4/0x340
IP: update_
*pde = 00000000
Oops: 0000 [#1] PREEMPT SMP rc4-00170- gb09be67 #592 171302- gandalf 04/01/2014 stack_state+ 0xd4/0x340 next_frame+ 0xea/0x400 start+0xf5/ 0x180 stack_trace+ 0x81/0x160 trace+0x20/ 0x30 acquire+ 0xfa5/0x12f0 0x1c2/0x230 0x3a/0xf0 lock+0x42/ 0x50 0x3a/0xf0 0x3a/0xf0 processor_ id+0x12/ 0x20 periodic+ 0x23/0xc0 timer_interrupt +0x63/0x70 apic_timer_ interrupt+ 0x235/0x6a0 timer_interrupt +0x37/0x3c stack_state+ 0xd4/0x340 SS:ESP: 0068:bb3adc3f
CPU: 0 PID: 18728 Comm: 01-cpu-hotplug Not tainted 4.13.0-
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.9.3-20161025_
task: bb0b53c0 task.stack: bb3ac000
EIP: update_
EFLAGS: 00010002 CPU: 0
EAX: 0000a570 EBX: bb3adccb ECX: 0000f401 EDX: 0000a570
ESI: 00000001 EDI: 000001ba EBP: bb3adc6b ESP: bb3adc3f
DS: 007b ES: 007b FS: 00d8 GS: 0000 SS: 0068
CR0: 80050033 CR2: 000001f2 CR3: 0b3a7000 CR4: 00140690
DR0: 00000000 DR1: 00000000 DR2: 00000000 DR3: 00000000
DR6: fffe0ff0 DR7: 00000400
Call Trace:
? unwind_
? __unwind_
? __save_
? save_stack_
? __lock_
? lock_acquire+
? tick_periodic+
? _raw_spin_
? tick_periodic+
? tick_periodic+
? debug_smp_
? tick_handle_
? local_apic_
? smp_trace_
? trace_apic_
? strrchr+0x23/0x50
Code: 0f 95 c1 89 c7 89 45 e4 0f b6 c1 89 c6 89 45 dc 8b 04 85 98 cb 74 bc 88 4d e3 89 45 f0 83 c0 01 84 c9 89 04 b5 98 cb 74 bc 74 3b <8b> 47 38 8b 57 34 c6 43 1d 01 25 00 00 02 00 83 e2 03 09 d0 83
EIP: update_
CR2: 00000000000001f2
---[ end trace 0d147fd4aba8ff50 ]---
Kernel panic - not syncing: Fatal exception in interrupt
On x86-32, after decoding a frame pointer to get a regs address,
regs_size() dereferences the regs pointer when it checks regs->cs to see
if the regs are user mode. This is dangerous because it's possible that
what looks like a decoded frame pointer is actually a corrupt value, and
we don't want the unwinder to make things worse.
Instead of calling regs_size() on an unsafe pointer, just assume they're
kernel regs to start with. Later, once it's safe to access the regs, we
can do the user mode check and corresponding safety check for the
remaining two regs.
Reported- and-tested- by: Tetsuo Handa <email address hidden> and-tested- by: Fengguang Wu <email address hidden>
Reported-
Signed-off-by: Josh Poimboeuf <email address hidden>
Cc: Byungchul Park <email address hidden>
Cc: LKP <lkp@01.org>
Cc: Linus Torvalds <email address hidden>
Cc: Peter Zijlstra <email address hidden>
Cc: Thomas Gleixner <email address hidden>
...