KASAN: slab-out-of-bounds Read in l2tp_session_create

5 views
Skip to first unread message

syzbot

unread,
Jun 24, 2019, 9:34:05 PM6/24/19
to syzkaller...@googlegroups.com
Hello,

syzbot found the following crash on:

HEAD commit: a5758c53 Linux 4.14.129
git tree: linux-4.14.y
console output: https://syzkaller.appspot.com/x/log.txt?x=125e291aa00000
kernel config: https://syzkaller.appspot.com/x/.config?x=9116f86b1594833c
dashboard link: https://syzkaller.appspot.com/bug?extid=0c791f760c6dfd55a480
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+0c791f...@syzkaller.appspotmail.com

==================================================================
BUG: KASAN: slab-out-of-bounds in __read_once_size
include/linux/compiler.h:186 [inline]
BUG: KASAN: slab-out-of-bounds in atomic_read
arch/x86/include/asm/atomic.h:27 [inline]
BUG: KASAN: slab-out-of-bounds in refcount_inc_not_zero+0xd3/0xe0
lib/refcount.c:120
Read of size 4 at addr ffff888061128080 by task syz-executor.1/11814

CPU: 1 PID: 11814 Comm: syz-executor.1 Not tainted 4.14.129 #23
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+0x138/0x19c lib/dump_stack.c:53
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_load4_noabort+0x14/0x20 mm/kasan/report.c:429
__read_once_size include/linux/compiler.h:186 [inline]
atomic_read arch/x86/include/asm/atomic.h:27 [inline]
refcount_inc_not_zero+0xd3/0xe0 lib/refcount.c:120
refcount_inc+0x16/0x40 lib/refcount.c:153
sock_hold include/net/sock.h:619 [inline]
l2tp_session_add_to_tunnel net/l2tp/l2tp_core.c:368 [inline]
l2tp_session_create+0x118b/0x1600 net/l2tp/l2tp_core.c:1846
pppol2tp_connect+0x11bf/0x18b0 net/l2tp/l2tp_ppp.c:721
SYSC_connect+0x1f6/0x2d0 net/socket.c:1655
SyS_connect+0x24/0x30 net/socket.c:1636
do_syscall_64+0x1e8/0x640 arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x42/0xb7
RIP: 0033:0x459519
RSP: 002b:00007f208a75dc78 EFLAGS: 00000246 ORIG_RAX: 000000000000002a
RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 0000000000459519
RDX: 000000000000002e RSI: 00000000200000c0 RDI: 0000000000000004
RBP: 000000000075bf20 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007f208a75e6d4
R13: 00000000004bfa22 R14: 00000000004d14a8 R15: 00000000ffffffff

Allocated by task 6831:
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
kasan_slab_alloc+0xf/0x20 mm/kasan/kasan.c:489
kmem_cache_alloc+0x12e/0x780 mm/slab.c:3552
mempool_alloc_slab+0x47/0x60 mm/mempool.c:450
mempool_alloc+0x138/0x300 mm/mempool.c:330
bvec_alloc+0xd1/0x2e0 block/bio.c:216
bio_alloc_bioset+0x419/0x680 block/bio.c:506
bio_alloc include/linux/bio.h:417 [inline]
io_submit_init_bio fs/ext4/page-io.c:374 [inline]
io_submit_add_bh fs/ext4/page-io.c:399 [inline]
ext4_bio_write_page+0x77c/0xe63 fs/ext4/page-io.c:506
mpage_submit_page+0x138/0x240 fs/ext4/inode.c:2206
mpage_process_page_bufs+0x418/0x510 fs/ext4/inode.c:2317
mpage_prepare_extent_to_map+0x489/0xb20 fs/ext4/inode.c:2689
ext4_writepages+0x105f/0x2fd0 fs/ext4/inode.c:2836
do_writepages+0xd0/0x250 mm/page-writeback.c:2364
__filemap_fdatawrite_range+0x23b/0x310 mm/filemap.c:345
file_write_and_wait_range+0x8d/0xe0 mm/filemap.c:655
__generic_file_fsync+0x79/0x1a0 fs/libfs.c:977
ext4_sync_file+0x755/0x12d0 fs/ext4/fsync.c:120
vfs_fsync_range+0x10e/0x260 fs/sync.c:196
generic_write_sync include/linux/fs.h:2675 [inline]
ext4_file_write_iter+0x68a/0xe90 fs/ext4/file.c:275
call_write_iter include/linux/fs.h:1777 [inline]
new_sync_write fs/read_write.c:469 [inline]
__vfs_write+0x4a7/0x6b0 fs/read_write.c:482
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

Freed by task 0:
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]
kmem_cache_free+0x83/0x2b0 mm/slab.c:3758
mempool_free_slab+0x1e/0x30 mm/mempool.c:457
mempool_free+0xd4/0x1d0 mm/mempool.c:439
bvec_free+0x85/0xa0 block/bio.c:171
bio_free+0xdd/0x1a0 block/bio.c:257
bio_put+0x9d/0xc0 block/bio.c:558
ext4_end_bio+0x15e/0x6b0 fs/ext4/page-io.c:343
bio_endio+0x336/0x690 block/bio.c:1859
req_bio_endio block/blk-core.c:204 [inline]
blk_update_request+0x292/0xa10 block/blk-core.c:2763
scsi_end_request+0x82/0xa10 drivers/scsi/scsi_lib.c:659
scsi_io_completion+0xaaa/0x1630 drivers/scsi/scsi_lib.c:885
scsi_finish_command+0x3d0/0x5a0 drivers/scsi/scsi.c:248
scsi_softirq_done+0x2d3/0x370 drivers/scsi/scsi_lib.c:1671
__blk_mq_complete_request+0x31c/0x6e0 block/blk-mq.c:571
blk_mq_complete_request+0x5d/0x70 block/blk-mq.c:591
scsi_mq_done+0x7c/0x2e0 drivers/scsi/scsi_lib.c:1979
virtscsi_complete_cmd+0x532/0x700 drivers/scsi/virtio_scsi.c:207
virtscsi_vq_done+0xa8/0x130 drivers/scsi/virtio_scsi.c:223
virtscsi_req_done+0xa4/0xd0 drivers/scsi/virtio_scsi.c:238
vring_interrupt+0x10f/0x160 drivers/virtio/virtio_ring.c:951
__handle_irq_event_percpu+0x125/0x7f0 kernel/irq/handle.c:147
handle_irq_event_percpu+0x65/0x130 kernel/irq/handle.c:187
handle_irq_event+0xa7/0x134 kernel/irq/handle.c:204
handle_edge_irq+0x22b/0x840 kernel/irq/chip.c:770
generic_handle_irq_desc include/linux/irqdesc.h:159 [inline]
handle_irq+0x39/0x50 arch/x86/kernel/irq_64.c:87
do_IRQ+0x99/0x1d0 arch/x86/kernel/irq.c:230

The buggy address belongs to the object at ffff888061129ac0
which belongs to the cache biovec-max of size 8192
The buggy address is located 6720 bytes to the left of
8192-byte region [ffff888061129ac0, ffff88806112bac0)
The buggy address belongs to the page:
page:ffffea0001844a00 count:1 mapcount:0 mapping:ffff888061129ac0 index:0x0
compound_mapcount: 0
flags: 0x1fffc0000008100(slab|head)
raw: 01fffc0000008100 ffff888061129ac0 0000000000000000 0000000100000001
raw: ffffea0002364020 ffffea0001a6e520 ffff8880a8791ac0 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff888061127f80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffff888061128000: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
> ffff888061128080: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
^
ffff888061128100: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff888061128180: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================


---
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,
Oct 25, 2019, 4:47:06 AM10/25/19
to syzkaller...@googlegroups.com
Auto-closing this bug as obsolete.
Crashes did not happen for a while, no reproducer and no activity.
Reply all
Reply to author
Forward
0 new messages