<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/kernel/kcsan/debugfs.c, branch v5.12</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=v5.12</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v5.12'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2020-08-24T22:10:23Z</updated>
<entry>
<title>kcsan: Optimize debugfs stats counters</title>
<updated>2020-08-24T22:10:23Z</updated>
<author>
<name>Marco Elver</name>
<email>elver@google.com</email>
</author>
<published>2020-08-10T08:06:25Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=2e986b81f698e73c95e6456183f27b861f47bb87'/>
<id>urn:sha1:2e986b81f698e73c95e6456183f27b861f47bb87</id>
<content type='text'>
Remove kcsan_counter_inc/dec() functions, as they perform no other
logic, and are no longer needed.

This avoids several calls in kcsan_setup_watchpoint() and
kcsan_found_watchpoint(), as well as lets the compiler warn us about
potential out-of-bounds accesses as the array's size is known at all
usage sites at compile-time.

Signed-off-by: Marco Elver &lt;elver@google.com&gt;
Signed-off-by: Paul E. McKenney &lt;paulmck@kernel.org&gt;
</content>
</entry>
<entry>
<title>kcsan: Use pr_fmt for consistency</title>
<updated>2020-08-24T22:10:23Z</updated>
<author>
<name>Marco Elver</name>
<email>elver@google.com</email>
</author>
<published>2020-07-31T08:17:23Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=178a1877d782c034f466edd80e30a107af5469df'/>
<id>urn:sha1:178a1877d782c034f466edd80e30a107af5469df</id>
<content type='text'>
Use the same pr_fmt throughout for consistency. [ The only exception is
report.c, where the format must be kept precisely as-is. ]

Signed-off-by: Marco Elver &lt;elver@google.com&gt;
Signed-off-by: Paul E. McKenney &lt;paulmck@kernel.org&gt;
</content>
</entry>
<entry>
<title>kcsan: Remove debugfs test command</title>
<updated>2020-08-24T22:10:22Z</updated>
<author>
<name>Marco Elver</name>
<email>elver@google.com</email>
</author>
<published>2020-07-31T08:17:21Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=4700ccdf18fa3002d66769b69cf715cc58beea37'/>
<id>urn:sha1:4700ccdf18fa3002d66769b69cf715cc58beea37</id>
<content type='text'>
Remove the debugfs test command, as it is no longer needed now that we
have the KUnit+Torture based kcsan-test module. This is to avoid
confusion around how KCSAN should be tested, as only the kcsan-test
module is maintained.

Signed-off-by: Marco Elver &lt;elver@google.com&gt;
Signed-off-by: Paul E. McKenney &lt;paulmck@kernel.org&gt;
</content>
</entry>
<entry>
<title>kcsan: Simplify constant string handling</title>
<updated>2020-08-24T22:10:22Z</updated>
<author>
<name>Marco Elver</name>
<email>elver@google.com</email>
</author>
<published>2020-07-31T08:17:20Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=a4e74fa5f0d3e2a11f2d0deb522681d219a81426'/>
<id>urn:sha1:a4e74fa5f0d3e2a11f2d0deb522681d219a81426</id>
<content type='text'>
Simplify checking prefixes and length calculation of constant strings.
For the former, the kernel provides str_has_prefix(), and the latter we
should just use strlen("..") because GCC and Clang have optimizations
that optimize these into constants.

No functional change intended.

Signed-off-by: Marco Elver &lt;elver@google.com&gt;
Signed-off-by: Paul E. McKenney &lt;paulmck@kernel.org&gt;
</content>
</entry>
<entry>
<title>kcsan: Simplify debugfs counter to name mapping</title>
<updated>2020-08-24T22:10:21Z</updated>
<author>
<name>Marco Elver</name>
<email>elver@google.com</email>
</author>
<published>2020-07-31T08:17:19Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=69b2c81bc894606670204f0ae08f406dbcce836d'/>
<id>urn:sha1:69b2c81bc894606670204f0ae08f406dbcce836d</id>
<content type='text'>
Simplify counter ID to name mapping by using an array with designated
inits. This way, we can turn a run-time BUG() into a compile-time static
assertion failure if a counter name is missing.

No functional change intended.

Signed-off-by: Marco Elver &lt;elver@google.com&gt;
Signed-off-by: Paul E. McKenney &lt;paulmck@kernel.org&gt;
</content>
</entry>
<entry>
<title>kcsan: Use GFP_ATOMIC under spin lock</title>
<updated>2020-04-27T18:10:10Z</updated>
<author>
<name>Wei Yongjun</name>
<email>weiyongjun1@huawei.com</email>
</author>
<published>2020-04-17T02:58:37Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=52785b6ae8eded7ac99d65c92d989b702e5b4376'/>
<id>urn:sha1:52785b6ae8eded7ac99d65c92d989b702e5b4376</id>
<content type='text'>
A spin lock is held in insert_report_filterlist(), so the krealloc()
should use GFP_ATOMIC.  This commit therefore makes this change.

