<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/kernel/rcu/tasks.h, branch linux-5.9.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-5.9.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-5.9.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2020-11-05T10:51:43Z</updated>
<entry>
<title>rcu-tasks: Enclose task-list scan in rcu_read_lock()</title>
<updated>2020-11-05T10:51:43Z</updated>
<author>
<name>Paul E. McKenney</name>
</author>
<published>2020-09-15T21:27:38Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=463fbe4f2bc20be5cfb3ac2ea5cd57052e9ca45e'/>
<id>urn:sha1:463fbe4f2bc20be5cfb3ac2ea5cd57052e9ca45e</id>
<content type='text'>
commit f747c7e15d7bc71a967a94ceda686cf2460b69e8 upstream.

The rcu_tasks_trace_postgp() function uses for_each_process_thread()
to scan the task list without the benefit of RCU read-side protection,
which can result in use-after-free errors on task_struct structures.
This error was missed because the TRACE01 rcutorture scenario enables
lockdep, but also builds with CONFIG_PREEMPT_NONE=y.  In this situation,
preemption is disabled everywhere, so lockdep thinks everywhere can
be a legitimate RCU reader.  This commit therefore adds the needed
rcu_read_lock() and rcu_read_unlock().

Note that this bug can occur only after an RCU Tasks Trace CPU stall
warning, which by default only happens after a grace period has extended
for ten minutes (yes, not a typo, minutes).

Fixes: 4593e772b502 ("rcu-tasks: Add stall warnings for RCU Tasks Trace")
Cc: Alexei Starovoitov &lt;alexei.starovoitov@gmail.com&gt;
Cc: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
Cc: Jiri Olsa &lt;jolsa@redhat.com&gt;
Cc: &lt;bpf@vger.kernel.org&gt;
Cc: &lt;stable@vger.kernel.org&gt; # 5.7.x
Signed-off-by: Paul E. McKenney &lt;paulmck@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>rcu-tasks: Fix low-probability task_struct leak</title>
<updated>2020-11-05T10:51:43Z</updated>
<author>
<name>Paul E. McKenney</name>
</author>
<published>2020-09-15T21:03:34Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=19506c4e2022e283a2889f553c075e7221066db8'/>
<id>urn:sha1:19506c4e2022e283a2889f553c075e7221066db8</id>
<content type='text'>
commit 592031cc10858be4adb10f6c0f2608f6f21824aa upstream.

When rcu_tasks_trace_postgp() function detects an RCU Tasks Trace
CPU stall, it adds all tasks blocking the current grace period to
a list, invoking get_task_struct() on each to prevent them from
being freed while on the list.  It then traverses that list,
printing stall-warning messages for each one that is still blocking
the current grace period and removing it from the list.  The list
removal invokes the matching put_task_struct().

This of course means that in the admittedly unlikely event that some
task executes its outermost rcu_read_unlock_trace() in the meantime, it
won't be removed from the list and put_task_struct() won't be executing,
resulting in a task_struct leak.  This commit therefore makes the list
removal and put_task_struct() unconditional, stopping the leak.

Note further that this bug can occur only after an RCU Tasks Trace CPU
stall warning, which by default only happens after a grace period has
extended for ten minutes (yes, not a typo, minutes).

Fixes: 4593e772b502 ("rcu-tasks: Add stall warnings for RCU Tasks Trace")
Cc: Alexei Starovoitov &lt;alexei.starovoitov@gmail.com&gt;
Cc: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
Cc: Jiri Olsa &lt;jolsa@redhat.com&gt;
Cc: &lt;bpf@vger.kernel.org&gt;
Cc: &lt;stable@vger.kernel.org&gt; # 5.7.x
Signed-off-by: Paul E. McKenney &lt;paulmck@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>rcu-tasks: Fix grace-period/unlock race in RCU Tasks Trace</title>
<updated>2020-11-05T10:51:43Z</updated>
<author>
<name>Paul E. McKenney</name>
</author>
<published>2020-09-14T22:44:37Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=79036216e1bb74fc868976a305062953728a790a'/>
<id>urn:sha1:79036216e1bb74fc868976a305062953728a790a</id>
<content type='text'>
commit ba3a86e47232ad9f76160929f33ac9c64e4d0567 upstream.

The more intense grace-period processing resulting from the 50x RCU
Tasks Trace grace-period speedups exposed the following race condition:

o	Task A running on CPU 0 executes rcu_read_lock_trace(),
	entering a read-side critical section.

o	When Task A eventually invokes rcu_read_unlock_trace()
	to exit its read-side critical section, this function
	notes that the -&gt;trc_reader_special.s flag is zero and
	and therefore invoke wil set -&gt;trc_reader_nesting to zero
	using WRITE_ONCE().  But before that happens...

