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

14 views
Skip to first unread message

syzbot

unread,
Apr 16, 2019, 8:56:06 PM4/16/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=1019c81d200000
kernel config: https://syzkaller.appspot.com/x/.config?x=fdadf290ea9fc6f9
dashboard link: https://syzkaller.appspot.com/bug?extid=9fd0aa15586338db8e64
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+9fd0aa...@syzkaller.appspotmail.com

==================================================================
BUG: KASAN: slab-out-of-bounds in tls_push_record+0x1009/0x1210
net/tls/tls_sw.c:255
Read of size 8 at addr ffff888085bd6378 by task syz-executor.1/24795

CPU: 1 PID: 24795 Comm: syz-executor.1 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_load8_noabort+0x14/0x20 mm/kasan/report.c:430
tls_push_record+0x1009/0x1210 net/tls/tls_sw.c:255
tls_sw_push_pending_record+0x23/0x30 net/tls/tls_sw.c:299
tls_handle_open_record net/tls/tls_main.c:158 [inline]
tls_sk_proto_close+0x5da/0x760 net/tls/tls_main.c:270
inet_release+0xf2/0x1c0 net/ipv4/af_inet.c:425
inet6_release+0x53/0x80 net/ipv6/af_inet6.c:450
__sock_release+0xd3/0x2c0 net/socket.c:602
sock_close+0x1b/0x30 net/socket.c:1139
__fput+0x277/0x7a0 fs/file_table.c:210
____fput+0x16/0x20 fs/file_table.c:244
task_work_run+0x119/0x190 kernel/task_work.c:113
tracehook_notify_resume include/linux/tracehook.h:191 [inline]
exit_to_usermode_loop+0x1da/0x220 arch/x86/entry/common.c:163
prepare_exit_to_usermode arch/x86/entry/common.c:198 [inline]
syscall_return_slowpath arch/x86/entry/common.c:267 [inline]
do_syscall_64+0x4a9/0x630 arch/x86/entry/common.c:294
entry_SYSCALL_64_after_hwframe+0x42/0xb7
RIP: 0033:0x4129e1
RSP: 002b:00007ffc500b9930 EFLAGS: 00000293 ORIG_RAX: 0000000000000003
RAX: 0000000000000000 RBX: 0000000000000004 RCX: 00000000004129e1
RDX: 0000001b2fc20000 RSI: 0000000000000000 RDI: 0000000000000003
RBP: 000000000073c900 R08: 0000000033bbb85e R09: 0000000033bbb862
R10: 00007ffc500b9a00 R11: 0000000000000293 R12: 0000000000000001
R13: 000000000073c900 R14: 000000000007434f R15: 000000000073bf0c

Allocated by task 24798:
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]
kzalloc include/linux/slab.h:661 [inline]
tls_set_sw_offload+0x8b/0xe70 net/tls/tls_sw.c:683
do_tls_setsockopt_tx net/tls/tls_main.c:443 [inline]
do_tls_setsockopt net/tls/tls_main.c:468 [inline]
tls_setsockopt+0x22e/0x410 net/tls/tls_main.c:486
sock_common_setsockopt+0x9a/0xe0 net/core/sock.c:2966
SYSC_setsockopt net/socket.c:1865 [inline]
SyS_setsockopt+0x141/0x210 net/socket.c:1844
do_syscall_64+0x1eb/0x630 arch/x86/entry/common.c:289
entry_SYSCALL_64_after_hwframe+0x42/0xb7

Freed by task 6983:
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
kvfree+0x4d/0x60 mm/util.c:416
xt_free_table_info+0x115/0x170 net/netfilter/x_tables.c:1082
__do_replace+0x438/0x5c0 net/ipv6/netfilter/ip6_tables.c:1107
do_replace net/ipv6/netfilter/ip6_tables.c:1161 [inline]
do_ip6t_set_ctl+0x290/0x3ee net/ipv6/netfilter/ip6_tables.c:1685
nf_sockopt net/netfilter/nf_sockopt.c:106 [inline]
nf_setsockopt+0x6d/0xc0 net/netfilter/nf_sockopt.c:115
ipv6_setsockopt net/ipv6/ipv6_sockglue.c:930 [inline]
ipv6_setsockopt+0x10b/0x140 net/ipv6/ipv6_sockglue.c:914
tcp_setsockopt net/ipv4/tcp.c:2805 [inline]
tcp_setsockopt+0x8a/0xe0 net/ipv4/tcp.c:2799
sock_common_setsockopt+0x9a/0xe0 net/core/sock.c:2966
SYSC_setsockopt net/socket.c:1865 [inline]
SyS_setsockopt+0x141/0x210 net/socket.c:1844
do_syscall_64+0x1eb/0x630 arch/x86/entry/common.c:289
entry_SYSCALL_64_after_hwframe+0x42/0xb7

