KASAN: use-after-free Read in eth_header_parse_protocol

39 views
Skip to first unread message

syzbot

unread,
Mar 17, 2021, 3:43:19 PM3/17/21
to syzkaller-a...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 3941336d Merge 5.4.106 into android12-5.4
git tree: android12-5.4
console output: https://syzkaller.appspot.com/x/log.txt?x=104f55ecd00000
kernel config: https://syzkaller.appspot.com/x/.config?x=eb4ef7343e49f230
dashboard link: https://syzkaller.appspot.com/bug?extid=510189dc04dd72bb90fb
compiler: Debian clang version 11.0.1-2

Unfortunately, I don't have any reproducer for this issue yet.

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

==================================================================
BUG: KASAN: use-after-free in eth_header_parse_protocol+0xad/0xd0 net/ethernet/eth.c:282
Read of size 2 at addr ffff8881ecfc000b by task syz-executor.4/15086

CPU: 1 PID: 15086 Comm: syz-executor.4 Not tainted 5.4.106-syzkaller-00698-g3941336d0e38 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
__dump_stack lib/dump_stack.c:77 [inline]
dump_stack+0x1d8/0x24e lib/dump_stack.c:118
print_address_description+0x9b/0x650 mm/kasan/report.c:384
__kasan_report+0x182/0x260 mm/kasan/report.c:516
kasan_report+0x30/0x60 mm/kasan/common.c:641
eth_header_parse_protocol+0xad/0xd0 net/ethernet/eth.c:282
dev_parse_header_protocol include/linux/netdevice.h:2984 [inline]
virtio_net_hdr_to_skb+0x6de/0xd70 include/linux/virtio_net.h:83
packet_snd net/packet/af_packet.c:2976 [inline]
packet_sendmsg+0x483a/0x6780 net/packet/af_packet.c:3013
sock_sendmsg_nosec net/socket.c:638 [inline]
sock_sendmsg net/socket.c:658 [inline]
sock_write_iter+0x330/0x450 net/socket.c:990
call_write_iter include/linux/fs.h:1971 [inline]
new_sync_write fs/read_write.c:483 [inline]
__vfs_write+0x5ec/0x780 fs/read_write.c:496
vfs_write+0x212/0x4e0 fs/read_write.c:558
ksys_write+0x186/0x2b0 fs/read_write.c:611
do_syscall_64+0xcb/0x1e0 arch/x86/entry/common.c:290
entry_SYSCALL_64_after_hwframe+0x44/0xa9
RIP: 0033:0x465f69
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 bc ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f03a6627188 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 000000000056bf60 RCX: 0000000000465f69
RDX: 000000000000fdef RSI: 0000000020000000 RDI: 0000000000000003
RBP: 00000000004bfa8f R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 000000000056bf60
R13: 00007ffd614453df R14: 00007f03a6627300 R15: 0000000000022000

Allocated by task 15021:
save_stack mm/kasan/common.c:70 [inline]
set_track mm/kasan/common.c:78 [inline]
__kasan_kmalloc+0x137/0x1e0 mm/kasan/common.c:517
slab_post_alloc_hook mm/slab.h:584 [inline]
slab_alloc_node mm/slub.c:2821 [inline]
slab_alloc mm/slub.c:2829 [inline]
__kmalloc_track_caller+0x13a/0x2e0 mm/slub.c:4439
__kmalloc_reserve net/core/skbuff.c:142 [inline]
__alloc_skb+0xaf/0x4d0 net/core/skbuff.c:210
alloc_skb include/linux/skbuff.h:1057 [inline]
nlmsg_new include/net/netlink.h:888 [inline]
rtmsg_ifinfo_build_skb+0x81/0x180 net/core/rtnetlink.c:3500
rtmsg_ifinfo_event net/core/rtnetlink.c:3536 [inline]
rtmsg_ifinfo+0x73/0x120 net/core/rtnetlink.c:3545
__dev_notify_flags+0xe0/0x4f0 net/core/dev.c:7921
rtnl_configure_link+0x216/0x320 net/core/rtnetlink.c:2914
veth_newlink+0x6d2/0xaf0 drivers/net/veth.c:1310
__rtnl_newlink net/core/rtnetlink.c:3227 [inline]
rtnl_newlink+0x1558/0x1ce0 net/core/rtnetlink.c:3286
rtnetlink_rcv_msg+0xb74/0xd00 net/core/rtnetlink.c:5255
netlink_rcv_skb+0x200/0x480 net/netlink/af_netlink.c:2478
netlink_unicast_kernel net/netlink/af_netlink.c:1303 [inline]
netlink_unicast+0x865/0x9f0 net/netlink/af_netlink.c:1329
netlink_sendmsg+0x9ab/0xd40 net/netlink/af_netlink.c:1918
sock_sendmsg_nosec net/socket.c:638 [inline]
sock_sendmsg net/socket.c:658 [inline]
__sys_sendto+0x4f1/0x6c0 net/socket.c:1953
__do_sys_sendto net/socket.c:1965 [inline]
__se_sys_sendto net/socket.c:1961 [inline]
__x64_sys_sendto+0xda/0xf0 net/socket.c:1961
do_syscall_64+0xcb/0x1e0 arch/x86/entry/common.c:290
entry_SYSCALL_64_after_hwframe+0x44/0xa9