o	The RCU Tasks Trace grace-period kthread running on some other
	CPU interrogates Task A, but this fails because this task is
	currently running.  This kthread therefore sends an IPI to CPU 0.

o	CPU 0 receives the IPI, and thus invokes trc_read_check_handler().
	Because Task A has not yet cleared its -&gt;trc_reader_nesting
	counter, this function sees that Task A is still within its
	read-side critical section.  This function therefore sets the
	-&gt;trc_reader_nesting.b.need_qs flag, AKA the .need_qs flag.

	Except that Task A has already checked the .need_qs flag, which
	is part of the -&gt;trc_reader_special.s flag.  The .need_qs flag
	therefore remains set until Task A's next rcu_read_unlock_trace().

o	Task A now invokes synchronize_rcu_tasks_trace(), which cannot
	start a new grace period until the current grace period completes.
	And thus cannot return until after that time.

	But Task A's .need_qs flag is still set, which prevents the current
	grace period from completing.  And because Task A is blocked, it
	will never execute rcu_read_unlock_trace() until its call to
	synchronize_rcu_tasks_trace() returns.

	We are therefore deadlocked.

This race is improbable, but 80 hours of rcutorture made it happen twice.
The race was possible before the grace-period speedup, but roughly 50x
less probable.  Several thousand hours of rcutorture would have been
necessary to have a reasonable chance of making this happen before this
50x speedup.

This commit therefore eliminates this deadlock by setting
-&gt;trc_reader_nesting to a large negative number before checking the
.need_qs and zeroing (or decrementing with respect to its initial
value) -&gt;trc_reader_nesting.  For its part, the IPI handler's
trc_read_check_handler() function adds a check for negative values,
deferring evaluation of the task in this case.  Taken together, these
changes avoid this deadlock scenario.

