KASAN: use-after-free Read in bit_putcs

29 views
Skip to first unread message

syzbot

unread,
Dec 6, 2019, 3:49:10 AM12/6/19
to syzkaller...@googlegroups.com
Hello,

syzbot found the following crash on:

HEAD commit: a844dc4c Linux 4.14.158
git tree: linux-4.14.y
console output: https://syzkaller.appspot.com/x/log.txt?x=13017c82e00000
kernel config: https://syzkaller.appspot.com/x/.config?x=e820c54dee153942
dashboard link: https://syzkaller.appspot.com/bug?extid=1c95398cbebffb00dba3
compiler: gcc (GCC) 9.0.0 20181231 (experimental)

Unfortunately, I don't have any reproducer for this crash yet.

IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: syzbot+1c9539...@syzkaller.appspotmail.com

sd 0:0:1:0: [sg0] tag#5657 CDB[e0]: 00 00 00 00 00 00 00 00 00 00 00 00
sd 0:0:1:0: [sg0] tag#5784 CDB[00]: 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00
==================================================================
BUG: KASAN: use-after-free in __fb_pad_aligned_buffer
include/linux/fb.h:663 [inline]
BUG: KASAN: use-after-free in bit_putcs_aligned
drivers/video/fbdev/core/bitblit.c:96 [inline]
BUG: KASAN: use-after-free in bit_putcs+0xc09/0xdb0
drivers/video/fbdev/core/bitblit.c:185
Read of size 1 at addr ffff88807ff52bf8 by task syz-executor.0/6356

CPU: 1 PID: 6356 Comm: syz-executor.0 Not tainted 4.14.158-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
Google 01/01/2011
Call Trace:
__dump_stack lib/dump_stack.c:17 [inline]
dump_stack+0x142/0x197 lib/dump_stack.c:58
print_address_description.cold+0x7c/0x1dc mm/kasan/report.c:252
kasan_report_error mm/kasan/report.c:351 [inline]
kasan_report mm/kasan/report.c:409 [inline]
kasan_report.cold+0xa9/0x2af mm/kasan/report.c:393
__asan_report_load1_noabort+0x14/0x20 mm/kasan/report.c:427
sd 0:0:1:0: [sg0] tag#5784 CDB[10]: 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00
__fb_pad_aligned_buffer include/linux/fb.h:663 [inline]
bit_putcs_aligned drivers/video/fbdev/core/bitblit.c:96 [inline]
bit_putcs+0xc09/0xdb0 drivers/video/fbdev/core/bitblit.c:185
fbcon_putcs+0x3c2/0x480 drivers/video/fbdev/core/fbcon.c:1298
do_update_region+0x3b3/0x650 drivers/tty/vt/vt.c:373
update_region drivers/tty/vt/vt.c:391 [inline]
update_region+0xe7/0x120 drivers/tty/vt/vt.c:385
vcs_write+0x36b/0xbc0 drivers/tty/vt/vc_screen.c:549
__vfs_write+0x105/0x6b0 fs/read_write.c:480
sd 0:0:1:0: [sg0] tag#5784 CDB[20]: 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00
vfs_write+0x198/0x500 fs/read_write.c:544
SYSC_write fs/read_write.c:590 [inline]
SyS_write+0xfd/0x230 fs/read_write.c:582
do_syscall_64+0x1e8/0x640 arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x42/0xb7
RIP: 0033:0x45a679
RSP: 002b:00007f150f0dcc78 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 000000000045a679
RDX: 0000000000000276 RSI: 0000000020000240 RDI: 0000000000000006
RBP: 000000000075bfc8 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007f150f0dd6d4
R13: 00000000004d36e8 R14: 00000000004e5340 R15: 00000000ffffffff

