Received: by 2002:a05:7412:bc1a:b0:d7:7d3a:4fe2 with SMTP id ki26csp460287rdb; Sat, 19 Aug 2023 08:31:48 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH7/jLHh5Ia6VhEO4WqzatYFvCgqYjnO4X6W6/lzmdL2Ly44vcNduSOCGVQful03lyVEbPu X-Received: by 2002:a17:902:e802:b0:1b8:85c4:48f5 with SMTP id u2-20020a170902e80200b001b885c448f5mr2775122plg.2.1692459108192; Sat, 19 Aug 2023 08:31:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692459108; cv=none; d=google.com; s=arc-20160816; b=IgC5glbNHRl8QeqI8ChiMR8NCkUuAw9IPibeVtUkHBdlzoe+QdU0FpJQs93miYjRs4 VNJ/vPRIFNQGA34YTb6YN+xEoS2E6eZZzuehL0Yoe8vdNI3h7BOpDVuAkNEGOeawcPyo 4YKWGbF2R+dZV+Ek1bVL/oWftoJPeGvBIot6SN3mrG2ED6ynIx+KVdPE2oJPU75eNx9M OVKC342tYBQegi+Cpp60rk+OSuDlpZJgiwmPy46eYlZj8M+AFgGbfc5RQ/8XXY4gf84G iAHQQrkWZNe4XdM2PnsukqQdO6Tk8BhzfwWG/HD96tk3wybKYecxtaGswFP0472sMSNE t2Qg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=0oDwOIByjOVDOfLy6f21qg8nkzlLOXNjWABFE+sxO4M=; fh=Xi3P5g1vWTcFUcSN/HXGtbczOQ+HqnqH7sbfqvVd5aM=; b=UNI3e05IlhGu08YqRbOmcYkctl3BakC/HJK6MEWeYFjW3uRt3W5MqiiVP/mwMNCQ6U HAnsz8+6/6ONeZNi0IU6ME6n4Ta8LF8bCc18P8pKfZeitoapHnJOXnCSubjmsJMCywSL ajIBxsD3yS7yW0EyzDeksEmsQ5ZNvAZKpzL3jO9wzKbMz5F6xwrONJ832w1/+iS0r+N8 HH/hD6w2rmv5HMZXY1ICaJFPqlB7MfNbokdLz4+vvAPPd+4vtfP/l9MU4kghtcie68p/ 0D56VLQhzAryUsn7cq74hA3oVqLUuOfWJ/h22uB01vKDAqM/Zhs60toEEOBnPWk1Piw5 Afzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=wL97AF5h; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id p4-20020a170902e74400b001b9e9ef7e1fsi3902934plf.346.2023.08.19.08.31.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 19 Aug 2023 08:31:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=wL97AF5h; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 87C0CE9CD4; Sat, 19 Aug 2023 01:47:41 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376834AbjHRMVl (ORCPT + 99 others); Fri, 18 Aug 2023 08:21:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34732 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376823AbjHRMVX (ORCPT ); Fri, 18 Aug 2023 08:21:23 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0D14F30E6; Fri, 18 Aug 2023 05:21:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=0oDwOIByjOVDOfLy6f21qg8nkzlLOXNjWABFE+sxO4M=; b=wL97AF5hG0hd7cgO4tOtTA/aUM UkSguRmrpSl/BpltRzs1pu1psVpf2BFoeOvfy//3P+7xmjcYlDKxZ4FAPqcHzrfAv+OH7VwseKE6U rMXPjbNvhCEQ53yjmXKwwE0sW17V3qVpX4bR4l56PJWgUxIjtb6lp/IbHlF/ncpKl/YPV3Nob0rqt ksrOC3A6w4+1cv0iAzY66KD8BnWPVB8SaGEvMg7Bbxh7FmVrbcxosBYffj83kS8JARN/qg7Sc+Ukr dXwMnR9JhXrqWBaxuEdDDRcZj82f/DcwDzKrFG2/oG5ZJPK6RbudSU7Jn/nq8K5y+Iq48rIxP2d95 e8Mgxa3w==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1qWyTd-009N6I-UG; Fri, 18 Aug 2023 12:21:17 +0000 Date: Fri, 18 Aug 2023 13:21:17 +0100 From: Matthew Wilcox To: Mirsad Todorovac Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, Andrew Morton , linux-mm@kvack.org, Chris Mason , Josef Bacik , David Sterba , linux-btrfs@vger.kernel.org Subject: Re: [BUG] KCSAN: data-race in xas_clear_mark / xas_find_marked Message-ID: References: <06645d2b-a964-1c4c-15cf-42ccc6c6e19b@alu.unizg.hr> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <06645d2b-a964-1c4c-15cf-42ccc6c6e19b@alu.unizg.hr> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Aug 18, 2023 at 10:01:32AM +0200, Mirsad Todorovac wrote: > [ 206.510010] ================================================================== > [ 206.510035] BUG: KCSAN: data-race in xas_clear_mark / xas_find_marked > > [ 206.510067] write to 0xffff963df6a90fe0 of 8 bytes by interrupt on cpu 22: > [ 206.510081] xas_clear_mark+0xd5/0x180 > [ 206.510097] __xa_clear_mark+0xd1/0x100 > [ 206.510114] __folio_end_writeback+0x293/0x5a0 > [ 206.520722] read to 0xffff963df6a90fe0 of 8 bytes by task 2793 on cpu 6: > [ 206.520735] xas_find_marked+0xe5/0x600 > [ 206.520750] filemap_get_folios_tag+0xf9/0x3d0 Also, before submitting this kind of report, you should run the trace through scripts/decode_stacktrace.sh to give us line numbers instead of hex offsets, which are useless to anyone who doesn't have your exact kernel build. > [ 206.510010] ================================================================== > [ 206.510035] BUG: KCSAN: data-race in xas_clear_mark / xas_find_marked > > [ 206.510067] write to 0xffff963df6a90fe0 of 8 bytes by interrupt on cpu 22: > [ 206.510081] xas_clear_mark (./arch/x86/include/asm/bitops.h:178 ./include/asm-generic/bitops/instrumented-non-atomic.h:115 lib/xarray.c:102 lib/xarray.c:914) > [ 206.510097] __xa_clear_mark (lib/xarray.c:1923) > [ 206.510114] __folio_end_writeback (mm/page-writeback.c:2981) This path is properly using xa_lock_irqsave() before calling __xa_clear_mark(). > [ 206.520722] read to 0xffff963df6a90fe0 of 8 bytes by task 2793 on cpu 6: > [ 206.520735] xas_find_marked (./include/linux/xarray.h:1706 lib/xarray.c:1354) > [ 206.520750] filemap_get_folios_tag (mm/filemap.c:1975 mm/filemap.c:2273) This takes the RCU read lock before calling xas_find_marked() as it's supposed to. What garbage do I have to write to tell KCSAN it's wrong? The line that's probably triggering it is currently: unsigned long data = *addr & (~0UL << offset);