linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* KASAN: use-after-free Write in skb_release_data (2)
@ 2018-10-15  6:30 syzbot
  2018-10-15  7:49 ` Dmitry Vyukov
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: syzbot @ 2018-10-15  6:30 UTC (permalink / raw)
  To: davem, kuznet, linux-kernel, netdev, syzkaller-bugs, yoshfuji

Hello,

syzbot found the following crash on:

HEAD commit:    e40a826a6cbc qed: Add support for virtual link.
git tree:       net-next
console output: https://syzkaller.appspot.com/x/log.txt?x=168954a5400000
kernel config:  https://syzkaller.appspot.com/x/.config?x=7e7e2279c0020d5f
dashboard link: https://syzkaller.appspot.com/bug?extid=580be3953ed99133804f
compiler:       gcc (GCC) 8.0.1 20180413 (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+580be3953ed99133804f@syzkaller.appspotmail.com

==================================================================
BUG: KASAN: use-after-free in atomic_sub_return  
include/asm-generic/atomic-instrumented.h:305 [inline]
BUG: KASAN: use-after-free in skb_release_data+0x1a3/0x880  
net/core/skbuff.c:559
Write of size 4 at addr ffff8801d8cb4120 by task syz-executor0/8395

CPU: 0 PID: 8395 Comm: syz-executor0 Not tainted 4.19.0-rc6+ #254
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+0x1c4/0x2b4 lib/dump_stack.c:113
  print_address_description.cold.8+0x9/0x1ff mm/kasan/report.c:256
  kasan_report_error mm/kasan/report.c:354 [inline]
  kasan_report.cold.9+0x242/0x309 mm/kasan/report.c:412
  check_memory_region_inline mm/kasan/kasan.c:260 [inline]
  check_memory_region+0x13e/0x1b0 mm/kasan/kasan.c:267
  kasan_check_write+0x14/0x20 mm/kasan/kasan.c:278
  atomic_sub_return include/asm-generic/atomic-instrumented.h:305 [inline]
  skb_release_data+0x1a3/0x880 net/core/skbuff.c:559
  skb_release_all+0x4a/0x60 net/core/skbuff.c:627
  __kfree_skb net/core/skbuff.c:641 [inline]
  kfree_skb+0x1bb/0x580 net/core/skbuff.c:659
  sit_tunnel_xmit+0x173/0x30d0 net/ipv6/sit.c:1044
  __netdev_start_xmit include/linux/netdevice.h:4328 [inline]
  netdev_start_xmit include/linux/netdevice.h:4337 [inline]
  xmit_one net/core/dev.c:3219 [inline]
  dev_hard_start_xmit+0x295/0xc90 net/core/dev.c:3235
  __dev_queue_xmit+0x2f0d/0x3950 net/core/dev.c:3805
  dev_queue_xmit+0x17/0x20 net/core/dev.c:3838
  packet_sendmsg_spkt+0xf44/0x16f0 net/packet/af_packet.c:1975
  sock_sendmsg_nosec net/socket.c:621 [inline]
  sock_sendmsg+0xd5/0x120 net/socket.c:631
  ___sys_sendmsg+0x7fd/0x930 net/socket.c:2116
  __sys_sendmsg+0x11d/0x280 net/socket.c:2154
  __do_sys_sendmsg net/socket.c:2163 [inline]
  __se_sys_sendmsg net/socket.c:2161 [inline]
  __x64_sys_sendmsg+0x78/0xb0 net/socket.c:2161
  do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290
  entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x457519
Code: 1d b4 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 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 0f 83 eb b3 fb ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007f2a52d30c78 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 0000000000457519
RDX: 0000000000000000 RSI: 00000000200003c0 RDI: 0000000000000003
RBP: 000000000072bf00 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007f2a52d316d4
R13: 00000000004c34d5 R14: 00000000004d52c8 R15: 00000000ffffffff

Allocated by task 8395:
  save_stack+0x43/0xd0 mm/kasan/kasan.c:448
  set_track mm/kasan/kasan.c:460 [inline]
  kasan_kmalloc+0xc7/0xe0 mm/kasan/kasan.c:553
  __do_kmalloc_node mm/slab.c:3682 [inline]
  __kmalloc_node_track_caller+0x47/0x70 mm/slab.c:3696
  __kmalloc_reserve.isra.39+0x41/0xe0 net/core/skbuff.c:137
  __alloc_skb+0x155/0x770 net/core/skbuff.c:205
  alloc_skb include/linux/skbuff.h:997 [inline]
  sock_wmalloc+0x16d/0x1f0 net/core/sock.c:1934
  packet_sendmsg_spkt+0x48a/0x16f0 net/packet/af_packet.c:1922
  sock_sendmsg_nosec net/socket.c:621 [inline]
  sock_sendmsg+0xd5/0x120 net/socket.c:631
  ___sys_sendmsg+0x7fd/0x930 net/socket.c:2116
  __sys_sendmsg+0x11d/0x280 net/socket.c:2154
  __do_sys_sendmsg net/socket.c:2163 [inline]
  __se_sys_sendmsg net/socket.c:2161 [inline]
  __x64_sys_sendmsg+0x78/0xb0 net/socket.c:2161
  do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290
  entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 8395:
  save_stack+0x43/0xd0 mm/kasan/kasan.c:448
  set_track mm/kasan/kasan.c:460 [inline]
  __kasan_slab_free+0x102/0x150 mm/kasan/kasan.c:521
  kasan_slab_free+0xe/0x10 mm/kasan/kasan.c:528
  __cache_free mm/slab.c:3498 [inline]
  kfree+0xcf/0x230 mm/slab.c:3813
  skb_free_head+0x99/0xc0 net/core/skbuff.c:550
  skb_release_data+0x6a4/0x880 net/core/skbuff.c:570
  skb_release_all+0x4a/0x60 net/core/skbuff.c:627
  __kfree_skb net/core/skbuff.c:641 [inline]
  consume_skb+0x1ae/0x570 net/core/skbuff.c:701
  packet_rcv+0x172/0x1820 net/packet/af_packet.c:2139
  dev_queue_xmit_nit+0x8ae/0xb30 net/core/dev.c:2020
  xmit_one net/core/dev.c:3215 [inline]
  dev_hard_start_xmit+0x186/0xc90 net/core/dev.c:3235
  __dev_queue_xmit+0x2f0d/0x3950 net/core/dev.c:3805
  dev_queue_xmit+0x17/0x20 net/core/dev.c:3838
  packet_sendmsg_spkt+0xf44/0x16f0 net/packet/af_packet.c:1975
  sock_sendmsg_nosec net/socket.c:621 [inline]
  sock_sendmsg+0xd5/0x120 net/socket.c:631
  ___sys_sendmsg+0x7fd/0x930 net/socket.c:2116
  __sys_sendmsg+0x11d/0x280 net/socket.c:2154
  __do_sys_sendmsg net/socket.c:2163 [inline]
  __se_sys_sendmsg net/socket.c:2161 [inline]
  __x64_sys_sendmsg+0x78/0xb0 net/socket.c:2161
  do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290
  entry_SYSCALL_64_after_hwframe+0x49/0xbe

The buggy address belongs to the object at ffff8801d8cb4040
  which belongs to the cache kmalloc-512 of size 512
The buggy address is located 224 bytes inside of
  512-byte region [ffff8801d8cb4040, ffff8801d8cb4240)
The buggy address belongs to the page:
page:ffffea0007632d00 count:1 mapcount:0 mapping:ffff8801da800940  
index:0xffff8801d8cb42c0
flags: 0x2fffc0000000100(slab)
raw: 02fffc0000000100 ffffea00070baf08 ffffea000736a788 ffff8801da800940
raw: ffff8801d8cb42c0 ffff8801d8cb4040 0000000100000005 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
  ffff8801d8cb4000: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb
  ffff8801d8cb4080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
> ffff8801d8cb4100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                ^
  ffff8801d8cb4180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
  ffff8801d8cb4200: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
==================================================================


---
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 syzkaller@googlegroups.com.

syzbot will keep track of this bug report. See:
https://goo.gl/tpsmEJ#bug-status-tracking for how to communicate with  
syzbot.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: KASAN: use-after-free Write in skb_release_data (2)
  2018-10-15  6:30 KASAN: use-after-free Write in skb_release_data (2) syzbot
@ 2018-10-15  7:49 ` Dmitry Vyukov
  2019-03-25  3:31 ` syzbot
  2019-03-25  8:19 ` syzbot
  2 siblings, 0 replies; 6+ messages in thread
From: Dmitry Vyukov @ 2018-10-15  7:49 UTC (permalink / raw)
  To: syzbot
  Cc: David Miller, Alexey Kuznetsov, LKML, netdev, syzkaller-bugs,
	Hideaki YOSHIFUJI

On Mon, Oct 15, 2018 at 8:30 AM, syzbot
<syzbot+580be3953ed99133804f@syzkaller.appspotmail.com> wrote:
> Hello,
>
> syzbot found the following crash on:
>
> HEAD commit:    e40a826a6cbc qed: Add support for virtual link.
> git tree:       net-next
> console output: https://syzkaller.appspot.com/x/log.txt?x=168954a5400000
> kernel config:  https://syzkaller.appspot.com/x/.config?x=7e7e2279c0020d5f
> dashboard link: https://syzkaller.appspot.com/bug?extid=580be3953ed99133804f
> compiler:       gcc (GCC) 8.0.1 20180413 (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+580be3953ed99133804f@syzkaller.appspotmail.com
>
> ==================================================================
> BUG: KASAN: use-after-free in atomic_sub_return
> include/asm-generic/atomic-instrumented.h:305 [inline]
> BUG: KASAN: use-after-free in skb_release_data+0x1a3/0x880
> net/core/skbuff.c:559
> Write of size 4 at addr ffff8801d8cb4120 by task syz-executor0/8395
>
> CPU: 0 PID: 8395 Comm: syz-executor0 Not tainted 4.19.0-rc6+ #254
> 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+0x1c4/0x2b4 lib/dump_stack.c:113
>  print_address_description.cold.8+0x9/0x1ff mm/kasan/report.c:256
>  kasan_report_error mm/kasan/report.c:354 [inline]
>  kasan_report.cold.9+0x242/0x309 mm/kasan/report.c:412
>  check_memory_region_inline mm/kasan/kasan.c:260 [inline]
>  check_memory_region+0x13e/0x1b0 mm/kasan/kasan.c:267
>  kasan_check_write+0x14/0x20 mm/kasan/kasan.c:278
>  atomic_sub_return include/asm-generic/atomic-instrumented.h:305 [inline]
>  skb_release_data+0x1a3/0x880 net/core/skbuff.c:559
>  skb_release_all+0x4a/0x60 net/core/skbuff.c:627
>  __kfree_skb net/core/skbuff.c:641 [inline]
>  kfree_skb+0x1bb/0x580 net/core/skbuff.c:659
>  sit_tunnel_xmit+0x173/0x30d0 net/ipv6/sit.c:1044
>  __netdev_start_xmit include/linux/netdevice.h:4328 [inline]
>  netdev_start_xmit include/linux/netdevice.h:4337 [inline]
>  xmit_one net/core/dev.c:3219 [inline]
>  dev_hard_start_xmit+0x295/0xc90 net/core/dev.c:3235
>  __dev_queue_xmit+0x2f0d/0x3950 net/core/dev.c:3805
>  dev_queue_xmit+0x17/0x20 net/core/dev.c:3838
>  packet_sendmsg_spkt+0xf44/0x16f0 net/packet/af_packet.c:1975
>  sock_sendmsg_nosec net/socket.c:621 [inline]
>  sock_sendmsg+0xd5/0x120 net/socket.c:631
>  ___sys_sendmsg+0x7fd/0x930 net/socket.c:2116
>  __sys_sendmsg+0x11d/0x280 net/socket.c:2154
>  __do_sys_sendmsg net/socket.c:2163 [inline]
>  __se_sys_sendmsg net/socket.c:2161 [inline]
>  __x64_sys_sendmsg+0x78/0xb0 net/socket.c:2161
>  do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290
>  entry_SYSCALL_64_after_hwframe+0x49/0xbe
> RIP: 0033:0x457519
> Code: 1d b4 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 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
> 0f 83 eb b3 fb ff c3 66 2e 0f 1f 84 00 00 00 00
> RSP: 002b:00007f2a52d30c78 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
> RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 0000000000457519
> RDX: 0000000000000000 RSI: 00000000200003c0 RDI: 0000000000000003
> RBP: 000000000072bf00 R08: 0000000000000000 R09: 0000000000000000
> R10: 0000000000000000 R11: 0000000000000246 R12: 00007f2a52d316d4
> R13: 00000000004c34d5 R14: 00000000004d52c8 R15: 00000000ffffffff
>
> Allocated by task 8395:
>  save_stack+0x43/0xd0 mm/kasan/kasan.c:448
>  set_track mm/kasan/kasan.c:460 [inline]
>  kasan_kmalloc+0xc7/0xe0 mm/kasan/kasan.c:553
>  __do_kmalloc_node mm/slab.c:3682 [inline]
>  __kmalloc_node_track_caller+0x47/0x70 mm/slab.c:3696
>  __kmalloc_reserve.isra.39+0x41/0xe0 net/core/skbuff.c:137
>  __alloc_skb+0x155/0x770 net/core/skbuff.c:205
>  alloc_skb include/linux/skbuff.h:997 [inline]
>  sock_wmalloc+0x16d/0x1f0 net/core/sock.c:1934
>  packet_sendmsg_spkt+0x48a/0x16f0 net/packet/af_packet.c:1922
>  sock_sendmsg_nosec net/socket.c:621 [inline]
>  sock_sendmsg+0xd5/0x120 net/socket.c:631
>  ___sys_sendmsg+0x7fd/0x930 net/socket.c:2116
>  __sys_sendmsg+0x11d/0x280 net/socket.c:2154
>  __do_sys_sendmsg net/socket.c:2163 [inline]
>  __se_sys_sendmsg net/socket.c:2161 [inline]
>  __x64_sys_sendmsg+0x78/0xb0 net/socket.c:2161
>  do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290
>  entry_SYSCALL_64_after_hwframe+0x49/0xbe
>
> Freed by task 8395:
>  save_stack+0x43/0xd0 mm/kasan/kasan.c:448
>  set_track mm/kasan/kasan.c:460 [inline]
>  __kasan_slab_free+0x102/0x150 mm/kasan/kasan.c:521
>  kasan_slab_free+0xe/0x10 mm/kasan/kasan.c:528
>  __cache_free mm/slab.c:3498 [inline]
>  kfree+0xcf/0x230 mm/slab.c:3813
>  skb_free_head+0x99/0xc0 net/core/skbuff.c:550
>  skb_release_data+0x6a4/0x880 net/core/skbuff.c:570
>  skb_release_all+0x4a/0x60 net/core/skbuff.c:627
>  __kfree_skb net/core/skbuff.c:641 [inline]
>  consume_skb+0x1ae/0x570 net/core/skbuff.c:701
>  packet_rcv+0x172/0x1820 net/packet/af_packet.c:2139
>  dev_queue_xmit_nit+0x8ae/0xb30 net/core/dev.c:2020
>  xmit_one net/core/dev.c:3215 [inline]
>  dev_hard_start_xmit+0x186/0xc90 net/core/dev.c:3235
>  __dev_queue_xmit+0x2f0d/0x3950 net/core/dev.c:3805
>  dev_queue_xmit+0x17/0x20 net/core/dev.c:3838
>  packet_sendmsg_spkt+0xf44/0x16f0 net/packet/af_packet.c:1975
>  sock_sendmsg_nosec net/socket.c:621 [inline]
>  sock_sendmsg+0xd5/0x120 net/socket.c:631
>  ___sys_sendmsg+0x7fd/0x930 net/socket.c:2116
>  __sys_sendmsg+0x11d/0x280 net/socket.c:2154
>  __do_sys_sendmsg net/socket.c:2163 [inline]
>  __se_sys_sendmsg net/socket.c:2161 [inline]
>  __x64_sys_sendmsg+0x78/0xb0 net/socket.c:2161
>  do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290
>  entry_SYSCALL_64_after_hwframe+0x49/0xbe
>
> The buggy address belongs to the object at ffff8801d8cb4040
>  which belongs to the cache kmalloc-512 of size 512
> The buggy address is located 224 bytes inside of
>  512-byte region [ffff8801d8cb4040, ffff8801d8cb4240)
> The buggy address belongs to the page:
> page:ffffea0007632d00 count:1 mapcount:0 mapping:ffff8801da800940
> index:0xffff8801d8cb42c0
> flags: 0x2fffc0000000100(slab)
> raw: 02fffc0000000100 ffffea00070baf08 ffffea000736a788 ffff8801da800940
> raw: ffff8801d8cb42c0 ffff8801d8cb4040 0000000100000005 0000000000000000
> page dumped because: kasan: bad access detected
>
> Memory state around the buggy address:
>  ffff8801d8cb4000: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb
>  ffff8801d8cb4080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>>
>> ffff8801d8cb4100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>
>                                ^
>  ffff8801d8cb4180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>  ffff8801d8cb4200: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
> ==================================================================

FWIW from the log this was triggered on this program:

05:22:33 executing program 0:
r0 = socket(0x11, 0xa, 0x0)
sendmsg(r0, &(0x7f00000003c0)={&(0x7f00000000c0)=@pptp={0x18, 0x2,
{0x0, @dev}}, 0x80, &(0x7f0000000380), 0x0, &(0x7f0000001880)}, 0x0)

Looks like a race with a very short inconsistency window since it was
triggered only once.

> ---
> 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 syzkaller@googlegroups.com.
>
> syzbot will keep track of this bug report. See:
> https://goo.gl/tpsmEJ#bug-status-tracking for how to communicate with
> syzbot.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: KASAN: use-after-free Write in skb_release_data (2)
  2018-10-15  6:30 KASAN: use-after-free Write in skb_release_data (2) syzbot
  2018-10-15  7:49 ` Dmitry Vyukov
@ 2019-03-25  3:31 ` syzbot
  2019-03-25  8:19 ` syzbot
  2 siblings, 0 replies; 6+ messages in thread
From: syzbot @ 2019-03-25  3:31 UTC (permalink / raw)
  To: alexander.h.duyck, ast, bpf, daniel, davem, dvyukov, edumazet,
	kafai, kuznet, linux-kernel, lirongqing, magnus.karlsson,
	maximmi, netdev, pabeni, songliubraving, syzkaller-bugs,
	vincent.whitchurch, willemb, yhs, yoshfuji

syzbot has found a reproducer for the following crash on:

HEAD commit:    68cc2999 Merge branch 'devlink-small-spring-cleanup'
git tree:       net-next
console output: https://syzkaller.appspot.com/x/log.txt?x=13737c07200000
kernel config:  https://syzkaller.appspot.com/x/.config?x=9ab5bbbbf283c99a
dashboard link: https://syzkaller.appspot.com/bug?extid=580be3953ed99133804f
compiler:       gcc (GCC) 9.0.0 20181231 (experimental)
syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=123a3d3b200000
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=11d34f93200000

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

==================================================================
BUG: KASAN: use-after-free in atomic_sub_return  
include/asm-generic/atomic-instrumented.h:159 [inline]
BUG: KASAN: use-after-free in skb_release_data+0x11d/0x7a0  
net/core/skbuff.c:566
Write of size 4 at addr ffff88808dee74e0 by task syz-executor887/7877

CPU: 0 PID: 7877 Comm: syz-executor887 Not tainted 5.0.0+ #108
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+0x172/0x1f0 lib/dump_stack.c:113
  print_address_description.cold+0x7c/0x20d mm/kasan/report.c:187
  kasan_report.cold+0x1b/0x40 mm/kasan/report.c:317
  check_memory_region_inline mm/kasan/generic.c:185 [inline]
  check_memory_region+0x123/0x190 mm/kasan/generic.c:191
  kasan_check_write+0x14/0x20 mm/kasan/common.c:108
  atomic_sub_return include/asm-generic/atomic-instrumented.h:159 [inline]
  skb_release_data+0x11d/0x7a0 net/core/skbuff.c:566
  skb_release_all+0x4d/0x60 net/core/skbuff.c:631
  __kfree_skb net/core/skbuff.c:645 [inline]
  kfree_skb net/core/skbuff.c:663 [inline]
  kfree_skb+0xe8/0x390 net/core/skbuff.c:657
  skb_queue_purge+0x19/0x40 net/core/skbuff.c:2906
  packet_release+0x8eb/0xbf0 net/packet/af_packet.c:3026
  __sock_release+0xd3/0x2b0 net/socket.c:599
  sock_close+0x1b/0x30 net/socket.c:1247
  __fput+0x2e5/0x8d0 fs/file_table.c:278
  ____fput+0x16/0x20 fs/file_table.c:309
  task_work_run+0x14a/0x1c0 kernel/task_work.c:113
  exit_task_work include/linux/task_work.h:22 [inline]
  do_exit+0x90a/0x2fa0 kernel/exit.c:876
  do_group_exit+0x135/0x370 kernel/exit.c:980
  get_signal+0x399/0x1d50 kernel/signal.c:2575
  do_signal+0x87/0x1940 arch/x86/kernel/signal.c:816
  exit_to_usermode_loop+0x244/0x2c0 arch/x86/entry/common.c:162
  prepare_exit_to_usermode arch/x86/entry/common.c:197 [inline]
  syscall_return_slowpath arch/x86/entry/common.c:268 [inline]
  do_syscall_64+0x52d/0x610 arch/x86/entry/common.c:293
  entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x4474d9
Code: 7a 6c 69 62 77 00 73 74 72 65 61 6d 2e 63 00 6f 70 65 6e 20 65 72 72  
6f 72 20 25 64 2c 20 66 69 6c 65 20 27 25 73 27 3a 20 25 <73> 0a 00 66 69  
6c 65 20 25 64 20 69 73 20 61 20 74 74 79 2d 74 79
RSP: 002b:00007f7ce163fdb8 EFLAGS: 00000246 ORIG_RAX: 00000000000000ca
RAX: fffffffffffffe00 RBX: 00000000006ddc38 RCX: 00000000004474d9
RDX: 0000000000000000 RSI: 0000000000000080 RDI: 00000000006ddc38
RBP: 00000000006ddc30 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00000000006ddc3c
R13: 00007ffe04f36bbf R14: 00007f7ce16409c0 R15: 000000000000002d

Allocated by task 7876:
  save_stack+0x45/0xd0 mm/kasan/common.c:75
  set_track mm/kasan/common.c:87 [inline]
  __kasan_kmalloc mm/kasan/common.c:497 [inline]
  __kasan_kmalloc.constprop.0+0xcf/0xe0 mm/kasan/common.c:470
  kasan_kmalloc+0x9/0x10 mm/kasan/common.c:511
  __do_kmalloc_node mm/slab.c:3686 [inline]
  __kmalloc_node_track_caller+0x4e/0x70 mm/slab.c:3700
  __kmalloc_reserve.isra.0+0x40/0xf0 net/core/skbuff.c:140
  __alloc_skb+0x10b/0x5e0 net/core/skbuff.c:208
  alloc_skb_fclone include/linux/skbuff.h:1107 [inline]
  sk_stream_alloc_skb+0x113/0xd10 net/ipv4/tcp.c:889
  tcp_connect+0xfd8/0x4280 net/ipv4/tcp_output.c:3521
  tcp_v4_connect+0x1514/0x1c40 net/ipv4/tcp_ipv4.c:315
  __inet_stream_connect+0x83f/0xea0 net/ipv4/af_inet.c:659
  tcp_sendmsg_fastopen net/ipv4/tcp.c:1158 [inline]
  tcp_sendmsg_locked+0x2314/0x34d0 net/ipv4/tcp.c:1200
  tcp_sendmsg+0x30/0x50 net/ipv4/tcp.c:1434
  inet_sendmsg+0x147/0x5e0 net/ipv4/af_inet.c:802
  sock_sendmsg_nosec net/socket.c:651 [inline]
  sock_sendmsg+0xdd/0x130 net/socket.c:661
  __sys_sendto+0x262/0x380 net/socket.c:1932
  __do_sys_sendto net/socket.c:1944 [inline]
  __se_sys_sendto net/socket.c:1940 [inline]
  __x64_sys_sendto+0xe1/0x1a0 net/socket.c:1940
  do_syscall_64+0x103/0x610 arch/x86/entry/common.c:290
  entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 7877:
  save_stack+0x45/0xd0 mm/kasan/common.c:75
  set_track mm/kasan/common.c:87 [inline]
  __kasan_slab_free+0x102/0x150 mm/kasan/common.c:459
  kasan_slab_free+0xe/0x10 mm/kasan/common.c:467
  __cache_free mm/slab.c:3498 [inline]
  kfree+0xcf/0x230 mm/slab.c:3821
  skb_free_head+0x93/0xb0 net/core/skbuff.c:557
  skb_release_data+0x576/0x7a0 net/core/skbuff.c:577
  skb_release_all+0x4d/0x60 net/core/skbuff.c:631
  __kfree_skb net/core/skbuff.c:645 [inline]
  kfree_skb net/core/skbuff.c:663 [inline]
  kfree_skb+0xe8/0x390 net/core/skbuff.c:657
  skb_queue_purge+0x19/0x40 net/core/skbuff.c:2906
  packet_release+0x8eb/0xbf0 net/packet/af_packet.c:3026
  __sock_release+0xd3/0x2b0 net/socket.c:599
  sock_close+0x1b/0x30 net/socket.c:1247
  __fput+0x2e5/0x8d0 fs/file_table.c:278
  ____fput+0x16/0x20 fs/file_table.c:309
  task_work_run+0x14a/0x1c0 kernel/task_work.c:113
  exit_task_work include/linux/task_work.h:22 [inline]
  do_exit+0x90a/0x2fa0 kernel/exit.c:876
  do_group_exit+0x135/0x370 kernel/exit.c:980
  get_signal+0x399/0x1d50 kernel/signal.c:2575
  do_signal+0x87/0x1940 arch/x86/kernel/signal.c:816
  exit_to_usermode_loop+0x244/0x2c0 arch/x86/entry/common.c:162
  prepare_exit_to_usermode arch/x86/entry/common.c:197 [inline]
  syscall_return_slowpath arch/x86/entry/common.c:268 [inline]
  do_syscall_64+0x52d/0x610 arch/x86/entry/common.c:293
  entry_SYSCALL_64_after_hwframe+0x49/0xbe

The buggy address belongs to the object at ffff88808dee7200
  which belongs to the cache kmalloc-1k of size 1024
The buggy address is located 736 bytes inside of
  1024-byte region [ffff88808dee7200, ffff88808dee7600)
The buggy address belongs to the page:
page:ffffea000237b980 count:1 mapcount:0 mapping:ffff88812c3f0ac0 index:0x0  
compound_mapcount: 0
flags: 0x1fffc0000010200(slab|head)
raw: 01fffc0000010200 ffffea000224ba08 ffffea0002a63288 ffff88812c3f0ac0
raw: 0000000000000000 ffff88808dee6000 0000000100000007 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
  ffff88808dee7380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
  ffff88808dee7400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
> ffff88808dee7480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                                        ^
  ffff88808dee7500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
  ffff88808dee7580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: KASAN: use-after-free Write in skb_release_data (2)
  2018-10-15  6:30 KASAN: use-after-free Write in skb_release_data (2) syzbot
  2018-10-15  7:49 ` Dmitry Vyukov
  2019-03-25  3:31 ` syzbot
@ 2019-03-25  8:19 ` syzbot
  2019-03-25  8:35   ` Eric Dumazet
  2 siblings, 1 reply; 6+ messages in thread
From: syzbot @ 2019-03-25  8:19 UTC (permalink / raw)
  To: alexander.h.duyck, ast, bpf, daniel, davem, dvyukov, edumazet,
	kafai, kuznet, linux-kernel, lirongqing, magnus.karlsson,
	maximmi, netdev, pabeni, soheil, songliubraving, syzkaller-bugs,
	vincent.whitchurch, willemb, yhs, yoshfuji

syzbot has bisected this bug to:

commit 472c2e07eef045145bc1493cc94a01c87140780a
Author: Eric Dumazet <edumazet@google.com>
Date:   Fri Mar 22 15:56:39 2019 +0000

     tcp: add one skb cache for tx

bisection log:  https://syzkaller.appspot.com/x/bisect.txt?x=17abf52b200000
start commit:   68cc2999 Merge branch 'devlink-small-spring-cleanup'
git tree:       net-next
final crash:    https://syzkaller.appspot.com/x/report.txt?x=146bf52b200000
console output: https://syzkaller.appspot.com/x/log.txt?x=106bf52b200000
kernel config:  https://syzkaller.appspot.com/x/.config?x=9ab5bbbbf283c99a
dashboard link: https://syzkaller.appspot.com/bug?extid=580be3953ed99133804f
syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=123a3d3b200000
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=11d34f93200000

Reported-by: syzbot+580be3953ed99133804f@syzkaller.appspotmail.com
Fixes: 472c2e07eef0 ("tcp: add one skb cache for tx")

For information about bisection process see: https://goo.gl/tpsmEJ#bisection

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: KASAN: use-after-free Write in skb_release_data (2)
  2019-03-25  8:19 ` syzbot
@ 2019-03-25  8:35   ` Eric Dumazet
  2019-03-26  8:35     ` Dmitry Vyukov
  0 siblings, 1 reply; 6+ messages in thread
From: Eric Dumazet @ 2019-03-25  8:35 UTC (permalink / raw)
  To: syzbot
  Cc: Alexander Duyck, Alexei Starovoitov, bpf, Daniel Borkmann,
	David Miller, Dmitry Vyukov, Martin KaFai Lau, Alexey Kuznetsov,
	LKML, Li RongQing, magnus.karlsson, maximmi, netdev, Paolo Abeni,
	Soheil Hassas Yeganeh, Song Liu, syzkaller-bugs,
	vincent.whitchurch, Willem de Bruijn, Yonghong Song,
	Hideaki YOSHIFUJI

On Mon, Mar 25, 2019 at 1:19 AM syzbot
<syzbot+580be3953ed99133804f@syzkaller.appspotmail.com> wrote:
>
> syzbot has bisected this bug to:
>
> commit 472c2e07eef045145bc1493cc94a01c87140780a
> Author: Eric Dumazet <edumazet@google.com>
> Date:   Fri Mar 22 15:56:39 2019 +0000
>
>      tcp: add one skb cache for tx
>
> bisection log:  https://syzkaller.appspot.com/x/bisect.txt?x=17abf52b200000
> start commit:   68cc2999 Merge branch 'devlink-small-spring-cleanup'
> git tree:       net-next
> final crash:    https://syzkaller.appspot.com/x/report.txt?x=146bf52b200000
> console output: https://syzkaller.appspot.com/x/log.txt?x=106bf52b200000
> kernel config:  https://syzkaller.appspot.com/x/.config?x=9ab5bbbbf283c99a
> dashboard link: https://syzkaller.appspot.com/bug?extid=580be3953ed99133804f
> syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=123a3d3b200000
> C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=11d34f93200000
>
> Reported-by: syzbot+580be3953ed99133804f@syzkaller.appspotmail.com
> Fixes: 472c2e07eef0 ("tcp: add one skb cache for tx")
>
> For information about bisection process see: https://goo.gl/tpsmEJ#bisection

This bisection makes no sense, the original bug report was in in
October last year.

This was :

Hello,

syzbot found the following crash on:

HEAD commit:    e40a826a6cbc qed: Add support for virtual link.
git tree:       net-next
console output: https://syzkaller.appspot.com/x/log.txt?x=168954a5400000
kernel config:  https://syzkaller.appspot.com/x/.config?x=7e7e2279c0020d5f
dashboard link: https://syzkaller.appspot.com/bug?extid=580be3953ed99133804f
compiler:       gcc (GCC) 8.0.1 20180413 (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+580be3953ed99133804f@syzkaller.appspotmail.com

==================================================================
BUG: KASAN: use-after-free in atomic_sub_return
include/asm-generic/atomic-instrumented.h:305 [inline]
BUG: KASAN: use-after-free in skb_release_data+0x1a3/0x880 net/core/skbuff.c:559
Write of size 4 at addr ffff8801d8cb4120 by task syz-executor0/8395

CPU: 0 PID: 8395 Comm: syz-executor0 Not tainted 4.19.0-rc6+ #254
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+0x1c4/0x2b4 lib/dump_stack.c:113
 print_address_description.cold.8+0x9/0x1ff mm/kasan/report.c:256
 kasan_report_error mm/kasan/report.c:354 [inline]
 kasan_report.cold.9+0x242/0x309 mm/kasan/report.c:412
 check_memory_region_inline mm/kasan/kasan.c:260 [inline]
 check_memory_region+0x13e/0x1b0 mm/kasan/kasan.c:267
 kasan_check_write+0x14/0x20 mm/kasan/kasan.c:278
 atomic_sub_return include/asm-generic/atomic-instrumented.h:305 [inline]
 skb_release_data+0x1a3/0x880 net/core/skbuff.c:559
 skb_release_all+0x4a/0x60 net/core/skbuff.c:627
 __kfree_skb net/core/skbuff.c:641 [inline]
 kfree_skb+0x1bb/0x580 net/core/skbuff.c:659
 sit_tunnel_xmit+0x173/0x30d0 net/ipv6/sit.c:1044
 __netdev_start_xmit include/linux/netdevice.h:4328 [inline]
 netdev_start_xmit include/linux/netdevice.h:4337 [inline]
 xmit_one net/core/dev.c:3219 [inline]
 dev_hard_start_xmit+0x295/0xc90 net/core/dev.c:3235
 __dev_queue_xmit+0x2f0d/0x3950 net/core/dev.c:3805
 dev_queue_xmit+0x17/0x20 net/core/dev.c:3838
 packet_sendmsg_spkt+0xf44/0x16f0 net/packet/af_packet.c:1975
 sock_sendmsg_nosec net/socket.c:621 [inline]
 sock_sendmsg+0xd5/0x120 net/socket.c:631
 ___sys_sendmsg+0x7fd/0x930 net/socket.c:2116
 __sys_sendmsg+0x11d/0x280 net/socket.c:2154
 __do_sys_sendmsg net/socket.c:2163 [inline]
 __se_sys_sendmsg net/socket.c:2161 [inline]
 __x64_sys_sendmsg+0x78/0xb0 net/socket.c:2161
 do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x457519
Code: 1d b4 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 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 0f 83 eb b3 fb ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007f2a52d30c78 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 0000000000457519
RDX: 0000000000000000 RSI: 00000000200003c0 RDI: 0000000000000003
RBP: 000000000072bf00 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007f2a52d316d4
R13: 00000000004c34d5 R14: 00000000004d52c8 R15: 00000000ffffffff

Allocated by task 8395:
 save_stack+0x43/0xd0 mm/kasan/kasan.c:448
 set_track mm/kasan/kasan.c:460 [inline]
 kasan_kmalloc+0xc7/0xe0 mm/kasan/kasan.c:553
 __do_kmalloc_node mm/slab.c:3682 [inline]
 __kmalloc_node_track_caller+0x47/0x70 mm/slab.c:3696
 __kmalloc_reserve.isra.39+0x41/0xe0 net/core/skbuff.c:137
 __alloc_skb+0x155/0x770 net/core/skbuff.c:205
 alloc_skb include/linux/skbuff.h:997 [inline]
 sock_wmalloc+0x16d/0x1f0 net/core/sock.c:1934
 packet_sendmsg_spkt+0x48a/0x16f0 net/packet/af_packet.c:1922
 sock_sendmsg_nosec net/socket.c:621 [inline]
 sock_sendmsg+0xd5/0x120 net/socket.c:631
 ___sys_sendmsg+0x7fd/0x930 net/socket.c:2116
 __sys_sendmsg+0x11d/0x280 net/socket.c:2154
 __do_sys_sendmsg net/socket.c:2163 [inline]
 __se_sys_sendmsg net/socket.c:2161 [inline]
 __x64_sys_sendmsg+0x78/0xb0 net/socket.c:2161
 do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 8395:
 save_stack+0x43/0xd0 mm/kasan/kasan.c:448
 set_track mm/kasan/kasan.c:460 [inline]
 __kasan_slab_free+0x102/0x150 mm/kasan/kasan.c:521
 kasan_slab_free+0xe/0x10 mm/kasan/kasan.c:528
 __cache_free mm/slab.c:3498 [inline]
 kfree+0xcf/0x230 mm/slab.c:3813
 skb_free_head+0x99/0xc0 net/core/skbuff.c:550
 skb_release_data+0x6a4/0x880 net/core/skbuff.c:570
 skb_release_all+0x4a/0x60 net/core/skbuff.c:627
 __kfree_skb net/core/skbuff.c:641 [inline]
 consume_skb+0x1ae/0x570 net/core/skbuff.c:701
 packet_rcv+0x172/0x1820 net/packet/af_packet.c:2139
 dev_queue_xmit_nit+0x8ae/0xb30 net/core/dev.c:2020
 xmit_one net/core/dev.c:3215 [inline]
 dev_hard_start_xmit+0x186/0xc90 net/core/dev.c:3235
 __dev_queue_xmit+0x2f0d/0x3950 net/core/dev.c:3805
 dev_queue_xmit+0x17/0x20 net/core/dev.c:3838
 packet_sendmsg_spkt+0xf44/0x16f0 net/packet/af_packet.c:1975
 sock_sendmsg_nosec net/socket.c:621 [inline]
 sock_sendmsg+0xd5/0x120 net/socket.c:631
 ___sys_sendmsg+0x7fd/0x930 net/socket.c:2116
 __sys_sendmsg+0x11d/0x280 net/socket.c:2154
 __do_sys_sendmsg net/socket.c:2163 [inline]
 __se_sys_sendmsg net/socket.c:2161 [inline]
 __x64_sys_sendmsg+0x78/0xb0 net/socket.c:2161
 do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

The buggy address belongs to the object at ffff8801d8cb4040
 which belongs to the cache kmalloc-512 of size 512
The buggy address is located 224 bytes inside of
 512-byte region [ffff8801d8cb4040, ffff8801d8cb4240)
The buggy address belongs to the page:
page:ffffea0007632d00 count:1 mapcount:0 mapping:ffff8801da800940
index:0xffff8801d8cb42c0
flags: 0x2fffc0000000100(slab)
raw: 02fffc0000000100 ffffea00070baf08 ffffea000736a788 ffff8801da800940
raw: ffff8801d8cb42c0 ffff8801d8cb4040 0000000100000005 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8801d8cb4000: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb
 ffff8801d8cb4080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb

ffff8801d8cb4100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb

                               ^
 ffff8801d8cb4180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8801d8cb4200: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
==================================================================


---
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 syzkaller@googlegroups.com.

syzbot will keep track of this bug report. See:
https://goo.gl/tpsmEJ#bug-status-tracking for how to communicate with syzbot.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: KASAN: use-after-free Write in skb_release_data (2)
  2019-03-25  8:35   ` Eric Dumazet
@ 2019-03-26  8:35     ` Dmitry Vyukov
  0 siblings, 0 replies; 6+ messages in thread
From: Dmitry Vyukov @ 2019-03-26  8:35 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: syzbot, Alexander Duyck, Alexei Starovoitov, bpf,
	Daniel Borkmann, David Miller, Martin KaFai Lau,
	Alexey Kuznetsov, LKML, Li RongQing, Karlsson, Magnus, maximmi,
	netdev, Paolo Abeni, Soheil Hassas Yeganeh, Song Liu,
	syzkaller-bugs, vincent.whitchurch, Willem de Bruijn,
	Yonghong Song, Hideaki YOSHIFUJI

On Mon, Mar 25, 2019 at 9:36 AM Eric Dumazet <edumazet@google.com> wrote:
>
> On Mon, Mar 25, 2019 at 1:19 AM syzbot
> <syzbot+580be3953ed99133804f@syzkaller.appspotmail.com> wrote:
> >
> > syzbot has bisected this bug to:
> >
> > commit 472c2e07eef045145bc1493cc94a01c87140780a
> > Author: Eric Dumazet <edumazet@google.com>
> > Date:   Fri Mar 22 15:56:39 2019 +0000
> >
> >      tcp: add one skb cache for tx
> >
> > bisection log:  https://syzkaller.appspot.com/x/bisect.txt?x=17abf52b200000
> > start commit:   68cc2999 Merge branch 'devlink-small-spring-cleanup'
> > git tree:       net-next
> > final crash:    https://syzkaller.appspot.com/x/report.txt?x=146bf52b200000
> > console output: https://syzkaller.appspot.com/x/log.txt?x=106bf52b200000
> > kernel config:  https://syzkaller.appspot.com/x/.config?x=9ab5bbbbf283c99a
> > dashboard link: https://syzkaller.appspot.com/bug?extid=580be3953ed99133804f
> > syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=123a3d3b200000
> > C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=11d34f93200000
> >
> > Reported-by: syzbot+580be3953ed99133804f@syzkaller.appspotmail.com
> > Fixes: 472c2e07eef0 ("tcp: add one skb cache for tx")
> >
> > For information about bisection process see: https://goo.gl/tpsmEJ#bisection
>
> This bisection makes no sense, the original bug report was in in
> October last year.


But the bisection log itself looks legit and seem to point to a legit
bug, right?. If so, let's fix the new bug in the context of this
report. Or the old one. Both. Any.
The more we let hundreds of kernel bugs pile up without attention,
then more of such glued bugs we will unavoidably have...



> This was :
>
> Hello,
>
> syzbot found the following crash on:
>
> HEAD commit:    e40a826a6cbc qed: Add support for virtual link.
> git tree:       net-next
> console output: https://syzkaller.appspot.com/x/log.txt?x=168954a5400000
> kernel config:  https://syzkaller.appspot.com/x/.config?x=7e7e2279c0020d5f
> dashboard link: https://syzkaller.appspot.com/bug?extid=580be3953ed99133804f
> compiler:       gcc (GCC) 8.0.1 20180413 (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+580be3953ed99133804f@syzkaller.appspotmail.com
>
> ==================================================================
> BUG: KASAN: use-after-free in atomic_sub_return
> include/asm-generic/atomic-instrumented.h:305 [inline]
> BUG: KASAN: use-after-free in skb_release_data+0x1a3/0x880 net/core/skbuff.c:559
> Write of size 4 at addr ffff8801d8cb4120 by task syz-executor0/8395
>
> CPU: 0 PID: 8395 Comm: syz-executor0 Not tainted 4.19.0-rc6+ #254
> 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+0x1c4/0x2b4 lib/dump_stack.c:113
>  print_address_description.cold.8+0x9/0x1ff mm/kasan/report.c:256
>  kasan_report_error mm/kasan/report.c:354 [inline]
>  kasan_report.cold.9+0x242/0x309 mm/kasan/report.c:412
>  check_memory_region_inline mm/kasan/kasan.c:260 [inline]
>  check_memory_region+0x13e/0x1b0 mm/kasan/kasan.c:267
>  kasan_check_write+0x14/0x20 mm/kasan/kasan.c:278
>  atomic_sub_return include/asm-generic/atomic-instrumented.h:305 [inline]
>  skb_release_data+0x1a3/0x880 net/core/skbuff.c:559
>  skb_release_all+0x4a/0x60 net/core/skbuff.c:627
>  __kfree_skb net/core/skbuff.c:641 [inline]
>  kfree_skb+0x1bb/0x580 net/core/skbuff.c:659
>  sit_tunnel_xmit+0x173/0x30d0 net/ipv6/sit.c:1044
>  __netdev_start_xmit include/linux/netdevice.h:4328 [inline]
>  netdev_start_xmit include/linux/netdevice.h:4337 [inline]
>  xmit_one net/core/dev.c:3219 [inline]
>  dev_hard_start_xmit+0x295/0xc90 net/core/dev.c:3235
>  __dev_queue_xmit+0x2f0d/0x3950 net/core/dev.c:3805
>  dev_queue_xmit+0x17/0x20 net/core/dev.c:3838
>  packet_sendmsg_spkt+0xf44/0x16f0 net/packet/af_packet.c:1975
>  sock_sendmsg_nosec net/socket.c:621 [inline]
>  sock_sendmsg+0xd5/0x120 net/socket.c:631
>  ___sys_sendmsg+0x7fd/0x930 net/socket.c:2116
>  __sys_sendmsg+0x11d/0x280 net/socket.c:2154
>  __do_sys_sendmsg net/socket.c:2163 [inline]
>  __se_sys_sendmsg net/socket.c:2161 [inline]
>  __x64_sys_sendmsg+0x78/0xb0 net/socket.c:2161
>  do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290
>  entry_SYSCALL_64_after_hwframe+0x49/0xbe
> RIP: 0033:0x457519
> Code: 1d b4 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 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 0f 83 eb b3 fb ff c3 66 2e 0f 1f 84 00 00 00 00
> RSP: 002b:00007f2a52d30c78 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
> RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 0000000000457519
> RDX: 0000000000000000 RSI: 00000000200003c0 RDI: 0000000000000003
> RBP: 000000000072bf00 R08: 0000000000000000 R09: 0000000000000000
> R10: 0000000000000000 R11: 0000000000000246 R12: 00007f2a52d316d4
> R13: 00000000004c34d5 R14: 00000000004d52c8 R15: 00000000ffffffff
>
> Allocated by task 8395:
>  save_stack+0x43/0xd0 mm/kasan/kasan.c:448
>  set_track mm/kasan/kasan.c:460 [inline]
>  kasan_kmalloc+0xc7/0xe0 mm/kasan/kasan.c:553
>  __do_kmalloc_node mm/slab.c:3682 [inline]
>  __kmalloc_node_track_caller+0x47/0x70 mm/slab.c:3696
>  __kmalloc_reserve.isra.39+0x41/0xe0 net/core/skbuff.c:137
>  __alloc_skb+0x155/0x770 net/core/skbuff.c:205
>  alloc_skb include/linux/skbuff.h:997 [inline]
>  sock_wmalloc+0x16d/0x1f0 net/core/sock.c:1934
>  packet_sendmsg_spkt+0x48a/0x16f0 net/packet/af_packet.c:1922
>  sock_sendmsg_nosec net/socket.c:621 [inline]
>  sock_sendmsg+0xd5/0x120 net/socket.c:631
>  ___sys_sendmsg+0x7fd/0x930 net/socket.c:2116
>  __sys_sendmsg+0x11d/0x280 net/socket.c:2154
>  __do_sys_sendmsg net/socket.c:2163 [inline]
>  __se_sys_sendmsg net/socket.c:2161 [inline]
>  __x64_sys_sendmsg+0x78/0xb0 net/socket.c:2161
>  do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290
>  entry_SYSCALL_64_after_hwframe+0x49/0xbe
>
> Freed by task 8395:
>  save_stack+0x43/0xd0 mm/kasan/kasan.c:448
>  set_track mm/kasan/kasan.c:460 [inline]
>  __kasan_slab_free+0x102/0x150 mm/kasan/kasan.c:521
>  kasan_slab_free+0xe/0x10 mm/kasan/kasan.c:528
>  __cache_free mm/slab.c:3498 [inline]
>  kfree+0xcf/0x230 mm/slab.c:3813
>  skb_free_head+0x99/0xc0 net/core/skbuff.c:550
>  skb_release_data+0x6a4/0x880 net/core/skbuff.c:570
>  skb_release_all+0x4a/0x60 net/core/skbuff.c:627
>  __kfree_skb net/core/skbuff.c:641 [inline]
>  consume_skb+0x1ae/0x570 net/core/skbuff.c:701
>  packet_rcv+0x172/0x1820 net/packet/af_packet.c:2139
>  dev_queue_xmit_nit+0x8ae/0xb30 net/core/dev.c:2020
>  xmit_one net/core/dev.c:3215 [inline]
>  dev_hard_start_xmit+0x186/0xc90 net/core/dev.c:3235
>  __dev_queue_xmit+0x2f0d/0x3950 net/core/dev.c:3805
>  dev_queue_xmit+0x17/0x20 net/core/dev.c:3838
>  packet_sendmsg_spkt+0xf44/0x16f0 net/packet/af_packet.c:1975
>  sock_sendmsg_nosec net/socket.c:621 [inline]
>  sock_sendmsg+0xd5/0x120 net/socket.c:631
>  ___sys_sendmsg+0x7fd/0x930 net/socket.c:2116
>  __sys_sendmsg+0x11d/0x280 net/socket.c:2154
>  __do_sys_sendmsg net/socket.c:2163 [inline]
>  __se_sys_sendmsg net/socket.c:2161 [inline]
>  __x64_sys_sendmsg+0x78/0xb0 net/socket.c:2161
>  do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290
>  entry_SYSCALL_64_after_hwframe+0x49/0xbe
>
> The buggy address belongs to the object at ffff8801d8cb4040
>  which belongs to the cache kmalloc-512 of size 512
> The buggy address is located 224 bytes inside of
>  512-byte region [ffff8801d8cb4040, ffff8801d8cb4240)
> The buggy address belongs to the page:
> page:ffffea0007632d00 count:1 mapcount:0 mapping:ffff8801da800940
> index:0xffff8801d8cb42c0
> flags: 0x2fffc0000000100(slab)
> raw: 02fffc0000000100 ffffea00070baf08 ffffea000736a788 ffff8801da800940
> raw: ffff8801d8cb42c0 ffff8801d8cb4040 0000000100000005 0000000000000000
> page dumped because: kasan: bad access detected
>
> Memory state around the buggy address:
>  ffff8801d8cb4000: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb
>  ffff8801d8cb4080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>
> ffff8801d8cb4100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>
>                                ^
>  ffff8801d8cb4180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>  ffff8801d8cb4200: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
> ==================================================================
>
>
> ---
> 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 syzkaller@googlegroups.com.
>
> syzbot will keep track of this bug report. See:
> https://goo.gl/tpsmEJ#bug-status-tracking for how to communicate with syzbot.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-03-26  8:35 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-15  6:30 KASAN: use-after-free Write in skb_release_data (2) syzbot
2018-10-15  7:49 ` Dmitry Vyukov
2019-03-25  3:31 ` syzbot
2019-03-25  8:19 ` syzbot
2019-03-25  8:35   ` Eric Dumazet
2019-03-26  8:35     ` Dmitry Vyukov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).