syzbot


upstream boot error: KASAN: slab-out-of-bounds Write in hpet_alloc

Status: fixed on 2020/02/18 14:31
Subsystems: kernel
[Documentation on labels]
Reported-by: syzbot+2b149e3a2468e54d2178@syzkaller.appspotmail.com
Fix commit: 98c49f1746ac char: hpet: Fix out-of-bounds read bug
First crash: 1595d, last: 1594d
Discussions (1)
Title Replies (including bot) Last reply
upstream boot error: KASAN: slab-out-of-bounds Write in hpet_alloc 1 (2) 2020/01/30 10:14

Sample crash report:
pci 0000:00:1f.3: reg 0x20: [io  0x0700-0x073f]
ACPI: PCI Interrupt Link [LNKA] (IRQs 5 *10 11)
ACPI: PCI Interrupt Link [LNKB] (IRQs 5 *10 11)
ACPI: PCI Interrupt Link [LNKC] (IRQs 5 10 *11)
ACPI: PCI Interrupt Link [LNKD] (IRQs 5 10 *11)
ACPI: PCI Interrupt Link [LNKE] (IRQs 5 *10 11)
ACPI: PCI Interrupt Link [LNKF] (IRQs 5 *10 11)
ACPI: PCI Interrupt Link [LNKG] (IRQs 5 10 *11)
ACPI: PCI Interrupt Link [LNKH] (IRQs 5 10 *11)
ACPI: PCI Interrupt Link [GSIA] (IRQs *16)
ACPI: PCI Interrupt Link [GSIB] (IRQs *17)
ACPI: PCI Interrupt Link [GSIC] (IRQs *18)
ACPI: PCI Interrupt Link [GSID] (IRQs *19)
ACPI: PCI Interrupt Link [GSIE] (IRQs *20)
ACPI: PCI Interrupt Link [GSIF] (IRQs *21)
ACPI: PCI Interrupt Link [GSIG] (IRQs *22)
ACPI: PCI Interrupt Link [GSIH] (IRQs *23)
iommu: Default domain type: Translated 
pci 0000:00:01.0: vgaarb: setting as boot VGA device
pci 0000:00:01.0: vgaarb: VGA device added: decodes=io+mem,owns=io+mem,locks=none
pci 0000:00:01.0: vgaarb: bridge control possible
vgaarb: loaded
SCSI subsystem initialized
ACPI: bus type USB registered
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
mc: Linux media interface: v0.10
videodev: Linux video capture interface: v2.00
pps_core: LinuxPPS API ver. 1 registered
pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
PTP clock support registered
EDAC MC: Ver: 3.0.0
Advanced Linux Sound Architecture Driver Initialized.
PCI: Using ACPI for IRQ routing
Bluetooth: Core ver 2.22
NET: Registered protocol family 31
Bluetooth: HCI device and connection manager initialized
Bluetooth: HCI socket layer initialized
Bluetooth: L2CAP socket layer initialized
Bluetooth: SCO socket layer initialized
NET: Registered protocol family 8
NET: Registered protocol family 20
NetLabel: Initializing
NetLabel:  domain hash size = 128
NetLabel:  protocols = UNLABELED CIPSOv4 CALIPSO
NetLabel:  unlabeled traffic allowed by default
nfc: nfc_init: NFC Core ver 0.1
NET: Registered protocol family 39
==================================================================
BUG: KASAN: slab-out-of-bounds in hpet_alloc+0x442/0x490 drivers/char/hpet.c:871
Write of size 4 at addr ffff8880273a45d8 by task swapper/0/1

CPU: 1 PID: 1 Comm: swapper/0 Not tainted 5.5.0-syzkaller #0
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.12.0-59-gc9ba5276e321-prebuilt.qemu.org 04/01/2014
Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x197/0x210 lib/dump_stack.c:118
 print_address_description.constprop.0.cold+0xd4/0x30b mm/kasan/report.c:374
 __kasan_report.cold+0x1b/0x32 mm/kasan/report.c:506
 kasan_report+0x12/0x20 mm/kasan/common.c:639
 __asan_report_store4_noabort+0x17/0x20 mm/kasan/generic_report.c:139
 hpet_alloc+0x442/0x490 drivers/char/hpet.c:871
 hpet_reserve_platform_timers+0x1fc/0x245 arch/x86/kernel/hpet.c:222
 hpet_late_init+0x2f4/0x38b arch/x86/kernel/hpet.c:954
 do_one_initcall+0x120/0x820 init/main.c:939
 do_initcall_level init/main.c:1007 [inline]
 do_initcalls init/main.c:1015 [inline]
 do_basic_setup init/main.c:1032 [inline]
 kernel_init_freeable+0x4ca/0x570 init/main.c:1203
 kernel_init+0x12/0x1bf init/main.c:1110
 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:352

Allocated by task 1:
 save_stack+0x23/0x90 mm/kasan/common.c:72
 set_track mm/kasan/common.c:80 [inline]
 __kasan_kmalloc mm/kasan/common.c:513 [inline]
 __kasan_kmalloc.constprop.0+0xcf/0xe0 mm/kasan/common.c:486
 kasan_kmalloc+0x9/0x10 mm/kasan/common.c:527
 __do_kmalloc mm/slab.c:3656 [inline]
 __kmalloc+0x163/0x770 mm/slab.c:3665
 kmalloc include/linux/slab.h:561 [inline]
 kzalloc include/linux/slab.h:670 [inline]
 hpet_alloc+0x12b/0x490 drivers/char/hpet.c:858
 hpet_reserve_platform_timers+0x1fc/0x245 arch/x86/kernel/hpet.c:222
 hpet_late_init+0x2f4/0x38b arch/x86/kernel/hpet.c:954
 do_one_initcall+0x120/0x820 init/main.c:939
 do_initcall_level init/main.c:1007 [inline]
 do_initcalls init/main.c:1015 [inline]
 do_basic_setup init/main.c:1032 [inline]
 kernel_init_freeable+0x4ca/0x570 init/main.c:1203
 kernel_init+0x12/0x1bf init/main.c:1110
 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:352