Allocated by task 5389:
save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:59
save_stack+0x45/0xd0 mm/kasan/kasan.c:447
set_track mm/kasan/kasan.c:459 [inline]
kasan_kmalloc mm/kasan/kasan.c:551 [inline]
kasan_kmalloc+0xce/0xf0 mm/kasan/kasan.c:529
sd 0:0:1:0: [sg0] tag#5784 CDB[30]: 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00
__do_kmalloc_node mm/slab.c:3682 [inline]
__kmalloc_node_track_caller+0x51/0x80 mm/slab.c:3696
__kmalloc_reserve.isra.0+0x40/0xe0 net/core/skbuff.c:137
__alloc_skb+0xcf/0x500 net/core/skbuff.c:205
alloc_skb include/linux/skbuff.h:980 [inline]
alloc_skb_with_frags+0x86/0x4b0 net/core/skbuff.c:5228
sock_alloc_send_pskb+0x5db/0x740 net/core/sock.c:2078
packet_alloc_skb net/packet/af_packet.c:2843 [inline]
packet_snd net/packet/af_packet.c:2938 [inline]
packet_sendmsg+0x16b8/0x5a60 net/packet/af_packet.c:3018
sock_sendmsg_nosec net/socket.c:646 [inline]
sock_sendmsg+0xce/0x110 net/socket.c:656
___sys_sendmsg+0x349/0x840 net/socket.c:2062
__sys_sendmmsg+0x152/0x3a0 net/socket.c:2152
SYSC_sendmmsg net/socket.c:2183 [inline]
SyS_sendmmsg+0x35/0x60 net/socket.c:2178
do_syscall_64+0x1e8/0x640 arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x42/0xb7

Freed by task 5389:
save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:59
save_stack+0x45/0xd0 mm/kasan/kasan.c:447
set_track mm/kasan/kasan.c:459 [inline]
kasan_slab_free+0x75/0xc0 mm/kasan/kasan.c:524
__cache_free mm/slab.c:3496 [inline]
kfree+0xcc/0x270 mm/slab.c:3815
skb_free_head+0x8b/0xb0 net/core/skbuff.c:554
skb_release_data+0x543/0x7c0 net/core/skbuff.c:574
skb_release_all+0x4d/0x60 net/core/skbuff.c:631
__kfree_skb net/core/skbuff.c:645 [inline]
kfree_skb+0xb5/0x350 net/core/skbuff.c:663
sit_tunnel_xmit net/ipv6/sit.c:1039 [inline]
sit_tunnel_xmit+0xf3/0x22ad net/ipv6/sit.c:1016
sd 0:0:1:0: [sg0] tag#5784 CDB[40]: 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00
__netdev_start_xmit include/linux/netdevice.h:4033 [inline]
netdev_start_xmit include/linux/netdevice.h:4042 [inline]
xmit_one net/core/dev.c:3009 [inline]
dev_hard_start_xmit+0x18c/0x8b0 net/core/dev.c:3025
__dev_queue_xmit+0x1d95/0x25e0 net/core/dev.c:3525
dev_queue_xmit+0x18/0x20 net/core/dev.c:3558
packet_snd net/packet/af_packet.c:2993 [inline]
packet_sendmsg+0x1dd4/0x5a60 net/packet/af_packet.c:3018
sock_sendmsg_nosec net/socket.c:646 [inline]
sock_sendmsg+0xce/0x110 net/socket.c:656
___sys_sendmsg+0x349/0x840 net/socket.c:2062
__sys_sendmmsg+0x152/0x3a0 net/socket.c:2152
SYSC_sendmmsg net/socket.c:2183 [inline]
SyS_sendmmsg+0x35/0x60 net/socket.c:2178
do_syscall_64+0x1e8/0x640 arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x42/0xb7

The buggy address belongs to the object at ffff88807ff52a80
which belongs to the cache kmalloc-512 of size 512
The buggy address is located 376 bytes inside of
512-byte region [ffff88807ff52a80, ffff88807ff52c80)
The buggy address belongs to the page:
page:ffffea0001ffd480 count:1 mapcount:0 mapping:ffff88807ff52080 index:0x0
flags: 0xfffe0000000100(slab)
raw: 00fffe0000000100 ffff88807ff52080 0000000000000000 0000000100000006
raw: ffffea0002482120 ffffea000264b6a0 ffff8880aa800940 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff88807ff52a80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88807ff52b00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
> ffff88807ff52b80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff88807ff52c00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88807ff52c80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================
sd 0:0:1:0: [sg0] tag#5784 CDB[50]: 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00


---
This bug is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzk...@googlegroups.com.

syzbot will keep track of this bug report. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

syzbot

unread,
Dec 8, 2019, 5:21:09 AM12/8/19
to syzkaller...@googlegroups.com
Hello,

syzbot found the following crash on:

HEAD commit: fb683b5e Linux 4.19.88
git tree: linux-4.19.y
console output: https://syzkaller.appspot.com/x/log.txt?x=15e9477ae00000
kernel config: https://syzkaller.appspot.com/x/.config?x=aa0c39a6a0078b1c
dashboard link: https://syzkaller.appspot.com/bug?extid=fa274411c7f4086c86db
compiler: gcc (GCC) 9.0.0 20181231 (experimental)