Reviewed-by: Marco Elver &lt;elver@google.com&gt;
Signed-off-by: Wei Yongjun &lt;weiyongjun1@huawei.com&gt;
Signed-off-by: Paul E. McKenney &lt;paulmck@kernel.org&gt;
</content>
</entry>
<entry>
<title>kcsan: Introduce scoped ASSERT_EXCLUSIVE macros</title>
<updated>2020-04-14T00:18:13Z</updated>
<author>
<name>Marco Elver</name>
<email>elver@google.com</email>
</author>
<published>2020-03-25T16:41:58Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=d8949ef1d9f1062848cd068cf369a57ce33dae6f'/>
<id>urn:sha1:d8949ef1d9f1062848cd068cf369a57ce33dae6f</id>
<content type='text'>
Introduce ASSERT_EXCLUSIVE_*_SCOPED(), which provide an intuitive
interface to use the scoped-access feature, without having to explicitly
mark the start and end of the desired scope. Basing duration of the
checks on scope avoids accidental misuse and resulting false positives,
which may be hard to debug. See added comments for usage.

The macros are implemented using __attribute__((__cleanup__(func))),
which is supported by all compilers that currently support KCSAN.

Suggested-by: Boqun Feng &lt;boqun.feng@gmail.com&gt;
Suggested-by: Paul E. McKenney &lt;paulmck@kernel.org&gt;
Signed-off-by: Marco Elver &lt;elver@google.com&gt;
Signed-off-by: Paul E. McKenney &lt;paulmck@kernel.org&gt;
</content>
</entry>
<entry>
<title>kcsan: Add current-&gt;state to implicitly atomic accesses</title>
<updated>2020-03-25T16:56:00Z</updated>
<author>
<name>Marco Elver</name>
<email>elver@google.com</email>
</author>
<published>2020-02-25T14:32:58Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=44656d3dc4f0dc20010d054f27397a4a1469fabf'/>
<id>urn:sha1:44656d3dc4f0dc20010d054f27397a4a1469fabf</id>
<content type='text'>
Add volatile current-&gt;state to list of implicitly atomic accesses. This
is in preparation to eventually enable KCSAN on kernel/sched (which
currently still has KCSAN_SANITIZE := n).

Since accesses that match the special check in atomic.h are rare, it
makes more sense to move this check to the slow-path, avoiding the
additional compare in the fast-path. With the microbenchmark, a speedup
of ~6% is measured.

Signed-off-by: Marco Elver &lt;elver@google.com&gt;
Signed-off-by: Paul E. McKenney &lt;paulmck@kernel.org&gt;
</content>
</entry>
<entry>
<title>kcsan: Introduce ASSERT_EXCLUSIVE_BITS(var, mask)</title>
<updated>2020-03-21T08:44:14Z</updated>
<author>
<name>Marco Elver</name>
<email>elver@google.com</email>
</author>
<published>2020-02-11T16:04:23Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=703b321501c95c658275fd76775282fe45989641'/>
<id>urn:sha1:703b321501c95c658275fd76775282fe45989641</id>
<content type='text'>
This introduces ASSERT_EXCLUSIVE_BITS(var, mask).
ASSERT_EXCLUSIVE_BITS(var, mask) will cause KCSAN to assume that the
following access is safe w.r.t. data races (however, please see the
docbook comment for disclaimer here).

For more context on why this was considered necessary, please see:

  http://lkml.kernel.org/r/1580995070-25139-1-git-send-email-cai@lca.pw

In particular, before this patch, data races between reads (that use
@mask bits of an access that should not be modified concurrently) and
writes (that change ~@mask bits not used by the readers) would have been
annotated with "data_race()" (or "READ_ONCE()"). However, doing so would
then hide real problems: we would no longer be able to detect harmful
races between reads to @mask bits and writes to @mask bits.

Therefore, by using ASSERT_EXCLUSIVE_BITS(var, mask), we accomplish:

  1. Avoid proliferation of specific macros at the call sites: by
     including a single mask in the argument list, we can use the same
     macro in a wide variety of call sites, regardless of how and which
     bits in a field each call site actually accesses.

  2. The existing code does not need to be modified (although READ_ONCE()
     may still be advisable if we cannot prove that the data race is
     always safe).

  3. We catch bugs where the exclusive bits are modified concurrently.

  4. We document properties of the current code.

Acked-by: John Hubbard &lt;jhubbard@nvidia.com&gt;
Signed-off-by: Marco Elver &lt;elver@google.com&gt;
Signed-off-by: Paul E. McKenney &lt;paulmck@kernel.org&gt;
Signed-off-by: Ingo Molnar &lt;mingo@kernel.org&gt;
Cc: David Hildenbrand &lt;david@redhat.com&gt;
Cc: Jan Kara &lt;jack@suse.cz&gt;
Cc: Qian Cai &lt;cai@lca.pw&gt;
</content>
</entry>
<entry>
<title>kcsan: Add test to generate conflicts via debugfs</title>
<updated>2020-03-21T08:43:30Z</updated>
<author>
<name>Marco Elver</name>
<email>elver@google.com</email>
</author>
<published>2020-02-06T15:46:26Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=a312013578e4775003689e31c1f487df11f362a3'/>
<id>urn:sha1:a312013578e4775003689e31c1f487df11f362a3</id>
<content type='text'>
Add 'test=&lt;iters&gt;' option to KCSAN's debugfs interface to invoke KCSAN
checks on a dummy variable. By writing 'test=&lt;iters&gt;' to the debugfs
file from multiple tasks, we can generate real conflicts, and trigger
data race reports.

Signed-off-by: Marco Elver &lt;elver@google.com&gt;
Signed-off-by: Paul E. McKenney &lt;paulmck@kernel.org&gt;
Signed-off-by: Ingo Molnar &lt;mingo@kernel.org&gt;
</content>
</entry>
</feed>
