netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* KASAN: use-after-free Read in refcount_sub_and_test_checked (2)
@ 2019-01-02 11:26 syzbot
  2019-04-19  3:45 ` syzbot
  2019-04-19  8:21 ` syzbot
  0 siblings, 2 replies; 3+ messages in thread
From: syzbot @ 2019-01-02 11:26 UTC (permalink / raw)
  To: andrew.hendry, davem, dvlasenk, gregkh, linux-kernel, linux-x25,
	ms, netdev, syzkaller-bugs

Hello,

syzbot found the following crash on:

HEAD commit:    b71acb0e3721 Merge branch 'linus' of git://git.kernel.org/..
git tree:       net-next
console output: https://syzkaller.appspot.com/x/log.txt?x=12227977400000
kernel config:  https://syzkaller.appspot.com/x/.config?x=4b137b8ba637eb77
dashboard link: https://syzkaller.appspot.com/bug?extid=b0775615fa4c4479b691
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+b0775615fa4c4479b691@syzkaller.appspotmail.com

==================================================================
BUG: KASAN: use-after-free in atomic_read  
include/asm-generic/atomic-instrumented.h:21 [inline]
BUG: KASAN: use-after-free in refcount_sub_and_test_checked+0x9d/0x310  
lib/refcount.c:179
Read of size 4 at addr ffff88808c97fec8 by task syz-executor4/9549

CPU: 1 PID: 9549 Comm: syz-executor4 Not tainted 4.20.0+ #363
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+0x1d3/0x2c6 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_read+0x11/0x20 mm/kasan/kasan.c:272
  atomic_read include/asm-generic/atomic-instrumented.h:21 [inline]
  refcount_sub_and_test_checked+0x9d/0x310 lib/refcount.c:179
  refcount_dec_and_test_checked+0x1a/0x20 lib/refcount.c:212
  x25_neigh_put include/net/x25.h:252 [inline]
  x25_connect+0xc45/0x1050 net/x25/af_x25.c:823
  __sys_connect+0x37d/0x4c0 net/socket.c:1664
  __do_sys_connect net/socket.c:1675 [inline]
  __se_sys_connect net/socket.c:1672 [inline]
  __x64_sys_connect+0x73/0xb0 net/socket.c:1672
  do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290
  entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x457ec9
Code: 6d b7 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 3b b7 fb ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007f61b98b5c78 EFLAGS: 00000246 ORIG_RAX: 000000000000002a
RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 0000000000457ec9
RDX: 0000000000000012 RSI: 0000000020000080 RDI: 0000000000000005
RBP: 000000000073c0e0 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007f61b98b66d4
R13: 00000000004be405 R14: 00000000004ce5f0 R15: 00000000ffffffff

Allocated by task 5951:
  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
  kmem_cache_alloc_trace+0x152/0x750 mm/slab.c:3620
  kmalloc include/linux/slab.h:546 [inline]
  x25_link_device_up+0xb2/0x500 net/x25/x25_link.c:249
  x25_device_event+0x116/0x2b0 net/x25/af_x25.c:242
  notifier_call_chain+0x17e/0x380 kernel/notifier.c:93
  __raw_notifier_call_chain kernel/notifier.c:394 [inline]
  raw_notifier_call_chain+0x2d/0x40 kernel/notifier.c:401
  call_netdevice_notifiers_info+0x3f/0x90 net/core/dev.c:1739
  call_netdevice_notifiers_extack net/core/dev.c:1751 [inline]
  call_netdevice_notifiers net/core/dev.c:1765 [inline]
  __dev_notify_flags+0x17a/0x480 net/core/dev.c:7605
  dev_change_flags+0x109/0x160 net/core/dev.c:7643
  dev_ifsioc+0x7da/0xa80 net/core/dev_ioctl.c:237
  dev_ioctl+0x1b5/0xcc0 net/core/dev_ioctl.c:488
  sock_do_ioctl+0x1f6/0x420 net/socket.c:973
  sock_ioctl+0x313/0x690 net/socket.c:1074
  vfs_ioctl fs/ioctl.c:46 [inline]
  file_ioctl fs/ioctl.c:509 [inline]
  do_vfs_ioctl+0x1de/0x1790 fs/ioctl.c:696
  ksys_ioctl+0xa9/0xd0 fs/ioctl.c:713
  __do_sys_ioctl fs/ioctl.c:720 [inline]
  __se_sys_ioctl fs/ioctl.c:718 [inline]
  __x64_sys_ioctl+0x73/0xb0 fs/ioctl.c:718
  do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290
  entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 9519:
  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:3817
  x25_neigh_put include/net/x25.h:253 [inline]
  x25_connect+0xc67/0x1050 net/x25/af_x25.c:823
  __sys_connect+0x37d/0x4c0 net/socket.c:1664
  __do_sys_connect net/socket.c:1675 [inline]
  __se_sys_connect net/socket.c:1672 [inline]
  __x64_sys_connect+0x73/0xb0 net/socket.c:1672
  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 ffff88808c97fe00
  which belongs to the cache kmalloc-256 of size 256
