1
0
Fork 0
alistair23-linux/include
Jan Kara 6f9cff84dd blktrace: Protect q->blk_trace with RCU
[ Upstream commit c780e86dd4 ]

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
Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Tested-by: Ming Lei <ming.lei@redhat.com>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Reported-by: Tristan Madani <tristmd@gmail.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-03-05 16:43:52 +01:00
..
acpi ACPICA: Introduce ACPI_ACCESS_BYTE_WIDTH() macro 2020-03-05 16:43:42 +01:00
asm-generic lib/vdso: Make __arch_update_vdso_data() logic understandable 2020-03-05 16:43:49 +01:00
clocksource clocksource/drivers/hyperv: Enable TSC page clocksource on 32bit 2019-08-23 16:59:54 +02:00
crypto crypto: algif_skcipher - Use chunksize instead of blocksize 2020-01-17 19:48:46 +01:00
drm drm: mst: Fix query_payload ack reply struct 2019-12-31 16:42:19 +01:00
dt-bindings dt-bindings: reset: meson8b: fix duplicate reset IDs 2020-01-23 08:22:28 +01:00
keys
kvm KVM: arm/arm64: vgic: Use a single IO device per redistributor 2019-08-25 11:02:52 +01:00
linux blktrace: Protect q->blk_trace with RCU 2020-03-05 16:43:52 +01:00
math-emu nds32: Mark expected switch fall-throughs 2019-08-29 11:06:56 -05:00
media media: v4l2-device.h: Explicitly compare grp{id,mask} to zero in v4l2_device macros 2020-02-24 08:36:36 +01:00
misc
net net: sched: correct flower port blocking 2020-03-05 16:43:32 +01:00
pcmcia
ras
rdma IB/core: Let IB core distribute cache update events 2020-02-24 08:36:26 +01:00
scsi scsi: Revert "target: iscsi: Wait for all commands to finish before freeing a session" 2020-02-28 17:22:25 +01:00
soc Char/Misc driver patches for 5.4-rc1 2019-09-18 11:14:31 -07:00
sound ALSA: rawmidi: Avoid bit fields for state flags 2020-02-28 17:22:27 +01:00
target
trace rcu: Fix data-race due to atomic_t copy-by-value 2020-02-24 08:36:23 +01:00
uapi usb: charger: assign specific number for enum value 2020-03-05 16:43:46 +01:00
vdso
video fbdev: da8xx: remove panel_power_ctrl() callback from platform data 2019-08-26 17:53:58 +05:30
xen xen: fixes and cleanups for 5.4-rc2 2019-10-04 11:13:09 -07:00