Freed by task 15021:
save_stack mm/kasan/common.c:70 [inline]
set_track mm/kasan/common.c:78 [inline]
kasan_set_free_info mm/kasan/common.c:333 [inline]
__kasan_slab_free+0x18a/0x240 mm/kasan/common.c:475
slab_free_hook mm/slub.c:1454 [inline]
slab_free_freelist_hook+0x7b/0x150 mm/slub.c:1492
slab_free mm/slub.c:3072 [inline]
kfree+0xe0/0x660 mm/slub.c:4061
skb_free_head net/core/skbuff.c:601 [inline]
pskb_expand_head+0x350/0xfa0 net/core/skbuff.c:1672
netlink_trim+0x194/0x230 net/netlink/af_netlink.c:1285
netlink_broadcast_filtered+0x6d/0x10a0 net/netlink/af_netlink.c:1490
netlink_broadcast net/netlink/af_netlink.c:1535 [inline]
nlmsg_multicast include/net/netlink.h:968 [inline]
nlmsg_notify+0xa2/0x140 net/netlink/af_netlink.c:2521
__dev_notify_flags+0xe0/0x4f0 net/core/dev.c:7921
rtnl_configure_link+0x216/0x320 net/core/rtnetlink.c:2914
veth_newlink+0x6d2/0xaf0 drivers/net/veth.c:1310
__rtnl_newlink net/core/rtnetlink.c:3227 [inline]
rtnl_newlink+0x1558/0x1ce0 net/core/rtnetlink.c:3286
rtnetlink_rcv_msg+0xb74/0xd00 net/core/rtnetlink.c:5255
netlink_rcv_skb+0x200/0x480 net/netlink/af_netlink.c:2478
netlink_unicast_kernel net/netlink/af_netlink.c:1303 [inline]
netlink_unicast+0x865/0x9f0 net/netlink/af_netlink.c:1329
netlink_sendmsg+0x9ab/0xd40 net/netlink/af_netlink.c:1918
sock_sendmsg_nosec net/socket.c:638 [inline]
sock_sendmsg net/socket.c:658 [inline]
__sys_sendto+0x4f1/0x6c0 net/socket.c:1953
__do_sys_sendto net/socket.c:1965 [inline]
__se_sys_sendto net/socket.c:1961 [inline]
__x64_sys_sendto+0xda/0xf0 net/socket.c:1961
do_syscall_64+0xcb/0x1e0 arch/x86/entry/common.c:290
entry_SYSCALL_64_after_hwframe+0x44/0xa9

The buggy address belongs to the object at ffff8881ecfc0000
which belongs to the cache kmalloc-4k of size 4096
The buggy address is located 11 bytes inside of
4096-byte region [ffff8881ecfc0000, ffff8881ecfc1000)
The buggy address belongs to the page:
page:ffffea0007b3f000 refcount:1 mapcount:0 mapping:ffff8881f5c0c280 index:0x0 compound_mapcount: 0
flags: 0x8000000000010200(slab|head)
raw: 8000000000010200 dead000000000100 dead000000000122 ffff8881f5c0c280
raw: 0000000000000000 0000000000040004 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff8881ecfbff00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffff8881ecfbff80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff8881ecfc0000: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff8881ecfc0080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff8881ecfc0100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================


---
This report 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 issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

syzbot

unread,
Mar 17, 2021, 5:24:16 PM3/17/21
to syzkaller-a...@googlegroups.com
syzbot has found a reproducer for the following issue on:

HEAD commit: 3941336d Merge 5.4.106 into android12-5.4
git tree: android12-5.4
console output: https://syzkaller.appspot.com/x/log.txt?x=144b2f56d00000
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=17136006d00000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=151a58d2d00000

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

==================================================================
BUG: KASAN: use-after-free in eth_header_parse_protocol+0xad/0xd0 net/ethernet/eth.c:282
Read of size 2 at addr ffff8881e88f000b by task syz-executor293/338

