fix: random: rather than entropy_store abstraction, use global (v5.17)
authorMichael Jeanson <mjeanson@efficios.com>
Wed, 26 Jan 2022 19:53:41 +0000 (14:53 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 28 Jan 2022 16:33:22 +0000 (11:33 -0500)
See upstream commit :

  commit 90ed1e67e896cc8040a523f8428fc02f9b164394
  Author: Jason A. Donenfeld <Jason@zx2c4.com>
  Date:   Wed Jan 12 17:18:08 2022 +0100

    random: rather than entropy_store abstraction, use global

    Originally, the RNG used several pools, so having things abstracted out
    over a generic entropy_store object made sense. These days, there's only
    one input pool, and then an uneven mix of usage via the abstraction and
    usage via &input_pool. Rather than this uneasy mixture, just get rid of
    the abstraction entirely and have things always use the global. This
    simplifies the code and makes reading it a bit easier.

Change-Id: I1a2a14d7b6e69a047804e1e91e00fe002f757431
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
instrumentation/events/lttng-module/random.h

index 12e2865bb2d1c5a74a777feb937d034d4b333a87..fb055cdd47dc6938355dd5a0c6b0f46459368890 100644 (file)
@@ -8,6 +8,36 @@
 #include <probes/lttng-tracepoint-event.h>
 #include <linux/writeback.h>
 
+#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,17,0))
+LTTNG_TRACEPOINT_EVENT_CLASS(random__mix_pool_bytes,
+       TP_PROTO(int bytes, unsigned long IP),
+
+       TP_ARGS(bytes, IP),
+
+       TP_FIELDS(
+               ctf_integer(int, bytes, bytes)
+               ctf_integer_hex(unsigned long, IP, IP)
+       )
+)
+
+LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(random__mix_pool_bytes, mix_pool_bytes,
+
+       random_mix_pool_bytes,
+
+       TP_PROTO(int bytes, unsigned long IP),
+
+       TP_ARGS(bytes, IP)
+)
+
+LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(random__mix_pool_bytes, mix_pool_bytes_nolock,
+
+       random_mix_pool_bytes_nolock,
+
+       TP_PROTO(int bytes, unsigned long IP),
+
+       TP_ARGS(bytes, IP)
+)
+#else
 LTTNG_TRACEPOINT_EVENT_CLASS(random__mix_pool_bytes,
        TP_PROTO(const char *pool_name, int bytes, unsigned long IP),
 
@@ -37,8 +67,24 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(random__mix_pool_bytes, mix_pool_bytes_noloc
 
        TP_ARGS(pool_name, bytes, IP)
 )
+#endif
 
-#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,2,0))
+#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,17,0))
+LTTNG_TRACEPOINT_EVENT_MAP(credit_entropy_bits,
+
+       random_credit_entropy_bits,
+
+       TP_PROTO(int bits, int entropy_count, unsigned long IP),
+
+       TP_ARGS(bits, entropy_count, IP),
+
+       TP_FIELDS(
+               ctf_integer(int, bits, bits)
+               ctf_integer(int, entropy_count, entropy_count)
+               ctf_integer_hex(unsigned long, IP, IP)
+       )
+)
+#elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,2,0))
 LTTNG_TRACEPOINT_EVENT_MAP(credit_entropy_bits,
 
        random_credit_entropy_bits,
@@ -89,6 +135,38 @@ LTTNG_TRACEPOINT_EVENT_MAP(get_random_bytes,
        )
 )
 
+#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,17,0))
+LTTNG_TRACEPOINT_EVENT_CLASS(random__extract_entropy,
+       TP_PROTO(int nbytes, int entropy_count, unsigned long IP),
+
+       TP_ARGS(nbytes, entropy_count, IP),
+
+       TP_FIELDS(
+               ctf_integer(int, nbytes, nbytes)
+               ctf_integer(int, entropy_count, entropy_count)
+               ctf_integer_hex(unsigned long, IP, IP)
+       )
+)
+
+
+LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(random__extract_entropy, extract_entropy,
+
+       random_extract_entropy,
+
+       TP_PROTO(int nbytes, int entropy_count, unsigned long IP),
+
+       TP_ARGS(nbytes, entropy_count, IP)
+)
+
+LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(random__extract_entropy, extract_entropy_user,
+
+       random_extract_entropy_user,
+
+       TP_PROTO(int nbytes, int entropy_count, unsigned long IP),
+
+       TP_ARGS(nbytes, entropy_count, IP)
+)
+#else
 LTTNG_TRACEPOINT_EVENT_CLASS(random__extract_entropy,
        TP_PROTO(const char *pool_name, int nbytes, int entropy_count,
                 unsigned long IP),
@@ -123,6 +201,7 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(random__extract_entropy, extract_entropy_use
 
        TP_ARGS(pool_name, nbytes, entropy_count, IP)
 )
+#endif
 
 
 
This page took 0.0282 seconds and 4 git commands to generate.