From: Mathieu Desnoyers Date: Tue, 25 Feb 2020 15:18:11 +0000 (-0500) Subject: Fix: rcu: Fix data-race due to atomic_t copy-by-value (5.5.6, 5.4.22) X-Git-Tag: v2.10.14~1 X-Git-Url: http://git.liburcu.org/?p=lttng-modules.git;a=commitdiff_plain;h=dab37f9594b9af44bd3f9b6a24e8699da1116faa Fix: rcu: Fix data-race due to atomic_t copy-by-value (5.5.6, 5.4.22) The following upstream commit has been backported to stable kernels 5.5.6 and 5.4.22: commit 6cf539a87a61a4fbc43f625267dbcbcf283872ed Author: Marco Elver Date: Wed Oct 9 17:57:43 2019 +0200 rcu: Fix data-race due to atomic_t copy-by-value This fixes a data-race where `atomic_t dynticks` is copied by value. The copy is performed non-atomically, resulting in a data-race if `dynticks` is updated concurrently. Signed-off-by: Mathieu Desnoyers --- diff --git a/instrumentation/events/lttng-module/rcu.h b/instrumentation/events/lttng-module/rcu.h index 123f6151..70acdf1c 100644 --- a/instrumentation/events/lttng-module/rcu.h +++ b/instrumentation/events/lttng-module/rcu.h @@ -385,7 +385,9 @@ LTTNG_TRACEPOINT_EVENT(rcu_fqs, * events use the upper bits of each number, while interrupt-related * events use the lower bits. */ -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,6,0)) +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,6,0)) \ + || LTTNG_KERNEL_RANGE(5,5,6, 5,6,0) \ + || LTTNG_KERNEL_RANGE(5,4,22, 5,5,0) LTTNG_TRACEPOINT_EVENT(rcu_dyntick, TP_PROTO(const char *polarity, long oldnesting, long newnesting, int dynticks),