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.3 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_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 A72B7C433DB for ; Thu, 11 Mar 2021 14:53:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5C05D64FEC for ; Thu, 11 Mar 2021 14:53:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233927AbhCKOxT (ORCPT ); Thu, 11 Mar 2021 09:53:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36318 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233901AbhCKOxQ (ORCPT ); Thu, 11 Mar 2021 09:53:16 -0500 Received: from mail-qk1-x730.google.com (mail-qk1-x730.google.com [IPv6:2607:f8b0:4864:20::730]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 16D47C061574 for ; Thu, 11 Mar 2021 06:53:16 -0800 (PST) Received: by mail-qk1-x730.google.com with SMTP id 130so20799035qkh.11 for ; Thu, 11 Mar 2021 06:53:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=KHPIkhTb0LE1ggEW55e8PVY6uRKVEwz5gqVz2vI9SzE=; b=Bhi8px5GrHj7K2OkZ2Wd5DLPfqYMZL+TS/bR9cALnTN0U4D3gdvsgXMevrbSUujiso LGYW2QvD+RG1lpMw/i8N8mA7U3by86mAbbQvWZJEthBBeShXXuKlXuhWSAst+92Cyanl DBrt9CIENu18/doC/lTokLfTU1zDe4rveMjrKh6x6CAtSoSOmn8ls+MonlmNteWEVcTw Hg0aNN/YBZnR8u6774JfaGPnUz4GV12glMT5BXOmXfUswF2mwlsZkwipHPL8mMUHMR7J W9piEVQTJpc3+z3niHKUjYzpJ32dO1kLNpnxweCS9K+PXLR72/Xgb6aY9yScmtSQEs3H QPsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=KHPIkhTb0LE1ggEW55e8PVY6uRKVEwz5gqVz2vI9SzE=; b=Vdb+vJAX8ijf+9O0FKvSxnhsCZfh3V5hoTkq7FomxpR4d4I34aJ+A9JAyKfwWuVxK7 QfmFVZQRl7KHUCf0elgqAsLfCWAC/0sKiWvj3HFbDubBNqtdN7TP0ZbECTAb1evbNRj4 H3UzBesTnoNYqdQNf2lNMabez3yDjP1n0YOBQHq+PogwqFq+fa/72UgFcjWT4NTFuQok lkgO+EjdqIUw6b1PHyPieqhOnIblOxwBnexUX1qLNGxuCkGBRLNaE7nsuvXmd+BTmGnF dZNgbAXqheGVtHZDXv+lsQXSc60Z6pHMMU3SkfzbE3Dyf3e/Hn6k3Z8Wma6k4pKtrbaq 1Ggg== X-Gm-Message-State: AOAM533Y6MF/evGBX3NeYCth7rOzRbcdTSXFmc0TyoMJrxS1UZY/yEdq c4QZ0aiOGMtbB+NvxGGfJi7zdBgTE9cTCe1Nloaq2Q== X-Google-Smtp-Source: ABdhPJzQ3NUbCY3lw1wcdCgBzBoejG7qGizVUeuwvRYWcaZ7RpliAYL96CzGCXNPc6j5EpotIrRQTj08SX8qAheY+cY= X-Received: by 2002:a05:620a:410f:: with SMTP id j15mr7970362qko.424.1615474394860; Thu, 11 Mar 2021 06:53:14 -0800 (PST) MIME-Version: 1.0 References: <0000000000008de88005bd40ac36@google.com> <20210311142503.GA31816@quack2.suse.cz> In-Reply-To: <20210311142503.GA31816@quack2.suse.cz> From: Dmitry Vyukov Date: Thu, 11 Mar 2021 15:53:03 +0100 Message-ID: Subject: Re: [syzbot] KCSAN: data-race in start_this_handle / start_this_handle To: Jan Kara , Marco Elver , Tetsuo Handa Cc: syzbot , Jan Kara , linux-ext4@vger.kernel.org, LKML , syzkaller-bugs , "Theodore Ts'o" Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Mar 11, 2021 at 3:25 PM Jan Kara wrote: > > On Thu 11-03-21 02:59:14, syzbot wrote: > > HEAD commit: a74e6a01 Merge tag 's390-5.12-3' of git://git.kernel.org/p.. > > git tree: upstream > > console output: https://syzkaller.appspot.com/x/log.txt?x=159f69ecd00000 > > kernel config: https://syzkaller.appspot.com/x/.config?x=de394bbaade74fb7 > > dashboard link: https://syzkaller.appspot.com/bug?extid=30774a6acf6a2cf6d535 > > compiler: Debian clang version 11.0.1-2 > > > > 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+30774a6acf6a2cf6d535@syzkaller.appspotmail.com > > > > ================================================================== > > BUG: KCSAN: data-race in start_this_handle / start_this_handle > > > > write to 0xffff888103880870 of 8 bytes by task 29956 on cpu 1: > > jbd2_get_transaction fs/jbd2/transaction.c:125 [inline] > > start_this_handle+0xceb/0x1010 fs/jbd2/transaction.c:400 > > jbd2__journal_start+0x1fc/0x3f0 fs/jbd2/transaction.c:503 > > __ext4_journal_start_sb+0x159/0x310 fs/ext4/ext4_jbd2.c:105 > > __ext4_journal_start fs/ext4/ext4_jbd2.h:320 [inline] > > ext4_da_write_begin+0x460/0xaf0 fs/ext4/inode.c:2998 > > generic_perform_write+0x196/0x3a0 mm/filemap.c:3575 > > ext4_buffered_write_iter+0x2e5/0x3e0 fs/ext4/file.c:269 > > ext4_file_write_iter+0x48a/0x10b0 fs/ext4/file.c:502 > > call_write_iter include/linux/fs.h:1977 [inline] > > do_iter_readv_writev+0x2cb/0x360 fs/read_write.c:740 > > do_iter_write+0x112/0x4c0 fs/read_write.c:866 > > vfs_iter_write+0x4c/0x70 fs/read_write.c:907 > > iter_file_splice_write+0x40a/0x750 fs/splice.c:689 > > do_splice_from fs/splice.c:767 [inline] > > direct_splice_actor+0x80/0xa0 fs/splice.c:936 > > splice_direct_to_actor+0x345/0x650 fs/splice.c:891 > > do_splice_direct+0xf5/0x170 fs/splice.c:979 > > do_sendfile+0x7a6/0xe20 fs/read_write.c:1260 > > __do_sys_sendfile64 fs/read_write.c:1319 [inline] > > __se_sys_sendfile64 fs/read_write.c:1311 [inline] > > __x64_sys_sendfile64+0xa9/0x130 fs/read_write.c:1311 > > do_syscall_64+0x39/0x80 arch/x86/entry/common.c:46 > > entry_SYSCALL_64_after_hwframe+0x44/0xae > > > > read to 0xffff888103880870 of 8 bytes by task 29936 on cpu 0: > > start_this_handle+0x1c1/0x1010 fs/jbd2/transaction.c:352 > > jbd2__journal_start+0x1fc/0x3f0 fs/jbd2/transaction.c:503 > > __ext4_journal_start_sb+0x159/0x310 fs/ext4/ext4_jbd2.c:105 > > __ext4_journal_start fs/ext4/ext4_jbd2.h:320 [inline] > > ext4_da_write_begin+0x460/0xaf0 fs/ext4/inode.c:2998 > > generic_perform_write+0x196/0x3a0 mm/filemap.c:3575 > > ext4_buffered_write_iter+0x2e5/0x3e0 fs/ext4/file.c:269 > > ext4_file_write_iter+0x48a/0x10b0 fs/ext4/file.c:502 > > call_write_iter include/linux/fs.h:1977 [inline] > > do_iter_readv_writev+0x2cb/0x360 fs/read_write.c:740 > > do_iter_write+0x112/0x4c0 fs/read_write.c:866 > > vfs_iter_write+0x4c/0x70 fs/read_write.c:907 > > iter_file_splice_write+0x40a/0x750 fs/splice.c:689 > > do_splice_from fs/splice.c:767 [inline] > > direct_splice_actor+0x80/0xa0 fs/splice.c:936 > > splice_direct_to_actor+0x345/0x650 fs/splice.c:891 > > do_splice_direct+0xf5/0x170 fs/splice.c:979 > > do_sendfile+0x7a6/0xe20 fs/read_write.c:1260 > > __do_sys_sendfile64 fs/read_write.c:1319 [inline] > > __se_sys_sendfile64 fs/read_write.c:1311 [inline] > > __x64_sys_sendfile64+0xa9/0x130 fs/read_write.c:1311 > > do_syscall_64+0x39/0x80 arch/x86/entry/common.c:46 > > entry_SYSCALL_64_after_hwframe+0x44/0xae > > > > Reported by Kernel Concurrency Sanitizer on: > > CPU: 0 PID: 29936 Comm: syz-executor.5 Not tainted 5.12.0-rc2-syzkaller #0 > > Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 > > ================================================================== > > So this case is harmless. start_this_handle() does indeed check > journal->j_running_transaction without any protection and this is only a > racy check to opportunistically preallocate a transaction if we are likely > to need it. There was some macro to instruct KCSAN that the read is > actually fine, wasn't there? +Marco +Tetsuo, did you want to fix it?