Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp5391281ybl; Tue, 4 Feb 2020 13:07:55 -0800 (PST) X-Google-Smtp-Source: APXvYqwagjLt43HdGBOFrHKhXFxeLRS+oQ9pyd7e5/5SSa8iRLL6HHi13Ua8F0Ci76MF2cSadvLn X-Received: by 2002:a05:6808:aac:: with SMTP id r12mr642797oij.59.1580850475412; Tue, 04 Feb 2020 13:07:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580850475; cv=none; d=google.com; s=arc-20160816; b=dLpGzLXpz63f2V41p1PAYodT+GqftVjC3oZVDhNYjHZHQsWKMAcgbTv25B/NOueT7f DZ1WdJ1eGVHZnbklE/3BPCct+Fs/n1duTgQf+XLAqZJYmgybwPZQfEqFG0VbMu0SqGYc QaJHBYqqVbI+tNQGZ2dJBRPdieC2mNO4bEcUUFdEAGbms1j+ue18BNgyE+2SzCJ4o2Yv 7niI6Jl+boZM8Iz/k2BTlw8vEn9aWSWNy8JjhyJcGaOIOs29TStphq2d8YdpN4jARiww P34Zf7zXRBckZi44xuDlFfBeJjHuKAPQzBIiFd6uqr0WOzKu5e6wuHkD8i0xegStUYJF h+zg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:from:subject:message-id:date :mime-version; bh=Ec6H7uOKuEKDUgpYQ9tAdF70iyOvPezHib3X4v8QxEU=; b=O43LIRPc9OokUnstKIFhIPu+9g6kLjIvCx4qSP1dgiPOfnMqDkN309KxTcLFTzejxH TpZobgclNeIL01e9+PhDX8SOgaDaEPDvYBzXCxHL68jEkEvKVogublAbos7OdAHea2XE FV+D4Wz3tYBE+oXQ8fZPrYOpFQUm7wmsUnH3CeuoKzpE7J/c+rCXtOQMzCc89edmmgP3 d2T0qrZv61o8vOTTZJOOm27hrWozXE2CAhX/sarWI5Wbfi8slf2ZqceGnzgJbWaCAYuI zjRrFXnvDK2uzMOdY9e9O1MxEZNwClVpj74Woon9ZuQhTkAh8T2tEwIA8balcVvmgcb/ Vy6w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=appspotmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t12si12642361otm.224.2020.02.04.13.07.42; Tue, 04 Feb 2020 13:07:55 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=appspotmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727519AbgBDVGP (ORCPT + 99 others); Tue, 4 Feb 2020 16:06:15 -0500 Received: from mail-io1-f71.google.com ([209.85.166.71]:37982 "EHLO mail-io1-f71.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727483AbgBDVGO (ORCPT ); Tue, 4 Feb 2020 16:06:14 -0500 Received: by mail-io1-f71.google.com with SMTP id x2so12659869iog.5 for ; Tue, 04 Feb 2020 13:06:12 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:date:message-id:subject:from:to; bh=Ec6H7uOKuEKDUgpYQ9tAdF70iyOvPezHib3X4v8QxEU=; b=MKLBAjlolxcOrf0cmKpskCOE0sHxBvE44MooT5z2jRwi8WWQHMX9PMT0RD/Arlen+S hQeYay2eDXTU6lOkPNKfJixmDhiYestiYt3e5JnoFC5dGwKkbBsh+zfCr8Q1RBf1GziH 7BxfGgIqLC3g3Z5iYQ/VpGWE5VJd3urXAD82f7Lf5URFOt4XKHoh5b0IFFw/wM3L+K4O FN4evo4lx++Xm5XAwbc5S9s4FL8HfBJom2PE56pG9GHX6jqAPQEEhiekdIuxWfLVONJu ovftapzzK4Z9IAPTH8qkiNADQfMsfPMU+6NPifb4ifFrR8FFHCVnRxAc30K2JpLsT1Rf C4tg== X-Gm-Message-State: APjAAAUFh5/qFsTaeICXw1KthAADVpVdp5H17KEVI7ubPQ3KmpcD8/CB TFTKQH4SFa0c//gVW4gNfE15l/CaG5ULkH5+fj7lmgQrfxm1 MIME-Version: 1.0 X-Received: by 2002:a5d:8cce:: with SMTP id k14mr26510068iot.294.1580850372422; Tue, 04 Feb 2020 13:06:12 -0800 (PST) Date: Tue, 04 Feb 2020 13:06:12 -0800 X-Google-Appengine-App-Id: s~syzkaller X-Google-Appengine-App-Id-Alias: syzkaller Message-ID: <000000000000e43122059dc66882@google.com> Subject: KASAN: use-after-free Write in percpu_ref_switch_to_percpu From: syzbot To: axboe@kernel.dk, io-uring@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com, viro@zeniv.linux.org.uk Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello, syzbot found the following crash on: HEAD commit: 754beeec Merge tag 'char-misc-5.6-rc1-2' of git://git.kern.. git tree: upstream console output: https://syzkaller.appspot.com/x/log.txt?x=15fe4511e00000 kernel config: https://syzkaller.appspot.com/x/.config?x=99db4e42d047be3 dashboard link: https://syzkaller.appspot.com/bug?extid=7caeaea49c2c8a591e3d 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+7caeaea49c2c8a591e3d@syzkaller.appspotmail.com ================================================================== BUG: KASAN: use-after-free in percpu_ref_switch_to_percpu+0x69/0x70 lib/percpu-refcount.c:314 Write of size 1 at addr ffff888095e3b430 by task kworker/1:31/2772 CPU: 1 PID: 2772 Comm: kworker/1:31 Not tainted 5.5.0-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Workqueue: events io_ring_file_ref_switch Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0x197/0x210 lib/dump_stack.c:118 print_address_description.constprop.0.cold+0xd4/0x30b mm/kasan/report.c:374 __kasan_report.cold+0x1b/0x32 mm/kasan/report.c:506 kasan_report+0x12/0x20 mm/kasan/common.c:641 __asan_report_store1_noabort+0x17/0x20 mm/kasan/generic_report.c:137 percpu_ref_switch_to_percpu+0x69/0x70 lib/percpu-refcount.c:314 io_ring_file_ref_switch+0x791/0xac0 fs/io_uring.c:5499 process_one_work+0xa05/0x17a0 kernel/workqueue.c:2264 worker_thread+0x98/0xe40 kernel/workqueue.c:2410 kthread+0x361/0x430 kernel/kthread.c:255 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:352 Allocated by task 26829: save_stack+0x23/0x90 mm/kasan/common.c:72 set_track mm/kasan/common.c:80 [inline] __kasan_kmalloc mm/kasan/common.c:515 [inline] __kasan_kmalloc.constprop.0+0xcf/0xe0 mm/kasan/common.c:488 kasan_kmalloc+0x9/0x10 mm/kasan/common.c:529 __do_kmalloc mm/slab.c:3656 [inline] __kmalloc+0x163/0x770 mm/slab.c:3665 kmalloc include/linux/slab.h:561 [inline] kzalloc.constprop.0+0x1b/0x20 include/linux/slab.h:670 io_sqe_files_register fs/io_uring.c:5528 [inline] __io_uring_register+0xad7/0x2f40 fs/io_uring.c:6875 __do_sys_io_uring_register fs/io_uring.c:6955 [inline] __se_sys_io_uring_register fs/io_uring.c:6937 [inline] __x64_sys_io_uring_register+0x1a1/0x560 fs/io_uring.c:6937 do_syscall_64+0xfa/0x790 arch/x86/entry/common.c:294 entry_SYSCALL_64_after_hwframe+0x49/0xbe Freed by task 26826: save_stack+0x23/0x90 mm/kasan/common.c:72 set_track mm/kasan/common.c:80 [inline] kasan_set_free_info mm/kasan/common.c:337 [inline] __kasan_slab_free+0x102/0x150 mm/kasan/common.c:476 kasan_slab_free+0xe/0x10 mm/kasan/common.c:485 __cache_free mm/slab.c:3426 [inline] kfree+0x10a/0x2c0 mm/slab.c:3757 io_sqe_files_unregister+0x2e2/0x4d0 fs/io_uring.c:5250 io_ring_ctx_free fs/io_uring.c:6229 [inline] io_ring_ctx_wait_and_kill+0x447/0x9b0 fs/io_uring.c:6310 io_uring_release+0x42/0x50 fs/io_uring.c:6318 __fput+0x2ff/0x890 fs/file_table.c:280 ____fput+0x16/0x20 fs/file_table.c:313 task_work_run+0x145/0x1c0 kernel/task_work.c:113 tracehook_notify_resume include/linux/tracehook.h:188 [inline] exit_to_usermode_loop+0x316/0x380 arch/x86/entry/common.c:164 prepare_exit_to_usermode arch/x86/entry/common.c:195 [inline] syscall_return_slowpath arch/x86/entry/common.c:278 [inline] do_syscall_64+0x676/0x790 arch/x86/entry/common.c:304 entry_SYSCALL_64_after_hwframe+0x49/0xbe The buggy address belongs to the object at ffff888095e3b400 which belongs to the cache kmalloc-256 of size 256 The buggy address is located 48 bytes inside of 256-byte region [ffff888095e3b400, ffff888095e3b500) The buggy address belongs to the page: page:ffffea0002578ec0 refcount:1 mapcount:0 mapping:ffff8880aa4008c0 index:0x0 flags: 0xfffe0000000200(slab) raw: 00fffe0000000200 ffffea00025c09c8 ffffea00027f8308 ffff8880aa4008c0 raw: 0000000000000000 ffff888095e3b000 0000000100000008 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff888095e3b300: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff888095e3b380: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff888095e3b400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888095e3b480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888095e3b500: 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#status for how to communicate with syzbot.