The buggy address is located 200 bytes inside of
  256-byte region [ffff88808c97fe00, ffff88808c97ff00)
The buggy address belongs to the page:
page:ffffea0002325fc0 count:1 mapcount:0 mapping:ffff88812c3f07c0  
index:0xffff88808c97f2c0
flags: 0x1fffc0000000200(slab)
raw: 01fffc0000000200 ffffea00021df608 ffffea00017f8748 ffff88812c3f07c0
raw: ffff88808c97f2c0 ffff88808c97f040 0000000100000007 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
  ffff88808c97fd80: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
  ffff88808c97fe00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
> ffff88808c97fe80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                               ^
  ffff88808c97ff00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
  ffff88808c97ff80: fc fc fc fc fc fc fc fc 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] 3+ messages in thread

* Re: KASAN: use-after-free Read in refcount_sub_and_test_checked (2)
  2019-01-02 11:26 KASAN: use-after-free Read in refcount_sub_and_test_checked (2) syzbot
@ 2019-04-19  3:45 ` syzbot
  2019-04-19  8:21 ` syzbot
  1 sibling, 0 replies; 3+ messages in thread
From: syzbot @ 2019-04-19  3:45 UTC (permalink / raw)
  To: -O-request, acme, alexander.shishkin, andrew.hendry, ast, bpf,
	daniel, davem, dvlasenk, gregkh, jolsa, kafai, linux-kernel,
	linux-x25, mingo, ms, namhyung, netdev, peterz, songliubraving,
	syzkaller-bugs, yhs

syzbot has found a reproducer for the following crash on:

HEAD commit:    6d906f99 Merge tag 'arm64-fixes' of git://git.kernel.org/p..
git tree:       upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=129b4003200000
kernel config:  https://syzkaller.appspot.com/x/.config?x=856fc6d0fbbeede9
dashboard link: https://syzkaller.appspot.com/bug?extid=b0775615fa4c4479b691
compiler:       gcc (GCC) 9.0.0 20181231 (experimental)
syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=15df396b200000

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

==================================================================
BUG: KASAN: use-after-free in atomic_read  
include/asm-generic/atomic-instrumented.h:26 [inline]
BUG: KASAN: use-after-free in refcount_sub_and_test_checked+0x87/0x200  
lib/refcount.c:182
Read of size 4 at addr ffff8880a8d5e060 by task syz-executor.0/31157

CPU: 0 PID: 31157 Comm: syz-executor.0 Not tainted 5.1.0-rc5+ #74
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_read+0x11/0x20 mm/kasan/common.c:102
  atomic_read include/asm-generic/atomic-instrumented.h:26 [inline]
  refcount_sub_and_test_checked+0x87/0x200 lib/refcount.c:182
  refcount_dec_and_test_checked+0x1b/0x20 lib/refcount.c:220
  put_task_struct include/linux/sched/task.h:97 [inline]
  _free_event+0x3d7/0x13b0 kernel/events/core.c:4460
  free_event+0x5f/0xd0 kernel/events/core.c:4481
  perf_event_release_kernel+0x5b2/0xbe0 kernel/events/core.c:4642
  perf_release+0x37/0x50 kernel/events/core.c:4656
  __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
  tracehook_notify_resume include/linux/tracehook.h:188 [inline]
  exit_to_usermode_loop+0x273/0x2c0 arch/x86/entry/common.c:166
  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:0x4129e1
Code: 75 14 b8 03 00 00 00 0f 05 48 3d 01 f0 ff ff 0f 83 e4 1a 00 00 c3 48  
83 ec 08 e8 0a fc ff ff 48 89 04 24 b8 03 00 00 00 0f 05 <48> 8b 3c 24 48  
89 c2 e8 53 fc ff ff 48 89 d0 48 83 c4 08 48 3d 01
RSP: 002b:00007ffc793703e0 EFLAGS: 00000293 ORIG_RAX: 0000000000000003
RAX: 0000000000000000 RBX: 0000000000000004 RCX: 00000000004129e1
RDX: 0000000000000000 RSI: 0000000000000081 RDI: 0000000000000003
RBP: 0000000000741220 R08: 0000000000741218 R09: 000000000002c9b0
R10: 00007ffc793704a0 R11: 0000000000000293 R12: 0000000000000000
R13: 0000000000000001 R14: 0000000000000003 R15: 000000000073bfac

