Thread (18 messages) 18 messages, 10 authors, 2020-03-05

Re: [PATCH] blktrace: Protect q->blk_trace with RCU

From: Chaitanya Kulkarni <hidden>
Date: 2020-02-10 00:38:52
Also in: stable

Looks good.

Reviewed-by: Chaitanya Kulkarni <redacted>

On 02/06/2020 06:28 AM, Jan Kara wrote:
KASAN is reporting that __blk_add_trace() has a use-after-free issue
when accessing q->blk_trace. Indeed the switching of block tracing (and
thus eventual freeing of q->blk_trace) is completely unsynchronized with
the currently running tracing and thus it can happen that the blk_trace
structure is being freed just while __blk_add_trace() works on it.
Protect accesses to q->blk_trace by RCU during tracing and make sure we
wait for the end of RCU grace period when shutting down tracing. Luckily
that is rare enough event that we can afford that. Note that postponing
the freeing of blk_trace to an RCU callback should better be avoided as
it could have unexpected user visible side-effects as debugfs files
would be still existing for a short while block tracing has been shut
down.

Link:https://bugzilla.kernel.org/show_bug.cgi?id=205711
CC:stable@vger.kernel.org
Reported-by: Tristan<redacted>
Signed-off-by: Jan Kara<jack@suse.cz>
  
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help