linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* stack out-of-bounds write in mce-inject.c
@ 2018-04-27 15:24 Dmitry Vyukov
  2018-04-27 15:41 ` Borislav Petkov
  0 siblings, 1 reply; 6+ messages in thread
From: Dmitry Vyukov @ 2018-04-27 15:24 UTC (permalink / raw)
  To: tony.luck, Borislav Petkov, Thomas Gleixner, Ingo Molnar,
	H. Peter Anvin, the arch/x86 maintainers, linux-edac, LKML

Hi,

Opening /sys/kernel/debug/mce-inject/flags overwrites stack:

==================================================================
BUG: KASAN: stack-out-of-bounds in vsnprintf+0x1b23/0x1b40 lib/vsprintf.c:2365
Write of size 1 at addr ffff8800627b7abb by task egrep/4309

CPU: 3 PID: 4309 Comm: egrep Not tainted 4.17.0-rc2+ #179
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1 04/01/2014
Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x1b9/0x294 lib/dump_stack.c:113
 print_address_description+0x6c/0x20b mm/kasan/report.c:256
 kasan_report_error mm/kasan/report.c:366 [inline]
 kasan_report.cold.7+0x242/0x2fe mm/kasan/report.c:424
 __asan_report_store1_noabort+0x17/0x20 mm/kasan/report.c:447
 vsnprintf+0x1b23/0x1b40 lib/vsprintf.c:2365
 sprintf+0xa7/0xd0 lib/vsprintf.c:2494
 flags_read+0xa3/0xf0 arch/x86/kernel/cpu/mcheck/mce-inject.c:345
 full_proxy_read+0x125/0x190 fs/debugfs/file.c:195
 __vfs_read+0x10f/0xa50 fs/read_write.c:416
 vfs_read+0x17f/0x3d0 fs/read_write.c:452
 ksys_read+0xf9/0x250 fs/read_write.c:578
 __do_sys_read fs/read_write.c:588 [inline]
 __se_sys_read fs/read_write.c:586 [inline]
 __x64_sys_read+0x73/0xb0 fs/read_write.c:586
 do_syscall_64+0x1b1/0x800 arch/x86/entry/common.c:287
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x7fb17c6c3310
RSP: 002b:00007ffca98af8e8 EFLAGS: 00000246 ORIG_RAX: 0000000000000000
RAX: ffffffffffffffda RBX: 0000000001d72000 RCX: 00007fb17c6c3310
RDX: 0000000000008000 RSI: 0000000001d72000 RDI: 0000000000000005
RBP: 0000000000001000 R08: 0000000001d72000 R09: 00007fb17c979e90
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000008000 R14: 0000000000000000 R15: 0000000000000003

The buggy address belongs to the page:
page:ffffea000189edc0 count:0 mapcount:0 mapping:0000000000000000 index:0x0
flags: 0x1fffc0000000000()
raw: 01fffc0000000000 0000000000000000 0000000000000000 00000000ffffffff
raw: 0000000000000000 ffffea0001890101 0000000000000000 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8800627b7980: f3 f3 f3 f3 00 00 00 00 00 00 00 f1 f1 f1 f1 00
 ffff8800627b7a00: 00 00 f2 f3 f3 f3 f3 00 00 00 00 00 00 00 00 00
>ffff8800627b7a80: 00 00 00 f1 f1 f1 f1 03 f2 f2 f2 f3 f3 f3 f3 00
                                        ^
 ffff8800627b7b00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff8800627b7b80: 00 00 00 00 00 f1 f1 f1 f1 00 00 f2 f2 f2 f2 f2
==================================================================

On upstream commit 0644f186fc9d77bb5bd198369e59fb28927a3692.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-05-06 10:52 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-27 15:24 stack out-of-bounds write in mce-inject.c Dmitry Vyukov
2018-04-27 15:41 ` Borislav Petkov
2018-04-27 16:06   ` Dmitry Vyukov
2018-04-27 16:37     ` [PATCH] x86, mce: Fix stack out-of-bounds write in mce-inject.c:flags_read() Luck, Tony
2018-04-27 16:59       ` Borislav Petkov
2018-05-06 10:52       ` [tip:ras/core] x86/MCE: Fix stack out-of-bounds write in mce-inject.c: Flags_read() tip-bot for Luck, Tony

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).