Unfortunately, I don't have any reproducer for this crash yet.

IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: syzbot+fa2744...@syzkaller.appspotmail.com

==================================================================
BUG: KASAN: use-after-free in __fb_pad_aligned_buffer
include/linux/fb.h:674 [inline]
BUG: KASAN: use-after-free in bit_putcs_aligned
drivers/video/fbdev/core/bitblit.c:96 [inline]
BUG: KASAN: use-after-free in bit_putcs+0xd5d/0xf10
drivers/video/fbdev/core/bitblit.c:185
Read of size 1 at addr ffff888057f4a6d0 by task kworker/0:2/26569

CPU: 0 PID: 26569 Comm: kworker/0:2 Not tainted 4.19.88-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
Google 01/01/2011
Workqueue: events console_callback
Call Trace:
__dump_stack lib/dump_stack.c:77 [inline]
dump_stack+0x197/0x210 lib/dump_stack.c:118
print_address_description.cold+0x7c/0x20d mm/kasan/report.c:256
kasan_report_error mm/kasan/report.c:354 [inline]
kasan_report mm/kasan/report.c:412 [inline]
kasan_report.cold+0x8c/0x2ba mm/kasan/report.c:396
__asan_report_load1_noabort+0x14/0x20 mm/kasan/report.c:430
__fb_pad_aligned_buffer include/linux/fb.h:674 [inline]
bit_putcs_aligned drivers/video/fbdev/core/bitblit.c:96 [inline]
bit_putcs+0xd5d/0xf10 drivers/video/fbdev/core/bitblit.c:185
fbcon_putcs+0x42b/0x4f0 drivers/video/fbdev/core/fbcon.c:1320
do_update_region+0x42b/0x6f0 drivers/tty/vt/vt.c:677
redraw_screen+0x602/0x8e0 drivers/tty/vt/vt.c:1013
complete_change_console+0x105/0x3a0 drivers/tty/vt/vt_ioctl.c:1277
change_console+0x19b/0x2c0 drivers/tty/vt/vt_ioctl.c:1402
console_callback+0x3a1/0x400 drivers/tty/vt/vt.c:2800
process_one_work+0x989/0x1750 kernel/workqueue.c:2153
worker_thread+0x98/0xe40 kernel/workqueue.c:2296
kthread+0x354/0x420 kernel/kthread.c:246
ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:415