The buggy address belongs to the object at ffff888085bd6380
which belongs to the cache kmalloc-2048 of size 2048
The buggy address is located 8 bytes to the left of
2048-byte region [ffff888085bd6380, ffff888085bd6b80)
The buggy address belongs to the page:
page:ffffea000216f580 count:1 mapcount:0 mapping:ffff888085bd6380 index:0x0
compound_mapcount: 0
flags: 0x1fffc0000008100(slab|head)
raw: 01fffc0000008100 ffff888085bd6380 0000000000000000 0000000100000003
raw: ffffea00022ee620 ffffea00019e3020 ffff8880aa800c40 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff888085bd6200: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff888085bd6280: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
> ffff888085bd6300: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
^
ffff888085bd6380: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffff888085bd6400: 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,
Apr 16, 2019, 9:02:06 PM4/16/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=1736e5b7200000
kernel config: https://syzkaller.appspot.com/x/.config?x=fdadf290ea9fc6f9
dashboard link: https://syzkaller.appspot.com/bug?extid=9fd0aa15586338db8e64
compiler: gcc (GCC) 9.0.0 20181231 (experimental)
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=1699c81d200000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=10205680a00000

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

RDX: 00000000e0ffffff RSI: 00000000200005c0 RDI: 0000000000000003
RBP: 0000000000000005 R08: 0000000000000000 R09: 00000000000000d8
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000401f50
R13: 0000000000401fe0 R14: 0000000000000000 R15: 0000000000000000
==================================================================
BUG: KASAN: slab-out-of-bounds in tls_push_record+0x1009/0x1210
net/tls/tls_sw.c:255
Read of size 8 at addr ffff8880a57e1338 by task syz-executor299/7103

CPU: 1 PID: 7103 Comm: syz-executor299 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_load8_noabort+0x14/0x20 mm/kasan/report.c:430
tls_push_record+0x1009/0x1210 net/tls/tls_sw.c:255
tls_sw_push_pending_record+0x23/0x30 net/tls/tls_sw.c:299
tls_handle_open_record net/tls/tls_main.c:158 [inline]
tls_sk_proto_close+0x5da/0x760 net/tls/tls_main.c:270
inet_release+0xf2/0x1c0 net/ipv4/af_inet.c:425
inet6_release+0x53/0x80 net/ipv6/af_inet6.c:450
__sock_release+0xd3/0x2c0 net/socket.c:602
sock_close+0x1b/0x30 net/socket.c:1139
__fput+0x277/0x7a0 fs/file_table.c:210
____fput+0x16/0x20 fs/file_table.c:244
task_work_run+0x119/0x190 kernel/task_work.c:113
exit_task_work include/linux/task_work.h:22 [inline]
do_exit+0x7df/0x2c10 kernel/exit.c:874
do_group_exit+0x111/0x330 kernel/exit.c:977
SYSC_exit_group kernel/exit.c:988 [inline]
SyS_exit_group+0x1d/0x20 kernel/exit.c:986
do_syscall_64+0x1eb/0x630 arch/x86/entry/common.c:289
entry_SYSCALL_64_after_hwframe+0x42/0xb7
RIP: 0033:0x43f328
RSP: 002b:00007ffce577e298 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 000000000043f328
RDX: 0000000000000000 RSI: 000000000000003c RDI: 0000000000000000
RBP: 00000000004bf088 R08: 00000000000000e7 R09: ffffffffffffffd0
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000001
R13: 00000000006d1180 R14: 0000000000000000 R15: 0000000000000000

Allocated by task 0:
(stack is not available)

Freed by task 0:
(stack is not available)

The buggy address belongs to the object at ffff8880a57e0ac0
which belongs to the cache kmalloc-2048 of size 2048
The buggy address is located 120 bytes to the right of
2048-byte region [ffff8880a57e0ac0, ffff8880a57e12c0)
The buggy address belongs to the page:
page:ffffea000295f800 count:1 mapcount:0 mapping:ffff8880a57e0240 index:0x0
compound_mapcount: 0
flags: 0x1fffc0000008100(slab|head)
raw: 01fffc0000008100 ffff8880a57e0240 0000000000000000 0000000100000003
raw: ffffea0002932aa0 ffff8880aa801948 ffff8880aa800c40 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff8880a57e1200: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff8880a57e1280: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
> ffff8880a57e1300: fc fc fc fc fc fc fc fc 00 00 00 00 00 00 00 00
^
ffff8880a57e1380: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffff8880a57e1400: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
==================================================================

Reply all
Reply to author
Forward
0 new messages