KASAN: use-after-free Read in bpf_skb_change_proto

13 views
Skip to first unread message

syzbot

unread,
Aug 9, 2019, 6:18:05 PM8/9/19
to syzkaller...@googlegroups.com
Hello,

syzbot found the following crash on:

HEAD commit: 3ffe1e79 Linux 4.14.138
git tree: linux-4.14.y
console output: https://syzkaller.appspot.com/x/log.txt?x=10c7d59a600000
kernel config: https://syzkaller.appspot.com/x/.config?x=978e269523a888e8
dashboard link: https://syzkaller.appspot.com/bug?extid=38b78ff7dc6245aeb264
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+38b78f...@syzkaller.appspotmail.com

==================================================================
BUG: KASAN: use-after-free in bpf_skb_proto_xlat net/core/filter.c:2151
[inline]
BUG: KASAN: use-after-free in ____bpf_skb_change_proto
net/core/filter.c:2189 [inline]
BUG: KASAN: use-after-free in bpf_skb_change_proto+0xdbc/0x10f0
net/core/filter.c:2164
Read of size 2 at addr ffff888096109400 by task syz-executor.1/29005

CPU: 0 PID: 29005 Comm: syz-executor.1 Not tainted 4.14.138 #34
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_load2_noabort+0x14/0x20 mm/kasan/report.c:428
bpf_skb_proto_xlat net/core/filter.c:2151 [inline]
____bpf_skb_change_proto net/core/filter.c:2189 [inline]
bpf_skb_change_proto+0xdbc/0x10f0 net/core/filter.c:2164
bpf_prog_0a61b7f223ef83f3+0x5f2/0x1000

Allocated by task 27277:
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_node+0x144/0x780 mm/slab.c:3642
__alloc_skb+0x9c/0x500 net/core/skbuff.c:193
alloc_skb include/linux/skbuff.h:980 [inline]
alloc_skb_with_frags+0x86/0x4b0 net/core/skbuff.c:5209
sock_alloc_send_pskb+0x5db/0x740 net/core/sock.c:2073
sock_alloc_send_skb+0x32/0x40 net/core/sock.c:2090
__ip_append_data.isra.0+0x1228/0x20c0 net/ipv4/ip_output.c:972
ip_make_skb+0x17a/0x1d0 net/ipv4/ip_output.c:1485
udp_sendmsg+0x16a6/0x1da0 net/ipv4/udp.c:1052
udpv6_sendmsg+0x1312/0x2560 net/ipv6/udp.c:1193
inet_sendmsg+0x122/0x500 net/ipv4/af_inet.c:762
sock_sendmsg_nosec net/socket.c:646 [inline]
sock_sendmsg+0xce/0x110 net/socket.c:656
___sys_sendmsg+0x349/0x840 net/socket.c:2062
__sys_sendmmsg+0x152/0x3a0 net/socket.c:2152
SYSC_sendmmsg net/socket.c:2183 [inline]
SyS_sendmmsg+0x35/0x60 net/socket.c:2178
do_syscall_64+0x1e8/0x640 arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x42/0xb7

Freed by task 27277:
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
kfree_skbmem net/core/skbuff.c:586 [inline]
kfree_skbmem+0xac/0x120 net/core/skbuff.c:580
__kfree_skb net/core/skbuff.c:646 [inline]
kfree_skb+0xbd/0x340 net/core/skbuff.c:663
ip_tunnel_xmit+0x5b7/0x3189 net/ipv4/ip_tunnel.c:805
__gre_xmit+0x4eb/0x890 net/ipv4/ip_gre.c:444
ipgre_xmit+0x3a9/0x710 net/ipv4/ip_gre.c:670
__netdev_start_xmit include/linux/netdevice.h:4033 [inline]
netdev_start_xmit include/linux/netdevice.h:4042 [inline]
xmit_one net/core/dev.c:3009 [inline]
dev_hard_start_xmit+0x18c/0x8b0 net/core/dev.c:3025
__dev_queue_xmit+0x1d95/0x25e0 net/core/dev.c:3525
dev_queue_xmit+0x18/0x20 net/core/dev.c:3558
neigh_connected_output+0x3c5/0x5a0 net/core/neighbour.c:1393
neigh_output include/net/neighbour.h:500 [inline]
ip_finish_output2+0x766/0x14a0 net/ipv4/ip_output.c:229
ip_finish_output+0x56d/0xc60 net/ipv4/ip_output.c:317
NF_HOOK_COND include/linux/netfilter.h:239 [inline]
ip_mc_output+0x24a/0xd40 net/ipv4/ip_output.c:390
dst_output include/net/dst.h:462 [inline]
ip_local_out+0x97/0x170 net/ipv4/ip_output.c:124
ip_send_skb+0x3e/0xc0 net/ipv4/ip_output.c:1418
udp_send_skb+0x616/0xb90 net/ipv4/udp.c:833
udp_sendmsg+0x16df/0x1da0 net/ipv4/udp.c:1057
udpv6_sendmsg+0x1312/0x2560 net/ipv6/udp.c:1193
inet_sendmsg+0x122/0x500 net/ipv4/af_inet.c:762
sock_sendmsg_nosec net/socket.c:646 [inline]
sock_sendmsg+0xce/0x110 net/socket.c:656
___sys_sendmsg+0x349/0x840 net/socket.c:2062
__sys_sendmmsg+0x152/0x3a0 net/socket.c:2152
SYSC_sendmmsg net/socket.c:2183 [inline]
SyS_sendmmsg+0x35/0x60 net/socket.c:2178
do_syscall_64+0x1e8/0x640 arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x42/0xb7

The buggy address belongs to the object at ffff888096109400
which belongs to the cache skbuff_head_cache of size 232
The buggy address is located 0 bytes inside of
232-byte region [ffff888096109400, ffff8880961094e8)
The buggy address belongs to the page:
page:ffffea0002584240 count:1 mapcount:0 mapping:ffff888096109040
index:0xffff888096109400
flags: 0x1fffc0000000100(slab)
raw: 01fffc0000000100 ffff888096109040 ffff888096109400 000000010000000b
raw: ffffea0002a03720 ffffea00022d82e0 ffff88821b757240 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff888096109300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff888096109380: fb fb fb fb fb fc fc fc fc fc fc fc fc fc fc fc
> ffff888096109400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff888096109480: fb fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc
ffff888096109500: fc fc fc fc fc fc fc fc 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,
Dec 31, 2019, 5:54:06 AM12/31/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