Allocated by task 31160:
  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_slab_alloc+0xf/0x20 mm/kasan/common.c:505
  slab_post_alloc_hook mm/slab.h:437 [inline]
  slab_alloc_node mm/slab.c:3337 [inline]
  kmem_cache_alloc_node+0x131/0x710 mm/slab.c:3647
  alloc_task_struct_node kernel/fork.c:157 [inline]
  dup_task_struct kernel/fork.c:844 [inline]
  copy_process.part.0+0x1d08/0x7980 kernel/fork.c:1752
  copy_process kernel/fork.c:1709 [inline]
  _do_fork+0x257/0xfd0 kernel/fork.c:2226
  __do_sys_clone kernel/fork.c:2333 [inline]
  __se_sys_clone kernel/fork.c:2327 [inline]
  __x64_sys_clone+0xbf/0x150 kernel/fork.c:2327
  do_syscall_64+0x103/0x610 arch/x86/entry/common.c:290
  entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 31160:
  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:3500 [inline]
  kmem_cache_free+0x86/0x260 mm/slab.c:3766
  free_task_struct kernel/fork.c:162 [inline]
  free_task+0xdd/0x120 kernel/fork.c:457
  copy_process.part.0+0x1a3a/0x7980 kernel/fork.c:2158
  copy_process kernel/fork.c:1709 [inline]
  _do_fork+0x257/0xfd0 kernel/fork.c:2226
  __do_sys_clone kernel/fork.c:2333 [inline]
  __se_sys_clone kernel/fork.c:2327 [inline]
  __x64_sys_clone+0xbf/0x150 kernel/fork.c:2327
  do_syscall_64+0x103/0x610 arch/x86/entry/common.c:290
  entry_SYSCALL_64_after_hwframe+0x49/0xbe

The buggy address belongs to the object at ffff8880a8d5e040
  which belongs to the cache task_struct(44:syz0) of size 6080
The buggy address is located 32 bytes inside of
  6080-byte region [ffff8880a8d5e040, ffff8880a8d5f800)
The buggy address belongs to the page:
page:ffffea0002a35780 count:1 mapcount:0 mapping:ffff88808b2adcc0 index:0x0  
compound_mapcount: 0
flags: 0x1fffc0000010200(slab|head)
raw: 01fffc0000010200 ffffea0002301808 ffffea0002171f08 ffff88808b2adcc0
raw: 0000000000000000 ffff8880a8d5e040 0000000100000001 ffff888085710580
page dumped because: kasan: bad access detected
page->mem_cgroup:ffff888085710580

Memory state around the buggy address:
  ffff8880a8d5df00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
  ffff8880a8d5df80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
> ffff8880a8d5e000: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb
                                                        ^
  ffff8880a8d5e080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
  ffff8880a8d5e100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================


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

* Re: KASAN: use-after-free Read in refcount_sub_and_test_checked (2)
  2019-01-02 11:26 KASAN: use-after-free Read in refcount_sub_and_test_checked (2) syzbot
  2019-04-19  3:45 ` syzbot
@ 2019-04-19  8:21 ` syzbot
  1 sibling, 0 replies; 3+ messages in thread
From: syzbot @ 2019-04-19  8:21 UTC (permalink / raw)
  To: -O-request, acme, aisheng.dong, alexander.shishkin,
	andrew.hendry, ast, bpf, daniel, davem, dvlasenk, fabio.estevam,
	gregkh, jolsa, kafai, kernel, linux-kernel, linux-x25, mingo, ms,
	mturquette, namhyung, netdev, peterz, sboyd, shawnguo,
	songliubraving, syzkaller-bugs, yhs

syzbot has bisected this bug to:

commit cd67d3272768aa3f44c0f7cc71b82a112dce01fa
Author: Aisheng Dong <aisheng.dong@nxp.com>
Date:   Thu Jan 24 13:22:49 2019 +0000

     clk: imx: scu: add fallback compatible string support

bisection log:  https://syzkaller.appspot.com/x/bisect.txt?x=11f0432d200000
start commit:   6d906f99 Merge tag 'arm64-fixes' of git://git.kernel.org/p..
git tree:       upstream
final crash:    https://syzkaller.appspot.com/x/report.txt?x=13f0432d200000
console output: https://syzkaller.appspot.com/x/log.txt?x=15f0432d200000
kernel config:  https://syzkaller.appspot.com/x/.config?x=856fc6d0fbbeede9
dashboard link: https://syzkaller.appspot.com/bug?extid=b0775615fa4c4479b691
syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=15df396b200000

Reported-by: syzbot+b0775615fa4c4479b691@syzkaller.appspotmail.com
Fixes: cd67d3272768 ("clk: imx: scu: add fallback compatible string  
support")

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

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

end of thread, other threads:[~2019-04-19 19:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-02 11:26 KASAN: use-after-free Read in refcount_sub_and_test_checked (2) syzbot
2019-04-19  3:45 ` syzbot
2019-04-19  8:21 ` syzbot

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).