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

11 views
Skip to first unread message

syzbot

unread,
Apr 11, 2019, 7:18:17 AM4/11/19
to syzkaller...@googlegroups.com
Hello,

syzbot found the following crash on:

HEAD commit: 1ec8f1f0 Linux 4.14.111
git tree: linux-4.14.y
console output: https://syzkaller.appspot.com/x/log.txt?x=104dcce3200000
kernel config: https://syzkaller.appspot.com/x/.config?x=fdadf290ea9fc6f9
dashboard link: https://syzkaller.appspot.com/bug?extid=383034442795f7b89205
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+383034...@syzkaller.appspotmail.com

==================================================================
BUG: KASAN: slab-out-of-bounds in tipc_nametbl_lookup_dst_nodes+0x46c/0x4e0
net/tipc/name_table.c:670
Read of size 4 at addr ffff8880a0d79250 by task syz-executor.3/12342

CPU: 1 PID: 12342 Comm: syz-executor.3 Not tainted 4.14.111 #1
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+0xaf/0x2b5 mm/kasan/report.c:393
__asan_report_load4_noabort+0x14/0x20 mm/kasan/report.c:429
tipc_nametbl_lookup_dst_nodes+0x46c/0x4e0 net/tipc/name_table.c:670
tipc_sendmcast+0x5a2/0xb70 net/tipc/socket.c:767
__tipc_sendmsg+0xc7f/0x10f0 net/tipc/socket.c:971
tipc_sendmsg+0x53/0x80 net/tipc/socket.c:919
sock_sendmsg_nosec net/socket.c:646 [inline]
sock_sendmsg+0xd0/0x110 net/socket.c:656
___sys_sendmsg+0x70c/0x850 net/socket.c:2062
__sys_sendmsg+0xb9/0x140 net/socket.c:2096
SYSC_sendmsg net/socket.c:2107 [inline]
SyS_sendmsg+0x2d/0x50 net/socket.c:2103
do_syscall_64+0x1eb/0x630 arch/x86/entry/common.c:289
entry_SYSCALL_64_after_hwframe+0x42/0xb7
RIP: 0033:0x4582f9
RSP: 002b:00007fce2fb92c78 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 00000000004582f9
RDX: 0000000000000000 RSI: 0000000020002140 RDI: 0000000000000004
RBP: 000000000073bf00 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007fce2fb936d4
R13: 00000000004c59b1 R14: 00000000004d9cc0 R15: 00000000ffffffff

Allocated by task 6997:
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
kmem_cache_alloc_trace+0x152/0x790 mm/slab.c:3618
kmalloc include/linux/slab.h:488 [inline]
kmalloc_array include/linux/slab.h:606 [inline]
kcalloc include/linux/slab.h:618 [inline]
tipc_subseq_alloc net/tipc/name_table.c:141 [inline]
tipc_nameseq_create+0x83/0x2e0 net/tipc/name_table.c:152
tipc_nametbl_insert_publ+0x6ae/0x1400 net/tipc/name_table.c:476
tipc_nametbl_publish+0x20f/0x3f0 net/tipc/name_table.c:701
tipc_sk_publish net/tipc/socket.c:2203 [inline]
tipc_bind+0x2d3/0x610 net/tipc/socket.c:629
kernel_bind+0x67/0x80 net/socket.c:3313
tipc_create_listen_sock net/tipc/server.c:338 [inline]
tipc_open_listening_sock net/tipc/server.c:396 [inline]
tipc_server_start+0x329/0x8a0 net/tipc/server.c:611
tipc_topsrv_start+0x54e/0x740 net/tipc/subscr.c:382
tipc_init_net+0x2aa/0x420 net/tipc/core.c:74
ops_init+0xac/0x3d0 net/core/net_namespace.c:118
setup_net+0x223/0x520 net/core/net_namespace.c:294
copy_net_ns+0x19f/0x440 net/core/net_namespace.c:418
create_new_namespaces+0x37b/0x720 kernel/nsproxy.c:107
unshare_nsproxy_namespaces+0xab/0x1e0 kernel/nsproxy.c:206
SYSC_unshare kernel/fork.c:2379 [inline]
SyS_unshare+0x2f3/0x7e0 kernel/fork.c:2329
do_syscall_64+0x1eb/0x630 arch/x86/entry/common.c:289
entry_SYSCALL_64_after_hwframe+0x42/0xb7

Freed by task 17:
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
selinux_cred_free+0x51/0x80 security/selinux/hooks.c:3813
security_cred_free+0x7f/0xc0 security/security.c:1003
put_cred_rcu+0xe6/0x300 kernel/cred.c:117
__rcu_reclaim kernel/rcu/rcu.h:195 [inline]
rcu_do_batch kernel/rcu/tree.c:2699 [inline]
invoke_rcu_callbacks kernel/rcu/tree.c:2962 [inline]
__rcu_process_callbacks kernel/rcu/tree.c:2929 [inline]
rcu_process_callbacks+0x7c0/0x12c0 kernel/rcu/tree.c:2946
__do_softirq+0x24e/0x9ae kernel/softirq.c:288

The buggy address belongs to the object at ffff8880a0d79240
which belongs to the cache kmalloc-32 of size 32
The buggy address is located 16 bytes inside of
32-byte region [ffff8880a0d79240, ffff8880a0d79260)
The buggy address belongs to the page:
page:ffffea0002835e40 count:1 mapcount:0 mapping:ffff8880a0d79000
index:0xffff8880a0d79fc1
flags: 0x1fffc0000000100(slab)
raw: 01fffc0000000100 ffff8880a0d79000 ffff8880a0d79fc1 000000010000003d
raw: ffffea000281d1e0 ffffea000282eee0 ffff8880aa8001c0 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff8880a0d79100: fb fb fb fb fc fc fc fc 00 00 fc fc fc fc fc fc
ffff8880a0d79180: fb fb fb fb fc fc fc fc 00 00 fc fc fc fc fc fc
> ffff8880a0d79200: fb fb fb fb fc fc fc fc 00 00 fc fc fc fc fc fc
^
ffff8880a0d79280: 00 00 01 fc fc fc fc fc 00 00 01 fc fc fc fc fc
ffff8880a0d79300: 00 00 01 fc fc fc fc fc 00 00 01 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,
Apr 11, 2019, 12:24:14 PM4/11/19
to syzkaller...@googlegroups.com
syzbot has found a reproducer for the following crash on:

HEAD commit: 1ec8f1f0 Linux 4.14.111
git tree: linux-4.14.y
console output: https://syzkaller.appspot.com/x/log.txt?x=1785efa7200000
kernel config: https://syzkaller.appspot.com/x/.config?x=fdadf290ea9fc6f9
dashboard link: https://syzkaller.appspot.com/bug?extid=383034442795f7b89205
compiler: gcc (GCC) 9.0.0 20181231 (experimental)
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=1239a0f3200000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=17940cd3200000

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

random: sshd: uninitialized urandom read (32 bytes read)
random: sshd: uninitialized urandom read (32 bytes read)
random: sshd: uninitialized urandom read (32 bytes read)
audit: type=1400 audit(1554999575.166:36): avc: denied { map } for
pid=7367 comm="syz-executor168" path="/root/syz-executor168552657"
dev="sda1" ino=16481 scontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023
tcontext=unconfined_u:object_r:user_home_t:s0 tclass=file permissive=1
==================================================================
BUG: KASAN: slab-out-of-bounds in tipc_nametbl_lookup_dst_nodes+0x4cb/0x4e0
net/tipc/name_table.c:670
Read of size 4 at addr ffff8880a5c4c290 by task syz-executor168/7367

CPU: 1 PID: 7367 Comm: syz-executor168 Not tainted 4.14.111 #1
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+0xaf/0x2b5 mm/kasan/report.c:393
__asan_report_load4_noabort+0x14/0x20 mm/kasan/report.c:429
tipc_nametbl_lookup_dst_nodes+0x4cb/0x4e0 net/tipc/name_table.c:670
tipc_sendmcast+0x5a2/0xb70 net/tipc/socket.c:767
__tipc_sendmsg+0xc7f/0x10f0 net/tipc/socket.c:971
__tipc_sendstream+0x71e/0x970 net/tipc/socket.c:1065
tipc_sendstream+0x53/0x80 net/tipc/socket.c:1039
tipc_send_packet+0x34/0x50 net/tipc/socket.c:1115
sock_sendmsg_nosec net/socket.c:646 [inline]
sock_sendmsg+0xd0/0x110 net/socket.c:656
___sys_sendmsg+0x70c/0x850 net/socket.c:2062
__sys_sendmsg+0xb9/0x140 net/socket.c:2096
SYSC_sendmsg net/socket.c:2107 [inline]
SyS_sendmsg+0x2d/0x50 net/socket.c:2103
do_syscall_64+0x1eb/0x630 arch/x86/entry/common.c:289
entry_SYSCALL_64_after_hwframe+0x42/0xb7
RIP: 0033:0x440239
RSP: 002b:00007ffc328472e8 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 00000000004002c8 RCX: 0000000000440239
RDX: 0000000000000000 RSI: 0000000020316000 RDI: 0000000000000004
RBP: 00000000006ca018 R08: 00000000004002c8 R09: 00000000004002c8
R10: 00000000004002c8 R11: 0000000000000246 R12: 0000000000401ac0
R13: 0000000000401b50 R14: 0000000000000000 R15: 0000000000000000

Allocated by task 7367:
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
kmem_cache_alloc_trace+0x152/0x790 mm/slab.c:3618
kmalloc include/linux/slab.h:488 [inline]
kmalloc_array include/linux/slab.h:606 [inline]
kcalloc include/linux/slab.h:618 [inline]
tipc_subseq_alloc net/tipc/name_table.c:141 [inline]
tipc_nameseq_create+0x83/0x2e0 net/tipc/name_table.c:152
tipc_nametbl_insert_publ+0x6ae/0x1400 net/tipc/name_table.c:476
tipc_nametbl_publish+0x20f/0x3f0 net/tipc/name_table.c:701
tipc_sk_publish net/tipc/socket.c:2203 [inline]
tipc_bind+0x2d3/0x610 net/tipc/socket.c:629
SYSC_bind+0x1d9/0x220 net/socket.c:1489
SyS_bind+0x24/0x30 net/socket.c:1475
do_syscall_64+0x1eb/0x630 arch/x86/entry/common.c:289
entry_SYSCALL_64_after_hwframe+0x42/0xb7

Freed by task 17:
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
selinux_cred_free+0x51/0x80 security/selinux/hooks.c:3813
security_cred_free+0x7f/0xc0 security/security.c:1003
put_cred_rcu+0xe6/0x300 kernel/cred.c:117
__rcu_reclaim kernel/rcu/rcu.h:195 [inline]
rcu_do_batch kernel/rcu/tree.c:2699 [inline]
invoke_rcu_callbacks kernel/rcu/tree.c:2962 [inline]
__rcu_process_callbacks kernel/rcu/tree.c:2929 [inline]
rcu_process_callbacks+0x7c0/0x12c0 kernel/rcu/tree.c:2946
__do_softirq+0x24e/0x9ae kernel/softirq.c:288

The buggy address belongs to the object at ffff8880a5c4c280
which belongs to the cache kmalloc-32 of size 32
The buggy address is located 16 bytes inside of
32-byte region [ffff8880a5c4c280, ffff8880a5c4c2a0)
The buggy address belongs to the page:
page:ffffea0002971300 count:1 mapcount:0 mapping:ffff8880a5c4c000
index:0xffff8880a5c4cfc1
flags: 0x1fffc0000000100(slab)
raw: 01fffc0000000100 ffff8880a5c4c000 ffff8880a5c4cfc1 000000010000003b
raw: ffffea0002970d60 ffffea00029b8c60 ffff8880aa8001c0 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff8880a5c4c180: fb fb fb fb fc fc fc fc fb fb fb fb fc fc fc fc
ffff8880a5c4c200: fb fb fb fb fc fc fc fc fb fb fb fb fc fc fc fc
> ffff8880a5c4c280: 00 00 fc fc fc fc fc fc fb fb fb fb fc fc fc fc
^
ffff8880a5c4c300: fb fb fb fb fc fc fc fc fb fb fb fb fc fc fc fc
ffff8880a5c4c380: fb fb fb fb fc fc fc fc fb fb fb fb fc fc fc fc
==================================================================

Reply all
Reply to author
Forward
0 new messages