Freed by task 0:
(stack is not available)

The buggy address belongs to the object at ffff8880273a4400
 which belongs to the cache kmalloc-512 of size 512
The buggy address is located 472 bytes inside of
 512-byte region [ffff8880273a4400, ffff8880273a4600)
The buggy address belongs to the page:
page:ffffea00009ce900 refcount:1 mapcount:0 mapping:ffff88802cc00a80 index:0x0
raw: 00fffe0000000200 ffffea00009c5588 ffffea00009ca988 ffff88802cc00a80
raw: 0000000000000000 ffff8880273a4000 0000000100000004 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8880273a4480: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff8880273a4500: 00 00 00 00 00 00 00 00 00 00 00 fc fc fc fc fc
>ffff8880273a4580: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
                                                    ^
 ffff8880273a4600: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff8880273a4680: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================

Crashes (33):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2020/01/31 18:48 upstream ccaaaf6fe5a5 c30117b2 .config console log report ci-qemu-upstream
2020/01/31 18:48 upstream ccaaaf6fe5a5 c30117b2 .config console log report ci-qemu-upstream
2020/01/31 18:48 upstream ccaaaf6fe5a5 c30117b2 .config console log report ci-qemu-upstream
2020/01/31 01:12 upstream ccaaaf6fe5a5 5ed23f9a .config console log report ci-qemu-upstream
2020/01/31 01:12 upstream ccaaaf6fe5a5 5ed23f9a .config console log report ci-qemu-upstream
2020/01/31 01:12 upstream ccaaaf6fe5a5 5ed23f9a .config console log report ci-qemu-upstream
2020/01/31 00:16 upstream 35c222fd3236 5ed23f9a .config console log report ci-qemu-upstream
2020/01/31 00:16 upstream 35c222fd3236 5ed23f9a .config console log report ci-qemu-upstream
2020/01/31 00:16 upstream 35c222fd3236 5ed23f9a .config console log report ci-qemu-upstream
2020/01/30 18:36 upstream 9f68e3655aae 5ed23f9a .config console log report ci-qemu-upstream
2020/01/30 18:36 upstream 9f68e3655aae 5ed23f9a .config console log report ci-qemu-upstream
2020/01/30 18:36 upstream 9f68e3655aae 5ed23f9a .config console log report ci-qemu-upstream
2020/01/30 07:28 upstream 39bed42de2e7 5ed23f9a .config console log report ci-qemu-upstream
2020/01/30 07:28 upstream 39bed42de2e7 5ed23f9a .config console log report ci-qemu-upstream
2020/01/30 07:28 upstream 39bed42de2e7 5ed23f9a .config console log report ci-qemu-upstream
2020/01/31 19:50 upstream c5951e7c8ee5 c30117b2 .config console log report ci-qemu-upstream-386
2020/01/31 19:50 upstream c5951e7c8ee5 c30117b2 .config console log report ci-qemu-upstream-386
2020/01/31 19:50 upstream c5951e7c8ee5 c30117b2 .config console log report ci-qemu-upstream-386
2020/01/31 18:36 upstream ccaaaf6fe5a5 c30117b2 .config console log report ci-qemu-upstream-386
2020/01/31 18:36 upstream ccaaaf6fe5a5 c30117b2 .config console log report ci-qemu-upstream-386
2020/01/31 18:36 upstream ccaaaf6fe5a5 c30117b2 .config console log report ci-qemu-upstream-386
2020/01/31 00:56 upstream ccaaaf6fe5a5 5ed23f9a .config console log report ci-qemu-upstream-386
2020/01/31 00:56 upstream ccaaaf6fe5a5 5ed23f9a .config console log report ci-qemu-upstream-386
2020/01/31 00:56 upstream ccaaaf6fe5a5 5ed23f9a .config console log report ci-qemu-upstream-386
2020/01/31 00:03 upstream 35c222fd3236 5ed23f9a .config console log report ci-qemu-upstream-386
2020/01/31 00:03 upstream 35c222fd3236 5ed23f9a .config console log report ci-qemu-upstream-386
2020/01/31 00:03 upstream 35c222fd3236 5ed23f9a .config console log report ci-qemu-upstream-386
2020/01/30 18:52 upstream 9f68e3655aae 5ed23f9a .config console log report ci-qemu-upstream-386
2020/01/30 18:52 upstream 9f68e3655aae 5ed23f9a .config console log report ci-qemu-upstream-386
2020/01/30 18:52 upstream 9f68e3655aae 5ed23f9a .config console log report ci-qemu-upstream-386
2020/01/30 07:44 upstream 39bed42de2e7 5ed23f9a .config console log report ci-qemu-upstream-386
2020/01/30 07:44 upstream 39bed42de2e7 5ed23f9a .config console log report ci-qemu-upstream-386
2020/01/30 07:44 upstream 39bed42de2e7 5ed23f9a .config console log report ci-qemu-upstream-386
* Struck through repros no longer work on HEAD.