KASAN: use-after-free Read in tcp_init_tso_segs

11 vistas
Ir al primer mensaje no leído

syzbot

no leída,
10 sept 2019, 7:54:07 a.m.10/9/19
para syzkaller-a...@googlegroups.com
Hello,

syzbot found the following crash on:

HEAD commit: f02af7b0 Merge 4.14.143 into android-4.14
git tree: android-4.14
console output: https://syzkaller.appspot.com/x/log.txt?x=1722c685600000
kernel config: https://syzkaller.appspot.com/x/.config?x=4d9cf2fd50fd7015
dashboard link: https://syzkaller.appspot.com/bug?extid=d1ee6e290c1891301c16
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+d1ee6e...@syzkaller.appspotmail.com

==================================================================
BUG: KASAN: use-after-free in tcp_skb_pcount include/net/tcp.h:912 [inline]
BUG: KASAN: use-after-free in tcp_init_tso_segs+0x19d/0x1f0
net/ipv4/tcp_output.c:1790
Read of size 2 at addr ffff8881d36aecb0 by task syz-executor.1/6498

CPU: 1 PID: 6498 Comm: syz-executor.1 Not tainted 4.14.143+ #0
Call Trace:
__dump_stack lib/dump_stack.c:17 [inline]
dump_stack+0xca/0x134 lib/dump_stack.c:53
print_address_description+0x60/0x226 mm/kasan/report.c:187
__kasan_report.cold+0x1a/0x41 mm/kasan/report.c:316
tcp_skb_pcount include/net/tcp.h:912 [inline]
tcp_init_tso_segs+0x19d/0x1f0 net/ipv4/tcp_output.c:1790
tcp_write_xmit+0x15a/0x4730 net/ipv4/tcp_output.c:2330
__tcp_push_pending_frames+0xa0/0x230 net/ipv4/tcp_output.c:2563
tcp_send_fin+0x154/0xbc0 net/ipv4/tcp_output.c:3115
tcp_close+0xc62/0xf40 net/ipv4/tcp.c:2221
inet_release+0xe9/0x1c0 net/ipv4/af_inet.c:423
inet6_release+0x4c/0x70 net/ipv6/af_inet6.c:449
__sock_release+0xd2/0x2c0 net/socket.c:602
sock_close+0x15/0x20 net/socket.c:1139
__fput+0x25e/0x710 fs/file_table.c:210
task_work_run+0x125/0x1a0 kernel/task_work.c:113
tracehook_notify_resume include/linux/tracehook.h:191 [inline]
exit_to_usermode_loop+0x13b/0x160 arch/x86/entry/common.c:164
prepare_exit_to_usermode arch/x86/entry/common.c:199 [inline]
syscall_return_slowpath arch/x86/entry/common.c:270 [inline]
do_syscall_64+0x3a3/0x520 arch/x86/entry/common.c:297
entry_SYSCALL_64_after_hwframe+0x42/0xb7
RIP: 0033:0x4135d1
RSP: 002b:00007ffc09d5fc30 EFLAGS: 00000293 ORIG_RAX: 0000000000000003
RAX: 0000000000000000 RBX: 0000000000000005 RCX: 00000000004135d1
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000004
RBP: 0000000000000001 R08: 0000000080e89025 R09: 0000000080e89029
R10: 00007ffc09d5fd10 R11: 0000000000000293 R12: 000000000075bf20
R13: 0000000000033036 R14: 00000000007605a0 R15: ffffffffffffffff

Allocated by task 6499:
save_stack mm/kasan/common.c:76 [inline]
set_track mm/kasan/common.c:85 [inline]
__kasan_kmalloc.part.0+0x53/0xc0 mm/kasan/common.c:495
slab_post_alloc_hook mm/slab.h:439 [inline]
slab_alloc_node mm/slub.c:2792 [inline]
slab_alloc mm/slub.c:2800 [inline]
kmem_cache_alloc+0xee/0x360 mm/slub.c:2805
kmem_cache_alloc_node include/linux/slab.h:361 [inline]
__alloc_skb+0xea/0x5c0 net/core/skbuff.c:193
alloc_skb_fclone include/linux/skbuff.h:1022 [inline]
sk_stream_alloc_skb+0xf4/0x8a0 net/ipv4/tcp.c:855
tcp_sendmsg_locked+0xf11/0x2f50 net/ipv4/tcp.c:1301
tcp_sendmsg+0x2b/0x40 net/ipv4/tcp.c:1457
inet_sendmsg+0x15b/0x520 net/ipv4/af_inet.c:760
sock_sendmsg_nosec net/socket.c:646 [inline]
sock_sendmsg+0xb7/0x100 net/socket.c:656
SYSC_sendto net/socket.c:1763 [inline]
SyS_sendto+0x1de/0x2f0 net/socket.c:1731
do_syscall_64+0x19b/0x520 arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x42/0xb7
0xffffffffffffffff

