KASAN: use-after-free Read in ip_tunnel_xmit

21 views
Skip to first unread message

syzbot

unread,
Mar 2, 2021, 9:45:20 AM3/2/21
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 3242aa3a Linux 4.14.222
git tree: linux-4.14.y
console output: https://syzkaller.appspot.com/x/log.txt?x=107e020ad00000
kernel config: https://syzkaller.appspot.com/x/.config?x=d6fee509440d713f
dashboard link: https://syzkaller.appspot.com/bug?extid=ecb6390f500765f46563

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+ecb639...@syzkaller.appspotmail.com

==================================================================
BUG: KASAN: use-after-free in ip_tunnel_xmit+0x246f/0x3390 net/ipv4/ip_tunnel.c:659
Read of size 4 at addr ffff888099324b70 by task syz-executor.5/9622

CPU: 1 PID: 9622 Comm: syz-executor.5 Not tainted 4.14.222-syzkaller #0
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+0x1b2/0x281 lib/dump_stack.c:58
print_address_description.cold+0x54/0x1d3 mm/kasan/report.c:252
kasan_report_error.cold+0x8a/0x191 mm/kasan/report.c:351
kasan_report mm/kasan/report.c:409 [inline]
__asan_report_load4_noabort+0x68/0x70 mm/kasan/report.c:429
ip_tunnel_xmit+0x246f/0x3390 net/ipv4/ip_tunnel.c:659
ipgre_xmit+0x398/0x6d0 net/ipv4/ip_gre.c:670
__netdev_start_xmit include/linux/netdevice.h:4041 [inline]
netdev_start_xmit include/linux/netdevice.h:4050 [inline]
xmit_one net/core/dev.c:3005 [inline]
dev_hard_start_xmit+0x188/0x890 net/core/dev.c:3021
__dev_queue_xmit+0x1d7f/0x2480 net/core/dev.c:3521
packet_snd+0x1393/0x21e0 net/packet/af_packet.c:3024
packet_sendmsg+0x1139/0x2ad0 net/packet/af_packet.c:3049
sock_sendmsg_nosec net/socket.c:646 [inline]
sock_sendmsg+0xb5/0x100 net/socket.c:656
sock_no_sendpage+0xe2/0x110 net/core/sock.c:2595
kernel_sendpage net/socket.c:3407 [inline]
sock_sendpage+0xdf/0x140 net/socket.c:871
pipe_to_sendpage+0x226/0x2d0 fs/splice.c:451
splice_from_pipe_feed fs/splice.c:502 [inline]
__splice_from_pipe+0x326/0x7a0 fs/splice.c:626
splice_from_pipe fs/splice.c:661 [inline]
generic_splice_sendpage+0xc1/0x110 fs/splice.c:832
do_splice_from fs/splice.c:851 [inline]
do_splice fs/splice.c:1147 [inline]
SYSC_splice fs/splice.c:1402 [inline]
SyS_splice+0xd59/0x1380 fs/splice.c:1382
do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x46/0xbb
RIP: 0033:0x465ef9
RSP: 002b:00007fc79eb18188 EFLAGS: 00000246 ORIG_RAX: 0000000000000113
RAX: ffffffffffffffda RBX: 000000000056c008 RCX: 0000000000465ef9
RDX: 0000000000000005 RSI: 0000000000000000 RDI: 0000000000000003
RBP: 00000000004bcd1c R08: 00000000ffffffff R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 000000000056c008
R13: 00007ffe8f2197af R14: 00007fc79eb18300 R15: 0000000000022000

Allocated by task 9622:
save_stack mm/kasan/kasan.c:447 [inline]
set_track mm/kasan/kasan.c:459 [inline]
kasan_kmalloc+0xeb/0x160 mm/kasan/kasan.c:551
__do_kmalloc_node mm/slab.c:3682 [inline]
__kmalloc_node_track_caller+0x4c/0x70 mm/slab.c:3696
__kmalloc_reserve net/core/skbuff.c:137 [inline]
__alloc_skb+0x96/0x510 net/core/skbuff.c:205
skb_segment+0x677/0x2e60 net/core/skbuff.c:3668
udp4_ufo_fragment+0x40b/0x690 net/ipv4/udp_offload.c:242
inet_gso_segment+0x470/0x10c0 net/ipv4/af_inet.c:1272
skb_mac_gso_segment+0x240/0x4c0 net/core/dev.c:2745
__skb_gso_segment+0x302/0x600 net/core/dev.c:2818
skb_gso_segment include/linux/netdevice.h:3992 [inline]
validate_xmit_skb+0x49c/0x9f0 net/core/dev.c:3071
__dev_queue_xmit+0x816/0x2480 net/core/dev.c:3513
packet_snd+0x1393/0x21e0 net/packet/af_packet.c:3024
packet_sendmsg+0x1139/0x2ad0 net/packet/af_packet.c:3049
sock_sendmsg_nosec net/socket.c:646 [inline]
sock_sendmsg+0xb5/0x100 net/socket.c:656
sock_no_sendpage+0xe2/0x110 net/core/sock.c:2595
kernel_sendpage net/socket.c:3407 [inline]
sock_sendpage+0xdf/0x140 net/socket.c:871
pipe_to_sendpage+0x226/0x2d0 fs/splice.c:451
splice_from_pipe_feed fs/splice.c:502 [inline]
__splice_from_pipe+0x326/0x7a0 fs/splice.c:626
splice_from_pipe fs/splice.c:661 [inline]
generic_splice_sendpage+0xc1/0x110 fs/splice.c:832
do_splice_from fs/splice.c:851 [inline]
do_splice fs/splice.c:1147 [inline]
SYSC_splice fs/splice.c:1402 [inline]
SyS_splice+0xd59/0x1380 fs/splice.c:1382
do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x46/0xbb

Freed by task 9622:
save_stack mm/kasan/kasan.c:447 [inline]
set_track mm/kasan/kasan.c:459 [inline]
kasan_slab_free+0xc3/0x1a0 mm/kasan/kasan.c:524
__cache_free mm/slab.c:3496 [inline]
kfree+0xc9/0x250 mm/slab.c:3815
skb_free_head net/core/skbuff.c:563 [inline]
pskb_expand_head+0x895/0xd30 net/core/skbuff.c:1504
__pskb_pull_tail+0xd9/0x14a0 net/core/skbuff.c:1907
pskb_may_pull include/linux/skbuff.h:2180 [inline]
ip_tunnel_xmit+0x142c/0x3390 net/ipv4/ip_tunnel.c:651
ipgre_xmit+0x398/0x6d0 net/ipv4/ip_gre.c:670
__netdev_start_xmit include/linux/netdevice.h:4041 [inline]
netdev_start_xmit include/linux/netdevice.h:4050 [inline]
xmit_one net/core/dev.c:3005 [inline]
dev_hard_start_xmit+0x188/0x890 net/core/dev.c:3021
__dev_queue_xmit+0x1d7f/0x2480 net/core/dev.c:3521
packet_snd+0x1393/0x21e0 net/packet/af_packet.c:3024
packet_sendmsg+0x1139/0x2ad0 net/packet/af_packet.c:3049
sock_sendmsg_nosec net/socket.c:646 [inline]
sock_sendmsg+0xb5/0x100 net/socket.c:656
sock_no_sendpage+0xe2/0x110 net/core/sock.c:2595
kernel_sendpage net/socket.c:3407 [inline]
sock_sendpage+0xdf/0x140 net/socket.c:871
pipe_to_sendpage+0x226/0x2d0 fs/splice.c:451
splice_from_pipe_feed fs/splice.c:502 [inline]
__splice_from_pipe+0x326/0x7a0 fs/splice.c:626
splice_from_pipe fs/splice.c:661 [inline]
generic_splice_sendpage+0xc1/0x110 fs/splice.c:832
do_splice_from fs/splice.c:851 [inline]
do_splice fs/splice.c:1147 [inline]
SYSC_splice fs/splice.c:1402 [inline]
SyS_splice+0xd59/0x1380 fs/splice.c:1382
do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x46/0xbb

The buggy address belongs to the object at ffff888099324ac0
which belongs to the cache kmalloc-512 of size 512
The buggy address is located 176 bytes inside of
512-byte region [ffff888099324ac0, ffff888099324cc0)
The buggy address belongs to the page:
page:ffffea000264c900 count:1 mapcount:0 mapping:ffff8880993240c0 index:0x0
flags: 0xfff00000000100(slab)
raw: 00fff00000000100 ffff8880993240c0 0000000000000000 0000000100000006
raw: ffffea000262f5e0 ffffea000264d1e0 ffff88813fe80940 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff888099324a00: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
ffff888099324a80: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb
>ffff888099324b00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff888099324b80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff888099324c00: 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 2, 2021, 10:05:20 AM3/2/21
to syzkaller...@googlegroups.com
syzbot has found a reproducer for the following issue on:

HEAD commit: 3242aa3a Linux 4.14.222
git tree: linux-4.14.y
console output: https://syzkaller.appspot.com/x/log.txt?x=14f2e9cad00000
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=14542b6cd00000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=157b8c0ad00000

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

IPv6: ADDRCONF(NETDEV_CHANGE): macvtap0: link becomes ready
batman_adv: batadv0: Interface activated: batadv_slave_1
IPv6: ADDRCONF(NETDEV_CHANGE): bond0: link becomes ready
IPv6: ADDRCONF(NETDEV_CHANGE): veth1_to_batadv: link becomes ready
==================================================================
BUG: KASAN: use-after-free in ip_tunnel_xmit+0x246f/0x3390 net/ipv4/ip_tunnel.c:659
Read of size 4 at addr ffff8880b0622330 by task syz-executor015/8191

CPU: 1 PID: 8191 Comm: syz-executor015 Not tainted 4.14.222-syzkaller #0
RIP: 0033:0x448ec9
RSP: 002b:00007f353af152f8 EFLAGS: 00000246 ORIG_RAX: 0000000000000113
RAX: ffffffffffffffda RBX: 00000000004cf518 RCX: 0000000000448ec9
RDX: 0000000000000005 RSI: 0000000000000000 RDI: 0000000000000003
RBP: 00000000004cf510 R08: 00000000ffffffff R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00000000004cf51c
R13: 000000000049e004 R14: 6d32cc5e8ead0600 R15: 0000000000022000

Allocated by task 8191:
Freed by task 8191:
The buggy address belongs to the object at ffff8880b0622280
which belongs to the cache kmalloc-512 of size 512
The buggy address is located 176 bytes inside of
512-byte region [ffff8880b0622280, ffff8880b0622480)
The buggy address belongs to the page:
page:ffffea0002c18880 count:1 mapcount:0 mapping:ffff8880b0622000 index:0x0
flags: 0xfff00000000100(slab)
raw: 00fff00000000100 ffff8880b0622000 0000000000000000 0000000100000006
raw: ffffea0002c69ee0 ffffea0002862460 ffff88813fe80940 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff8880b0622200: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff8880b0622280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff8880b0622300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff8880b0622380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff8880b0622400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Reply all
Reply to author
Forward
0 new messages