Fixes: 276c410448db ("rcu-tasks: Split -&gt;trc_reader_need_end")
Cc: Alexei Starovoitov &lt;alexei.starovoitov@gmail.com&gt;
Cc: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
Cc: Jiri Olsa &lt;jolsa@redhat.com&gt;
Cc: &lt;bpf@vger.kernel.org&gt;
Cc: &lt;stable@vger.kernel.org&gt; # 5.7.x
Signed-off-by: Paul E. McKenney &lt;paulmck@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>rcu-tasks: Prevent complaints of unused show_rcu_tasks_classic_gp_kthread()</title>
<updated>2020-09-16T23:32:36Z</updated>
<author>
<name>Paul E. McKenney</name>
</author>
<published>2020-08-25T15:09:40Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=78edc005f477a4987ee0a5d96bfe117295c231fd'/>
<id>urn:sha1:78edc005f477a4987ee0a5d96bfe117295c231fd</id>
<content type='text'>
Commit 8344496e8b49 ("rcu-tasks: Conditionally compile
show_rcu_tasks_gp_kthreads()") introduced conditional
compilation of several functions, but forgot one occurrence of
show_rcu_tasks_classic_gp_kthread() that causes the compiler to warn of
an unused static function.  This commit uses "static inline" to avoid
these complaints and possibly also to avoid emitting an actual definition
of this function.

Fixes: 8344496e8b49 ("rcu-tasks: Conditionally compile show_rcu_tasks_gp_kthreads()")
Cc: &lt;stable@vger.kernel.org&gt; # 5.8.x
Reported-by: Laurent Pinchart &lt;laurent.pinchart@ideasonboard.com&gt;
Signed-off-by: Paul E. McKenney &lt;paulmck@kernel.org&gt;
</content>
</entry>
<entry>
<title>Merge branches 'doc.2020.06.29a', 'fixes.2020.06.29a', 'kfree_rcu.2020.06.29a', 'rcu-tasks.2020.06.29a', 'scale.2020.06.29a', 'srcu.2020.06.29a' and 'torture.2020.06.29a' into HEAD</title>
<updated>2020-06-29T19:03:15Z</updated>
<author>
<name>Paul E. McKenney</name>
</author>
<published>2020-06-29T19:03:15Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=13625c0a4074d3bab61b1dc70a828b574255f339'/>
<id>urn:sha1:13625c0a4074d3bab61b1dc70a828b574255f339</id>
<content type='text'>
doc.2020.06.29a:  Documentation updates.
fixes.2020.06.29a:  Miscellaneous fixes.
kfree_rcu.2020.06.29a:  kfree_rcu() updates.
rcu-tasks.2020.06.29a:  RCU Tasks updates.
scale.2020.06.29a:  Read-side scalability tests.
srcu.2020.06.29a:  SRCU updates.
torture.2020.06.29a:  Torture-test updates.
</content>
</entry>
<entry>
<title>rcu-tasks: Fix synchronize_rcu_tasks_trace() header comment</title>
<updated>2020-06-29T19:00:46Z</updated>
<author>
<name>Paul E. McKenney</name>
</author>
<published>2020-06-12T20:11:29Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=c7dcf8106f7570b133b05ff68fd4100064965d9d'/>
<id>urn:sha1:c7dcf8106f7570b133b05ff68fd4100064965d9d</id>
<content type='text'>
The synchronize_rcu_tasks_trace() header comment incorrectly claims that
any number of things delimit RCU Tasks Trace read-side critical sections,
when in fact only rcu_read_lock_trace() and rcu_read_unlock_trace() do so.
This commit therefore fixes this comment, and, while in the area, fixes
a typo in the rcu_read_lock_trace() header comment.

Reported-by: Alexei Starovoitov &lt;alexei.starovoitov@gmail.com&gt;
Signed-off-by: Paul E. McKenney &lt;paulmck@kernel.org&gt;
</content>
</entry>
<entry>
<title>rcu-tasks: Fix code-style issues</title>
<updated>2020-06-29T19:00:22Z</updated>
<author>
<name>Paul E. McKenney</name>
</author>
<published>2020-06-09T16:24:51Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=30d8aa5128f12c9d781b67c9694c1abfa4f6ce6a'/>
<id>urn:sha1:30d8aa5128f12c9d781b67c9694c1abfa4f6ce6a</id>
<content type='text'>
This commit declares trc_n_readers_need_end and trc_wait static and
replaced a "&amp;" with "&amp;&amp;".  The "&amp;" happened to work because the values
are bool, but accidents waiting to happen and all that...

Reported-by: kbuild test robot &lt;lkp@intel.com&gt;
Signed-off-by: Paul E. McKenney &lt;paulmck@kernel.org&gt;
</content>
</entry>
<entry>
<title>rcu-tasks: Conditionally compile show_rcu_tasks_gp_kthreads()</title>
<updated>2020-06-29T19:00:22Z</updated>
<author>
<name>Paul E. McKenney</name>
</author>
<published>2020-05-29T03:03:48Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=8344496e8b49c4122c1808d6cd3f8dc71bccb595'/>
<id>urn:sha1:8344496e8b49c4122c1808d6cd3f8dc71bccb595</id>
<content type='text'>
The show_rcu_tasks_gp_kthreads() function is not invoked by Tiny RCU,
but is nevertheless defined in Tiny RCU builds that enable Tasks Trace
RCU.  This commit therefore conditionally compiles this function so
that it is defined only in builds that actually use it.

Reported-by: kbuild test robot &lt;lkp@intel.com&gt;
Signed-off-by: Paul E. McKenney &lt;paulmck@kernel.org&gt;
</content>
</entry>
<entry>
<title>rcu-tasks: Make rcu_tasks_postscan() be static</title>
<updated>2020-06-29T19:00:22Z</updated>
<author>
<name>Paul E. McKenney</name>
</author>
<published>2020-05-29T02:27:06Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=04a3c5aa7a8cb2ce97f9beb627ba742bc8b0fe03'/>
<id>urn:sha1:04a3c5aa7a8cb2ce97f9beb627ba742bc8b0fe03</id>
<content type='text'>
The rcu_tasks_postscan() function is not used outside of RCU's tasks.h
file, so this commit makes it be static.

Reported-by: kbuild test robot &lt;lkp@intel.com&gt;
Signed-off-by: Paul E. McKenney &lt;paulmck@kernel.org&gt;
</content>
</entry>
<entry>
<title>rcu-tasks: Convert sleeps to idle priority</title>
<updated>2020-06-29T19:00:22Z</updated>
<author>
<name>Paul E. McKenney</name>
</author>
<published>2020-05-07T23:47:13Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=ea6eed9f7d7382c7230202d4c3bf74185f193394'/>
<id>urn:sha1:ea6eed9f7d7382c7230202d4c3bf74185f193394</id>
<content type='text'>
This commit converts the long-standing schedule_timeout_interruptible()
and schedule_timeout_uninterruptible() calls used by the various Tasks
RCU's grace-period kthreads to schedule_timeout_idle().  This conversion
avoids polluting the load-average with Tasks-RCU-related sleeping.

Signed-off-by: Paul E. McKenney &lt;paulmck@kernel.org&gt;
</content>
</entry>
</feed>