Freed by task 6499:
save_stack mm/kasan/common.c:76 [inline]
set_track mm/kasan/common.c:85 [inline]
__kasan_slab_free+0x164/0x210 mm/kasan/common.c:457
slab_free_hook mm/slub.c:1407 [inline]
slab_free_freelist_hook mm/slub.c:1458 [inline]
slab_free mm/slub.c:3039 [inline]
kmem_cache_free+0xd7/0x3b0 mm/slub.c:3055
kfree_skbmem+0x84/0x110 net/core/skbuff.c:607
sk_wmem_free_skb include/net/sock.h:1416 [inline]
tcp_remove_empty_skb net/ipv4/tcp.c:929 [inline]
tcp_remove_empty_skb+0x264/0x320 net/ipv4/tcp.c:923
tcp_sendmsg_locked+0x1c09/0x2f50 net/ipv4/tcp.c:1435
tcp_sendmsg+0x2b/0x40 net/ipv4/tcp.c:1457
inet_sendmsg+0x15b/0x520 net/ipv4/af_inet.c:760
sock_sendmsg_nosec net/socket.c:646 [inline]
sock_sendmsg+0xb7/0x100 net/socket.c:656
SYSC_sendto net/socket.c:1763 [inline]
SyS_sendto+0x1de/0x2f0 net/socket.c:1731
do_syscall_64+0x19b/0x520 arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x42/0xb7
0xffffffffffffffff

The buggy address belongs to the object at ffff8881d36aec80
which belongs to the cache skbuff_fclone_cache of size 456
The buggy address is located 48 bytes inside of
456-byte region [ffff8881d36aec80, ffff8881d36aee48)
The buggy address belongs to the page:
page:ffffea00074dab80 count:1 mapcount:0 mapping: (null) index:0x0
compound_mapcount: 0
flags: 0x4000000000010200(slab|head)
raw: 4000000000010200 0000000000000000 0000000000000000 00000001800c000c
raw: ffffea0007524200 0000000300000003 ffff8881dab70400 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff8881d36aeb80: fb fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc
ffff8881d36aec00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
> ffff8881d36aec80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff8881d36aed00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff8881d36aed80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================


---
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

no leída,
10 sept 2019, 9:51:08 a.m.10/9/19
para syzkaller-a...@googlegroups.com
syzbot has found a reproducer for the following crash on:

HEAD commit: f02af7b0 Merge 4.14.143 into android-4.14
git tree: android-4.14
console output: https://syzkaller.appspot.com/x/log.txt?x=14606aa5600000
kernel config: https://syzkaller.appspot.com/x/.config?x=4d9cf2fd50fd7015
dashboard link: https://syzkaller.appspot.com/bug?extid=d1ee6e290c1891301c16
compiler: gcc (GCC) 9.0.0 20181231 (experimental)
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=143f4f99600000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=17d2c2f6600000

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

audit: type=1400 audit(1568123250.341:7): avc: denied { map } for
pid=1785 comm="syz-executor455" path="/root/syz-executor455009786"
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: use-after-free in tcp_skb_pcount include/net/tcp.h:912 [inline]
BUG: KASAN: use-after-free in tcp_init_tso_segs+0x19d/0x1f0
net/ipv4/tcp_output.c:1790
Read of size 2 at addr ffff8881d01707b0 by task syz-executor455/1786

CPU: 1 PID: 1786 Comm: syz-executor455 Not tainted 4.14.143+ #0
Call Trace:
__dump_stack lib/dump_stack.c:17 [inline]
dump_stack+0xca/0x134 lib/dump_stack.c:53
print_address_description+0x60/0x226 mm/kasan/report.c:187
__kasan_report.cold+0x1a/0x41 mm/kasan/report.c:316
tcp_skb_pcount include/net/tcp.h:912 [inline]
tcp_init_tso_segs+0x19d/0x1f0 net/ipv4/tcp_output.c:1790
tcp_write_xmit+0x15a/0x4730 net/ipv4/tcp_output.c:2330
__tcp_push_pending_frames+0xa0/0x230 net/ipv4/tcp_output.c:2563
tcp_send_fin+0x154/0xbc0 net/ipv4/tcp_output.c:3115
tcp_close+0xc62/0xf40 net/ipv4/tcp.c:2221
inet_release+0xe9/0x1c0 net/ipv4/af_inet.c:423
__sock_release+0xd2/0x2c0 net/socket.c:602
sock_close+0x15/0x20 net/socket.c:1139
__fput+0x25e/0x710 fs/file_table.c:210
task_work_run+0x125/0x1a0 kernel/task_work.c:113
exit_task_work include/linux/task_work.h:22 [inline]
do_exit+0x9cb/0x2a20 kernel/exit.c:875
do_group_exit+0x100/0x2e0 kernel/exit.c:978
SYSC_exit_group kernel/exit.c:989 [inline]
SyS_exit_group+0x19/0x20 kernel/exit.c:987
do_syscall_64+0x19b/0x520 arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x42/0xb7
RIP: 0033:0x440608
RSP: 002b:00007ffd60fa1688 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7
RAX: ffffffffffffffda RBX: 0000000000000001 RCX: 0000000000440608
RDX: 0000000000000001 RSI: 000000000000003c RDI: 0000000000000001
RBP: 00000000004c6950 R08: 00000000000000e7 R09: ffffffffffffffd0
R10: 0000000020000802 R11: 0000000000000246 R12: 0000000000000001
R13: 00000000006d95e0 R14: 0000000000000000 R15: 0000000000000000

