From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.1 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1,USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 89284C433EB for ; Wed, 15 Jul 2020 15:29:22 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 4E17A20663 for ; Wed, 15 Jul 2020 15:29:22 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="rv6fGgsa" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4E17A20663 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id C50608D0003; Wed, 15 Jul 2020 11:29:21 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C01776B000A; Wed, 15 Jul 2020 11:29:21 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B17C08D0003; Wed, 15 Jul 2020 11:29:21 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0239.hostedemail.com [216.40.44.239]) by kanga.kvack.org (Postfix) with ESMTP id 9C69D6B0005 for ; Wed, 15 Jul 2020 11:29:21 -0400 (EDT) Received: from smtpin03.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 5EDDE181AC9BF for ; Wed, 15 Jul 2020 15:29:21 +0000 (UTC) X-FDA: 77040694122.03.veil16_430373d26efa Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin03.hostedemail.com (Postfix) with ESMTP id 22A3128A4EC for ; Wed, 15 Jul 2020 15:29:21 +0000 (UTC) X-HE-Tag: veil16_430373d26efa X-Filterd-Recvd-Size: 6699 Received: from mail-wm1-f68.google.com (mail-wm1-f68.google.com [209.85.128.68]) by imf38.hostedemail.com (Postfix) with ESMTP for ; Wed, 15 Jul 2020 15:29:20 +0000 (UTC) Received: by mail-wm1-f68.google.com with SMTP id l2so6257466wmf.0 for ; Wed, 15 Jul 2020 08:29:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=EXJMV5iRCMLH2HXuXT+6t4HwlcQ7buWBqLF62l76Ssc=; b=rv6fGgsa/fqNZXnc+Vd4O2EB0xnyzoEhI4JYVRHs2BAm2pjXQpY3kr2ZdZflldiAZ2 zgNLE+FasvAEwV22Oo3TUbKJGjmHJr4X85cLdRJVHbbtsK4koJNlpCZAe7ZBH+Mj8W9Y 4i3eQzr5HCDSI1vA/T0zh1CEO/ILRYCqMjzORTF4WrLha0QpjfvG5WROqpiJnnChesDJ yYKdt4miDOQwJ9TN4VqEaSH1LB1uegyEjvwKuTyZhuO9pAFr/t2yd/yVwavLtHFlb/7/ 28XIUE0vKEEXBS4MYbse3gSqrYHgkR6S1jqvbBpYnDWPiZ/sadLcPg5Z8ELEYzAdside UNsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=EXJMV5iRCMLH2HXuXT+6t4HwlcQ7buWBqLF62l76Ssc=; b=PNXdNcSLbGF7Qy/bDVnTsDWbqhhDuotVayd091OQXD3tAcOw5i62GOieLMsOad0OZR vZPikZBYe+sqXJv994QhVD8Z78h1WBpdtIps09M1XujVNzxkLqqviRP4VIgZJciZ43JS 7BVhqjAJTV1tYbVoS2rQ9GPIGa5AyD4rXEO/oro90nuJKTOGVz7oGc0du/dO9ojaSz1j IaegXxJywhq2vqi4bavJw0hBE6kHqXfLhrpkRxFiUMPL8Bg9BtfHZiWW5WEqvx5NKFR8 i8PUnCCcRw5KfN4IRlIrbaBqqqfAWNUdXye5VRefIXIqVTRJbRfDXmr8IfPvEP4NqhzB Eosw== X-Gm-Message-State: AOAM533GvuGe9crawHka1QIVpgSKXCn46/Q8ISxI9yCKQK0eGXPOO9k4 3UwELXDNAPNdlkbZMFr2K53aIw== X-Google-Smtp-Source: ABdhPJya3f8YbYeTG5ERqXVaoJCA04bI255e9uB53ecJyyuyJJIHvx6NS9eAMRbOYHiOmVROn6OOtw== X-Received: by 2002:a05:600c:2144:: with SMTP id v4mr50586wml.128.1594826959232; Wed, 15 Jul 2020 08:29:19 -0700 (PDT) Received: from elver.google.com ([100.105.32.75]) by smtp.gmail.com with ESMTPSA id n125sm4060060wme.30.2020.07.15.08.29.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jul 2020 08:29:18 -0700 (PDT) Date: Wed, 15 Jul 2020 17:29:12 +0200 From: Marco Elver To: syzbot Cc: akpm@linux-foundation.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, syzkaller-bugs@googlegroups.com, "Paul E. McKenney" , Will Deacon Subject: Re: KCSAN: data-race in generic_file_buffered_read / generic_file_buffered_read Message-ID: <20200715152912.GA2209203@elver.google.com> References: <0000000000004a4d6505aa7c688a@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <0000000000004a4d6505aa7c688a@google.com> User-Agent: Mutt/1.14.4 (2020-06-18) X-Rspamd-Queue-Id: 22A3128A4EC X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam02 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000527, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Wed, Jul 15, 2020 at 08:16AM -0700, syzbot wrote: > Hello, > > syzbot found the following issue on: > > HEAD commit: e9919e11 Merge branch 'for-linus' of git://git.kernel.org/.. > git tree: upstream > console output: https://syzkaller.appspot.com/x/log.txt?x=1217a83b100000 > kernel config: https://syzkaller.appspot.com/x/.config?x=570eb530a65cd98e > dashboard link: https://syzkaller.appspot.com/bug?extid=0f1e470df6a4316e0a11 > compiler: clang version 11.0.0 (https://github.com/llvm/llvm-project.git ca2dcbd030eadbf0aa9b660efe864ff08af6e18b) > > 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+0f1e470df6a4316e0a11@syzkaller.appspotmail.com > > ================================================================== > BUG: KCSAN: data-race in generic_file_buffered_read / generic_file_buffered_read Our guess is that this is either misuse of an API from userspace, or a bug. Can someone clarify? Below are the snippets of code around these accesses. > write to 0xffff8880968747b0 of 8 bytes by task 6336 on cpu 0: > generic_file_buffered_read+0x18be/0x19e0 mm/filemap.c:2246 ... would_block: error = -EAGAIN; out: ra->prev_pos = prev_index; ra->prev_pos <<= PAGE_SHIFT; 2246) ra->prev_pos |= prev_offset; *ppos = ((loff_t)index << PAGE_SHIFT) + offset; file_accessed(filp); return written ? written : error; } EXPORT_SYMBOL_GPL(generic_file_buffered_read); ... > generic_file_read_iter+0x7d/0x3e0 mm/filemap.c:2326 > ext4_file_read_iter+0x2d6/0x420 fs/ext4/file.c:74 > call_read_iter include/linux/fs.h:1902 [inline] > generic_file_splice_read+0x22a/0x310 fs/splice.c:312 > do_splice_to fs/splice.c:870 [inline] > splice_direct_to_actor+0x2a8/0x660 fs/splice.c:950 > do_splice_direct+0xf2/0x170 fs/splice.c:1059 > do_sendfile+0x562/0xb10 fs/read_write.c:1540 > __do_sys_sendfile64 fs/read_write.c:1601 [inline] > __se_sys_sendfile64 fs/read_write.c:1587 [inline] > __x64_sys_sendfile64+0xf2/0x130 fs/read_write.c:1587 > do_syscall_64+0x51/0xb0 arch/x86/entry/common.c:384 > entry_SYSCALL_64_after_hwframe+0x44/0xa9 > > read to 0xffff8880968747b0 of 8 bytes by task 6334 on cpu 1: > generic_file_buffered_read+0x11e/0x19e0 mm/filemap.c:2011 ... index = *ppos >> PAGE_SHIFT; prev_index = ra->prev_pos >> PAGE_SHIFT; 2011) prev_offset = ra->prev_pos & (PAGE_SIZE-1); last_index = (*ppos + iter->count + PAGE_SIZE-1) >> PAGE_SHIFT; offset = *ppos & ~PAGE_MASK; ... > generic_file_read_iter+0x7d/0x3e0 mm/filemap.c:2326 > ext4_file_read_iter+0x2d6/0x420 fs/ext4/file.c:74 > call_read_iter include/linux/fs.h:1902 [inline] > generic_file_splice_read+0x22a/0x310 fs/splice.c:312 > do_splice_to fs/splice.c:870 [inline] > splice_direct_to_actor+0x2a8/0x660 fs/splice.c:950 > do_splice_direct+0xf2/0x170 fs/splice.c:1059 > do_sendfile+0x562/0xb10 fs/read_write.c:1540 > __do_sys_sendfile64 fs/read_write.c:1601 [inline] > __se_sys_sendfile64 fs/read_write.c:1587 [inline] > __x64_sys_sendfile64+0xf2/0x130 fs/read_write.c:1587 > do_syscall_64+0x51/0xb0 arch/x86/entry/common.c:384 > entry_SYSCALL_64_after_hwframe+0x44/0xa9 > > Reported by Kernel Concurrency Sanitizer on: > CPU: 1 PID: 6334 Comm: syz-executor.0 Not tainted 5.8.0-rc5-syzkaller #0 > Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 > ================================================================== Thanks, -- Marco