CPU: 0 PID: 338 Comm: syz-executor293 Not tainted 5.4.106-syzkaller-00698-g3941336d0e38 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
__dump_stack lib/dump_stack.c:77 [inline]
dump_stack+0x1d8/0x24e lib/dump_stack.c:118
print_address_description+0x9b/0x650 mm/kasan/report.c:384
__kasan_report+0x182/0x260 mm/kasan/report.c:516
kasan_report+0x30/0x60 mm/kasan/common.c:641
eth_header_parse_protocol+0xad/0xd0 net/ethernet/eth.c:282
dev_parse_header_protocol include/linux/netdevice.h:2984 [inline]
virtio_net_hdr_to_skb+0x6de/0xd70 include/linux/virtio_net.h:83
packet_snd net/packet/af_packet.c:2976 [inline]
packet_sendmsg+0x483a/0x6780 net/packet/af_packet.c:3013
sock_sendmsg_nosec net/socket.c:638 [inline]
sock_sendmsg net/socket.c:658 [inline]
sock_write_iter+0x330/0x450 net/socket.c:990
call_write_iter include/linux/fs.h:1971 [inline]
new_sync_write fs/read_write.c:483 [inline]
__vfs_write+0x5ec/0x780 fs/read_write.c:496
vfs_write+0x212/0x4e0 fs/read_write.c:558
ksys_write+0x186/0x2b0 fs/read_write.c:611
do_syscall_64+0xcb/0x1e0 arch/x86/entry/common.c:290
entry_SYSCALL_64_after_hwframe+0x44/0xa9
RIP: 0033:0x43ef39
Code: 28 c3 e8 2a 14 00 00 66 2e 0f 1f 84 00 00 00 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 c0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffd4a23ee78 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 0000000000400488 RCX: 000000000043ef39
RDX: 000000000000fdef RSI: 0000000020000000 RDI: 0000000000000003
RBP: 0000000000402f20 R08: 0000000000400488 R09: 0000000000400488
R10: 0000000000400488 R11: 0000000000000246 R12: 0000000000402fb0
R13: 0000000000000000 R14: 00000000004ac018 R15: 0000000000400488

Allocated by task 338:
save_stack mm/kasan/common.c:70 [inline]
set_track mm/kasan/common.c:78 [inline]
__kasan_kmalloc+0x137/0x1e0 mm/kasan/common.c:517
slab_post_alloc_hook mm/slab.h:584 [inline]
slab_alloc_node mm/slub.c:2821 [inline]
slab_alloc mm/slub.c:2829 [inline]
kmem_cache_alloc+0x115/0x290 mm/slub.c:2834
getname_flags+0xba/0x640 fs/namei.c:141
user_path_at_empty+0x28/0x50 fs/namei.c:2683
user_path_at include/linux/namei.h:49 [inline]
do_faccessat+0x323/0x7a0 fs/open.c:398
do_syscall_64+0xcb/0x1e0 arch/x86/entry/common.c:290
entry_SYSCALL_64_after_hwframe+0x44/0xa9

Freed by task 338:
save_stack mm/kasan/common.c:70 [inline]
set_track mm/kasan/common.c:78 [inline]
kasan_set_free_info mm/kasan/common.c:333 [inline]
__kasan_slab_free+0x18a/0x240 mm/kasan/common.c:475
slab_free_hook mm/slub.c:1454 [inline]
slab_free_freelist_hook+0x7b/0x150 mm/slub.c:1492
slab_free mm/slub.c:3072 [inline]
kmem_cache_free+0xb8/0x5f0 mm/slub.c:3088
putname fs/namei.c:262 [inline]
filename_lookup+0x4bb/0x6a0 fs/namei.c:2432
user_path_at include/linux/namei.h:49 [inline]
do_faccessat+0x323/0x7a0 fs/open.c:398
do_syscall_64+0xcb/0x1e0 arch/x86/entry/common.c:290
entry_SYSCALL_64_after_hwframe+0x44/0xa9

The buggy address belongs to the object at ffff8881e88f0000
which belongs to the cache names_cache of size 4096
The buggy address is located 11 bytes inside of
4096-byte region [ffff8881e88f0000, ffff8881e88f1000)
The buggy address belongs to the page:
page:ffffea0007a23c00 refcount:1 mapcount:0 mapping:ffff8881f5cfb680 index:0x0 compound_mapcount: 0
flags: 0x8000000000010200(slab|head)
raw: 8000000000010200 dead000000000100 dead000000000122 ffff8881f5cfb680
raw: 0000000000000000 0000000000070007 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff8881e88eff00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffff8881e88eff80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff8881e88f0000: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff8881e88f0080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff8881e88f0100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb

Lee Jones

unread,
Oct 11, 2021, 10:11:26 AM10/11/21
to syzkaller-android-bugs
#syz fix: net: ensure mac header is set in virtio_net_hdr_to_skb()

syzbot

unread,
Oct 11, 2021, 10:11:29 AM10/11/21
to 'Lee Jones' via syzkaller-android-bugs, syzkaller-a...@googlegroups.com
> #syz fix: net: ensure mac header is set in virtio_net_hdr_to_skb()

I see the command but can't find the corresponding bug.
Please resend the email to syzbo...@syzkaller.appspotmail.com address
that is the sender of the bug report (also present in the Reported-by tag).
> --
> You received this message because you are subscribed to the Google Groups "syzkaller-android-bugs" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to syzkaller-android...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/syzkaller-android-bugs/89dc79dc-8b42-4b09-8c14-10c4dcbdb060n%40googlegroups.com.

Lee Jones

unread,
Oct 11, 2021, 10:18:21 AM10/11/21
to syzbot+510189...@syzkaller.appspotmail.com, syzkaller-a...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages