All of lore.kernel.org
 help / color / mirror / Atom feed
From: Qian Cai <cai@lca.pw>
To: paulmck@kernel.org
Cc: willy@infradead.org, elver@google.com,
	linux-kernel@vger.kernel.org, Qian Cai <cai@lca.pw>
Subject: [PATCH -next] lib: disable KCSAN for XArray
Date: Tue,  3 Mar 2020 22:15:51 -0500	[thread overview]
Message-ID: <20200304031551.1326-1-cai@lca.pw> (raw)

Functions like xas_find_marked(), xas_set_mark(), and xas_clear_mark()
could happen concurrently result in data races, but those operate only
on a single bit that are pretty much harmless. For example,

 write to 0xffffa0020ee705c8 of 8 bytes by task 39718 on cpu 0:
  xas_set_mark+0x8e/0x190
  arch___test_and_set_bit at arch/x86/include/asm/bitops.h:152
  (inlined by) __test_and_set_bit at include/asm-generic/bitops/instrumented-non-atomic.h:72
  (inlined by) node_set_mark at lib/xarray.c:93
  (inlined by) xas_set_mark at lib/xarray.c:879
  __test_set_page_writeback+0x5de/0x8c0
  iomap_writepage_map+0x8c6/0xf90
  iomap_do_writepage+0x12b/0x450
  write_cache_pages+0x523/0xb20
  iomap_writepages+0x47/0x80
  xfs_file_fsync+0xeb/0x450 [xfs]
  do_writepages+0x5e/0x130
  __filemap_fdatawrite_range+0x19e/0x1f0
  file_write_and_wait_range+0xc0/0x100
  xfs_file_fsync+0xeb/0x450 [xfs]
  vfs_fsync_range+0x71/0x110
  __x64_sys_msync+0x210/0x2a0
  do_syscall_64+0x91/0xb05
  entry_SYSCALL_64_after_hwframe+0x49/0xbe

 read to 0xffffa0020ee705c8 of 8 bytes by task 39717 on cpu 5:
  xas_find_marked+0xe9/0x750
  xas_find_chunk at include/linux/xarray.h:1625
  (inlined by) xas_find_marked at lib/xarray.c:1198
  find_get_pages_range_tag+0x1bf/0xa90
  pagevec_lookup_range_tag+0x46/0x70
  __filemap_fdatawait_range+0xbb/0x270
  file_write_and_wait_range+0xe0/0x100
  xfs_file_fsync+0xeb/0x450 [xfs]
  vfs_fsync_range+0x71/0x110
  __x64_sys_msync+0x210/0x2a0
  do_syscall_64+0x91/0xb05
  entry_SYSCALL_64_after_hwframe+0x49/0xbe

Signed-off-by: Qian Cai <cai@lca.pw>
---
 lib/Makefile | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/lib/Makefile b/lib/Makefile
index 523dfe2063e2..989e702c275b 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -28,6 +28,11 @@ endif
 # Used by KCSAN while enabled, avoid recursion.
 KCSAN_SANITIZE_random32.o := n
 
+# This produces frequent data race reports: most of them are due to races on
+# the same word but accesses to a single bit of that word. Re-enable KCSAN
+# for this when we have more consensus on what to do about them.
+KCSAN_SANITIZE_xarray.o := n
+
 lib-y := ctype.o string.o vsprintf.o cmdline.o \
 	 rbtree.o radix-tree.o timerqueue.o xarray.o \
 	 idr.o extable.o sha1.o irq_regs.o argv_split.o \
-- 
2.21.0 (Apple Git-122.2)


             reply	other threads:[~2020-03-04  3:16 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-04  3:15 Qian Cai [this message]
2020-03-04  3:33 ` [PATCH -next] lib: disable KCSAN for XArray Matthew Wilcox
2020-03-04  3:55   ` Qian Cai
2020-03-04  4:00     ` Matthew Wilcox
2020-03-04  4:05   ` Paul E. McKenney
2020-03-04  4:33     ` Matthew Wilcox
2020-03-04 14:10       ` Paul E. McKenney
2020-03-04 16:40         ` Marco Elver
2020-03-04 17:10           ` Qian Cai
2020-03-04 17:14             ` Paul E. McKenney
2020-03-05 15:18         ` Matthew Wilcox
2020-03-05 21:39           ` Paul E. McKenney
2020-03-06 13:38             ` Marco Elver
2020-03-06 16:53               ` Matthew Wilcox
2020-03-06 17:03                 ` Paul E. McKenney
2020-03-06 20:04                   ` Marco Elver

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200304031551.1326-1-cai@lca.pw \
    --to=cai@lca.pw \
    --cc=elver@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paulmck@kernel.org \
    --cc=willy@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.