Allocated by task 1786:
save_stack mm/kasan/common.c:76 [inline]
set_track mm/kasan/common.c:85 [inline]
__kasan_kmalloc.part.0+0x53/0xc0 mm/kasan/common.c:495
slab_post_alloc_hook mm/slab.h:439 [inline]
slab_alloc_node mm/slub.c:2792 [inline]
slab_alloc mm/slub.c:2800 [inline]
kmem_cache_alloc+0xee/0x360 mm/slub.c:2805
kmem_cache_alloc_node include/linux/slab.h:361 [inline]
__alloc_skb+0xea/0x5c0 net/core/skbuff.c:193
alloc_skb_fclone include/linux/skbuff.h:1022 [inline]
sk_stream_alloc_skb+0xf4/0x8a0 net/ipv4/tcp.c:855
tcp_sendmsg_locked+0xf11/0x2f50 net/ipv4/tcp.c:1301
tcp_sendmsg+0x2b/0x40 net/ipv4/tcp.c:1457
inet_sendmsg+0x15b/0x520 net/ipv4/af_inet.c:760
sock_sendmsg_nosec net/socket.c:646 [inline]
sock_sendmsg+0xb7/0x100 net/socket.c:656
SYSC_sendto net/socket.c:1763 [inline]
SyS_sendto+0x1de/0x2f0 net/socket.c:1731
do_syscall_64+0x19b/0x520 arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x42/0xb7
0xffffffffffffffff

Freed by task 1786:
save_stack mm/kasan/common.c:76 [inline]
set_track mm/kasan/common.c:85 [inline]
__kasan_slab_free+0x164/0x210 mm/kasan/common.c:457
slab_free_hook mm/slub.c:1407 [inline]
slab_free_freelist_hook mm/slub.c:1458 [inline]
slab_free mm/slub.c:3039 [inline]
kmem_cache_free+0xd7/0x3b0 mm/slub.c:3055
kfree_skbmem+0x84/0x110 net/core/skbuff.c:607
sk_wmem_free_skb include/net/sock.h:1416 [inline]
tcp_remove_empty_skb net/ipv4/tcp.c:929 [inline]
tcp_remove_empty_skb+0x264/0x320 net/ipv4/tcp.c:923
tcp_sendmsg_locked+0x1c09/0x2f50 net/ipv4/tcp.c:1435
tcp_sendmsg+0x2b/0x40 net/ipv4/tcp.c:1457
inet_sendmsg+0x15b/0x520 net/ipv4/af_inet.c:760
sock_sendmsg_nosec net/socket.c:646 [inline]
sock_sendmsg+0xb7/0x100 net/socket.c:656
SYSC_sendto net/socket.c:1763 [inline]
SyS_sendto+0x1de/0x2f0 net/socket.c:1731
do_syscall_64+0x19b/0x520 arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x42/0xb7
0xffffffffffffffff

The buggy address belongs to the object at ffff8881d0170780
which belongs to the cache skbuff_fclone_cache of size 456
The buggy address is located 48 bytes inside of
456-byte region [ffff8881d0170780, ffff8881d0170948)
The buggy address belongs to the page:
page:ffffea0007405c00 count:1 mapcount:0 mapping: (null) index:0x0
compound_mapcount: 0
flags: 0x4000000000010200(slab|head)
raw: 4000000000010200 0000000000000000 0000000000000000 00000001800c000c
raw: dead000000000100 dead000000000200 ffff8881dab70400 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff8881d0170680: fb fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc
ffff8881d0170700: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
> ffff8881d0170780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff8881d0170800: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff8881d0170880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Responder a todos
Responder al autor
Reenviar
0 mensajes nuevos