Allocated by task 30377:
save_stack+0x45/0xd0 mm/kasan/kasan.c:448
set_track mm/kasan/kasan.c:460 [inline]
kasan_kmalloc mm/kasan/kasan.c:553 [inline]
kasan_kmalloc+0xce/0xf0 mm/kasan/kasan.c:531
__do_kmalloc_node mm/slab.c:3689 [inline]
__kmalloc_node_track_caller+0x51/0x80 mm/slab.c:3703
__kmalloc_reserve.isra.0+0x40/0xf0 net/core/skbuff.c:137
__alloc_skb+0x10b/0x5f0 net/core/skbuff.c:205
alloc_skb include/linux/skbuff.h:995 [inline]
alloc_uevent_skb+0x83/0x1e2 lib/kobject_uevent.c:288
uevent_net_broadcast_tagged lib/kobject_uevent.c:349 [inline]
kobject_uevent_net_broadcast lib/kobject_uevent.c:409 [inline]
kobject_uevent_env+0xbd8/0x101f lib/kobject_uevent.c:590
kobject_uevent+0x20/0x26 lib/kobject_uevent.c:639
netdev_queue_add_kobject net/core/net-sysfs.c:1486 [inline]
netdev_queue_update_kobjects+0x2ff/0x3d0 net/core/net-sysfs.c:1500
register_queue_kobjects net/core/net-sysfs.c:1542 [inline]
netdev_register_kobject+0x29f/0x3b0 net/core/net-sysfs.c:1760
register_netdevice+0x875/0xff0 net/core/dev.c:8546
__ip_tunnel_create+0x36b/0x530 net/ipv4/ip_tunnel.c:282
ip_tunnel_init_net+0x375/0x9e0 net/ipv4/ip_tunnel.c:1026
ipgre_tap_init_net+0x2a/0x30 net/ipv4/ip_gre.c:1656
ops_init+0xb3/0x410 net/core/net_namespace.c:129
setup_net+0x2d3/0x740 net/core/net_namespace.c:315
copy_net_ns+0x1df/0x33c net/core/net_namespace.c:438
create_new_namespaces+0x400/0x7b0 kernel/nsproxy.c:107
unshare_nsproxy_namespaces+0xc2/0x200 kernel/nsproxy.c:206
ksys_unshare+0x440/0x980 kernel/fork.c:2520
__do_sys_unshare kernel/fork.c:2588 [inline]
__se_sys_unshare kernel/fork.c:2586 [inline]
__x64_sys_unshare+0x31/0x40 kernel/fork.c:2586
do_syscall_64+0xfd/0x620 arch/x86/entry/common.c:293
entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 30377:
save_stack+0x45/0xd0 mm/kasan/kasan.c:448
set_track mm/kasan/kasan.c:460 [inline]
__kasan_slab_free+0x102/0x150 mm/kasan/kasan.c:521
kasan_slab_free+0xe/0x10 mm/kasan/kasan.c:528
__cache_free mm/slab.c:3503 [inline]
kfree+0xcf/0x220 mm/slab.c:3822
skb_free_head+0x99/0xc0 net/core/skbuff.c:554
skb_release_data+0x619/0x8d0 net/core/skbuff.c:574
skb_release_all+0x4d/0x60 net/core/skbuff.c:631
__kfree_skb net/core/skbuff.c:645 [inline]
consume_skb net/core/skbuff.c:705 [inline]
consume_skb+0xe2/0x390 net/core/skbuff.c:699
netlink_broadcast_filtered+0x316/0xb30 net/netlink/af_netlink.c:1519
netlink_broadcast+0x3a/0x50 net/netlink/af_netlink.c:1541
uevent_net_broadcast_tagged lib/kobject_uevent.c:370 [inline]
kobject_uevent_net_broadcast lib/kobject_uevent.c:409 [inline]
kobject_uevent_env+0xcbf/0x101f lib/kobject_uevent.c:590
kobject_uevent+0x20/0x26 lib/kobject_uevent.c:639
netdev_queue_add_kobject net/core/net-sysfs.c:1486 [inline]
netdev_queue_update_kobjects+0x2ff/0x3d0 net/core/net-sysfs.c:1500
register_queue_kobjects net/core/net-sysfs.c:1542 [inline]
netdev_register_kobject+0x29f/0x3b0 net/core/net-sysfs.c:1760
register_netdevice+0x875/0xff0 net/core/dev.c:8546
__ip_tunnel_create+0x36b/0x530 net/ipv4/ip_tunnel.c:282
ip_tunnel_init_net+0x375/0x9e0 net/ipv4/ip_tunnel.c:1026
ipgre_tap_init_net+0x2a/0x30 net/ipv4/ip_gre.c:1656
ops_init+0xb3/0x410 net/core/net_namespace.c:129
setup_net+0x2d3/0x740 net/core/net_namespace.c:315
copy_net_ns+0x1df/0x33c net/core/net_namespace.c:438
create_new_namespaces+0x400/0x7b0 kernel/nsproxy.c:107
unshare_nsproxy_namespaces+0xc2/0x200 kernel/nsproxy.c:206
ksys_unshare+0x440/0x980 kernel/fork.c:2520
__do_sys_unshare kernel/fork.c:2588 [inline]
__se_sys_unshare kernel/fork.c:2586 [inline]
__x64_sys_unshare+0x31/0x40 kernel/fork.c:2586
do_syscall_64+0xfd/0x620 arch/x86/entry/common.c:293
entry_SYSCALL_64_after_hwframe+0x49/0xbe

The buggy address belongs to the object at ffff888057f4a500
which belongs to the cache kmalloc-512 of size 512
The buggy address is located 464 bytes inside of
512-byte region [ffff888057f4a500, ffff888057f4a700)
The buggy address belongs to the page:
page:ffffea00015fd280 count:1 mapcount:0 mapping:ffff88812c31c940 index:0x0
flags: 0xfffe0000000100(slab)
raw: 00fffe0000000100 ffffea00027ca8c8 ffffea000210f908 ffff88812c31c940
raw: 0000000000000000 ffff888057f4a000 0000000100000006 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff888057f4a580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff888057f4a600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
> ffff888057f4a680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff888057f4a700: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff888057f4a780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

syzbot

unread,
Nov 26, 2020, 2:35:11 AM11/26/20
to syzkaller...@googlegroups.com
Auto-closing this bug as obsolete.
Crashes did not happen for a while, no reproducer and no activity.

syzbot

unread,
Jan 15, 2021, 12:05:13 AM1/15/21
to syzkaller...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages