syzbot


KASAN: use-after-free Read in inet_csk_route_child_sock (2)

Status: auto-closed as invalid on 2021/07/22 00:48
Reported-by: syzbot+@syzkaller.appspotmail.com
First crash: 476d, last: 476d
similar bugs (1):
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: use-after-free Read in inet_csk_route_child_sock 3 630d 705d 0/23 auto-closed as invalid on 2021/02/18 10:11

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in inet_csk_route_child_sock+0xab9/0xae0 net/ipv4/inet_connection_sock.c:647
Read of size 1 at addr ffff888014532b1c by task syz-executor.1/13496

CPU: 1 PID: 13496 Comm: syz-executor.1 Not tainted 5.12.0-rc8-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 <IRQ>
 __dump_stack lib/dump_stack.c:79 [inline]
 dump_stack+0x202/0x31e lib/dump_stack.c:120
 print_address_description+0x5f/0x3b0 mm/kasan/report.c:232
 __kasan_report mm/kasan/report.c:399 [inline]
 kasan_report+0x15c/0x200 mm/kasan/report.c:416
 inet_csk_route_child_sock+0xab9/0xae0 net/ipv4/inet_connection_sock.c:647
 tcp_v4_syn_recv_sock+0x8ab/0x1400 net/ipv4/tcp_ipv4.c:1557
 tcp_v6_syn_recv_sock+0x138/0x1de0 net/ipv6/tcp_ipv6.c:1226
 tcp_check_req+0xeeb/0x1830 net/ipv4/tcp_minisocks.c:772
 tcp_v4_rcv+0x2212/0x47a0 net/ipv4/tcp_ipv4.c:2001
 ip_protocol_deliver_rcu+0x225/0x3b0 net/ipv4/ip_input.c:204
 ip_local_deliver_finish net/ipv4/ip_input.c:231 [inline]
 NF_HOOK include/linux/netfilter.h:301 [inline]
 ip_local_deliver+0x311/0x490 net/ipv4/ip_input.c:252
 __netif_receive_skb_one_core net/core/dev.c:5384 [inline]
 __netif_receive_skb+0x1d1/0x500 net/core/dev.c:5498
 process_backlog+0x4d8/0x950 net/core/dev.c:6366
 __napi_poll+0xba/0x4f0 net/core/dev.c:6913
 napi_poll net/core/dev.c:6980 [inline]
 net_rx_action+0x62c/0xf30 net/core/dev.c:7067
 __do_softirq+0x372/0x7a6 kernel/softirq.c:345
 invoke_softirq kernel/softirq.c:221 [inline]
 __irq_exit_rcu+0x22c/0x260 kernel/softirq.c:422
 irq_exit_rcu+0x5/0x20 kernel/softirq.c:434
 sysvec_apic_timer_interrupt+0x91/0xb0 arch/x86/kernel/apic/apic.c:1100
 </IRQ>
 asm_sysvec_apic_timer_interrupt+0x12/0x20 arch/x86/include/asm/idtentry.h:632
RIP: 0010:__raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:161 [inline]
RIP: 0010:_raw_spin_unlock_irqrestore+0xbc/0x120 kernel/locking/spinlock.c:191
Code: f0 48 c1 e8 03 42 80 3c 20 00 74 08 4c 89 f7 e8 da 01 18 f8 f6 44 24 21 02 75 4e 41 f7 c7 00 02 00 00 74 01 fb bf 01 00 00 00 <e8> cf 3e a9 f7 65 8b 05 50 e5 54 76 85 c0 74 3f 48 c7 04 24 0e 36
RSP: 0018:ffffc900072f7c60 EFLAGS: 00000206
RAX: 1ffff92000e5ef90 RBX: ffffffff905d7ed0 RCX: ffffffff9031ab03
RDX: dffffc0000000000 RSI: 0000000000000001 RDI: 0000000000000001
RBP: ffffc900072f7cf0 R08: ffffffff8184c100 R09: fffffbfff20bafdb
R10: fffffbfff20bafdb R11: 0000000000000000 R12: dffffc0000000000
R13: 1ffff92000e5ef8c R14: ffffc900072f7c80 R15: 0000000000000a02
 debug_object_free+0x287/0x460 lib/debugobjects.c:847
 destroy_hrtimer_on_stack kernel/time/hrtimer.c:452 [inline]
 hrtimer_nanosleep+0x395/0x470 kernel/time/hrtimer.c:1964
 __do_sys_clock_nanosleep kernel/time/posix-timers.c:1267 [inline]
 __se_sys_clock_nanosleep kernel/time/posix-timers.c:1245 [inline]
 __x64_sys_clock_nanosleep+0x344/0x3d0 kernel/time/posix-timers.c:1245
 do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46
 entry_SYSCALL_64_after_hwframe+0x44/0xae
RIP: 0033:0x48a7c1
Code: 24 0c 89 3c 24 48 89 4c 24 18 e8 aa e7 ff ff 4c 8b 54 24 18 48 8b 54 24 10 41 89 c0 8b 74 24 0c 8b 3c 24 b8 e6 00 00 00 0f 05 <44> 89 c7 48 89 04 24 e8 e3 e7 ff ff 48 8b 04 24 eb 97 66 2e 0f 1f
RSP: 002b:00007ffe6ac6c9a0 EFLAGS: 00000293 ORIG_RAX: 00000000000000e6
RAX: ffffffffffffffda RBX: 00000000000412b5 RCX: 000000000048a7c1
RDX: 00007ffe6ac6c9e0 RSI: 0000000000000000 RDI: 0000000000000000
RBP: 0000000000000001 R08: 0000000000000000 R09: 0000000000000010
R10: 0000000000000000 R11: 0000000000000293 R12: 000000000056bf60
R13: 000000000056c9e0 R14: 000000000056bf60 R15: 0000000000040f74

Allocated by task 13500:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track mm/kasan/common.c:46 [inline]
 set_alloc_info mm/kasan/common.c:427 [inline]
 ____kasan_kmalloc+0xc2/0xf0 mm/kasan/common.c:506
 kasan_kmalloc include/linux/kasan.h:233 [inline]
 __kmalloc+0xb4/0x380 mm/slub.c:4055
 kmalloc include/linux/slab.h:559 [inline]
 kzalloc include/linux/slab.h:684 [inline]
 cipso_v4_req_setattr+0x98/0x1a0 net/ipv4/cipso_ipv4.c:1944
 netlbl_req_setattr+0x32b/0x490 net/netlabel/netlabel_kapi.c:1200
 smack_inet_conn_request+0x6cd/0x860 security/smack/smack_lsm.c:4192
 security_inet_conn_request+0x56/0xb0 security/security.c:2246
 tcp_v4_route_req+0x2ed/0x4e0 net/ipv4/tcp_ipv4.c:1454
 tcp_conn_request+0xd47/0x2ec0 net/ipv4/tcp_input.c:6816
 tcp_rcv_state_process+0x786/0x2370 net/ipv4/tcp_input.c:6343
 tcp_v4_do_rcv+0x5ab/0x870 net/ipv4/tcp_ipv4.c:1701
 tcp_v4_rcv+0x3599/0x47a0 net/ipv4/tcp_ipv4.c:2050
 ip_protocol_deliver_rcu+0x225/0x3b0 net/ipv4/ip_input.c:204
 ip_local_deliver_finish net/ipv4/ip_input.c:231 [inline]
 NF_HOOK include/linux/netfilter.h:301 [inline]
 ip_local_deliver+0x311/0x490 net/ipv4/ip_input.c:252
 __netif_receive_skb_one_core net/core/dev.c:5384 [inline]
 __netif_receive_skb+0x1d1/0x500 net/core/dev.c:5498
 process_backlog+0x4d8/0x950 net/core/dev.c:6366
 __napi_poll+0xba/0x4f0 net/core/dev.c:6913
 napi_poll net/core/dev.c:6980 [inline]
 net_rx_action+0x62c/0xf30 net/core/dev.c:7067
 __do_softirq+0x372/0x7a6 kernel/softirq.c:345

Freed by task 104:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track+0x3d/0x70 mm/kasan/common.c:46
 kasan_set_free_info+0x1f/0x40 mm/kasan/generic.c:357
 ____kasan_slab_free+0x100/0x140 mm/kasan/common.c:360
 kasan_slab_free include/linux/kasan.h:199 [inline]
 slab_free_hook mm/slub.c:1562 [inline]
 slab_free_freelist_hook+0x171/0x270 mm/slub.c:1600
 slab_free mm/slub.c:3161 [inline]
 kfree+0xcf/0x2d0 mm/slub.c:4213
 inet_sock_destruct+0x566/0x740 net/ipv4/af_inet.c:159
 __sk_destruct+0x4f/0x830 net/core/sock.c:1795
 inet_release+0x16e/0x1f0 net/ipv4/af_inet.c:431
 __sock_release net/socket.c:599 [inline]
 sock_release+0x7a/0x140 net/socket.c:627
 rds_tcp_accept_one+0x17e/0xb30 net/rds/tcp_listen.c:220
 rds_tcp_accept_worker+0x3b/0xb0 net/rds/tcp.c:515
 process_one_work+0x833/0x10c0 kernel/workqueue.c:2275
 worker_thread+0xac1/0x1300 kernel/workqueue.c:2421
 kthread+0x39a/0x3c0 kernel/kthread.c:292
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:294

Last potentially related work creation:
 kasan_save_stack+0x27/0x50 mm/kasan/common.c:38
 kasan_record_aux_stack+0xee/0x120 mm/kasan/generic.c:345
 kvfree_call_rcu+0x1a2/0x760 kernel/rcu/tree.c:3577
 cipso_v4_req_setattr+0x12a/0x1a0 net/ipv4/cipso_ipv4.c:1958
 netlbl_req_setattr+0x32b/0x490 net/netlabel/netlabel_kapi.c:1200
 smack_inet_conn_request+0x6cd/0x860 security/smack/smack_lsm.c:4192
 security_inet_conn_request+0x56/0xb0 security/security.c:2246
 tcp_v4_route_req+0x2ed/0x4e0 net/ipv4/tcp_ipv4.c:1454
 tcp_conn_request+0xd47/0x2ec0 net/ipv4/tcp_input.c:6816
 tcp_rcv_state_process+0x786/0x2370 net/ipv4/tcp_input.c:6343
 tcp_v4_do_rcv+0x5ab/0x870 net/ipv4/tcp_ipv4.c:1701
 tcp_v4_rcv+0x3599/0x47a0 net/ipv4/tcp_ipv4.c:2050
 ip_protocol_deliver_rcu+0x225/0x3b0 net/ipv4/ip_input.c:204
 ip_local_deliver_finish net/ipv4/ip_input.c:231 [inline]
 NF_HOOK include/linux/netfilter.h:301 [inline]
 ip_local_deliver+0x311/0x490 net/ipv4/ip_input.c:252
 __netif_receive_skb_one_core net/core/dev.c:5384 [inline]
 __netif_receive_skb+0x1d1/0x500 net/core/dev.c:5498
 process_backlog+0x4d8/0x950 net/core/dev.c:6366
 __napi_poll+0xba/0x4f0 net/core/dev.c:6913
 napi_poll net/core/dev.c:6980 [inline]
 net_rx_action+0x62c/0xf30 net/core/dev.c:7067
 __do_softirq+0x372/0x7a6 kernel/softirq.c:345

Second to last potentially related work creation:
 kasan_save_stack+0x27/0x50 mm/kasan/common.c:38
 kasan_record_aux_stack+0xee/0x120 mm/kasan/generic.c:345
 kvfree_call_rcu+0x1a2/0x760 kernel/rcu/tree.c:3577
 cipso_v4_req_setattr+0x12a/0x1a0 net/ipv4/cipso_ipv4.c:1958
 netlbl_req_setattr+0x32b/0x490 net/netlabel/netlabel_kapi.c:1200
 smack_inet_conn_request+0x6cd/0x860 security/smack/smack_lsm.c:4192
 security_inet_conn_request+0x56/0xb0 security/security.c:2246
 tcp_v4_route_req+0x2ed/0x4e0 net/ipv4/tcp_ipv4.c:1454
 tcp_conn_request+0xd47/0x2ec0 net/ipv4/tcp_input.c:6816
 tcp_rcv_state_process+0x786/0x2370 net/ipv4/tcp_input.c:6343
 tcp_v4_do_rcv+0x5ab/0x870 net/ipv4/tcp_ipv4.c:1701
 tcp_v4_rcv+0x3599/0x47a0 net/ipv4/tcp_ipv4.c:2050
 ip_protocol_deliver_rcu+0x225/0x3b0 net/ipv4/ip_input.c:204
 ip_local_deliver_finish net/ipv4/ip_input.c:231 [inline]
 NF_HOOK include/linux/netfilter.h:301 [inline]
 ip_local_deliver+0x311/0x490 net/ipv4/ip_input.c:252
 __netif_receive_skb_one_core net/core/dev.c:5384 [inline]
 __netif_receive_skb+0x1d1/0x500 net/core/dev.c:5498
 process_backlog+0x4d8/0x950 net/core/dev.c:6366
 __napi_poll+0xba/0x4f0 net/core/dev.c:6913
 napi_poll net/core/dev.c:6980 [inline]
 net_rx_action+0x62c/0xf30 net/core/dev.c:7067
 __do_softirq+0x372/0x7a6 kernel/softirq.c:345

The buggy address belongs to the object at ffff888014532b00
 which belongs to the cache kmalloc-64 of size 64
The buggy address is located 28 bytes inside of
 64-byte region [ffff888014532b00, ffff888014532b40)
The buggy address belongs to the page:
page:ffffea0000514c80 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x14532
flags: 0xfff00000000200(slab)
raw: 00fff00000000200 ffffea0000bd4700 0000000700000007 ffff888010c41640
raw: 0000000000000000 0000000080200020 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff888014532a00: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
 ffff888014532a80: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc
>ffff888014532b00: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
                            ^
 ffff888014532b80: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc
 ffff888014532c00: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc
==================================================================

Crashes (1):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Title
ci-upstream-kasan-gce-smack-root 2021/04/23 00:29 upstream 90c911ad7445 590921a5 .config log report info KASAN: use-after-free Read in inet_csk_route_child_sock