]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/blob
9159e62119951fb912c2dd7eb295ae2673d8a8f2
[thirdparty/openembedded/openembedded-core-contrib.git] /
1 From 98b7729a776bc5babb39345eeeba3cd1f60d8c9a Mon Sep 17 00:00:00 2001
2 From: Michael Jeanson <mjeanson@efficios.com>
3 Date: Wed, 26 Jan 2022 14:53:41 -0500
4 Subject: [PATCH 5/7] fix: random: rather than entropy_store abstraction, use
5 global (v5.17)
6
7 See upstream commit :
8
9 commit 90ed1e67e896cc8040a523f8428fc02f9b164394
10 Author: Jason A. Donenfeld <Jason@zx2c4.com>
11 Date: Wed Jan 12 17:18:08 2022 +0100
12
13 random: rather than entropy_store abstraction, use global
14
15 Originally, the RNG used several pools, so having things abstracted out
16 over a generic entropy_store object made sense. These days, there's only
17 one input pool, and then an uneven mix of usage via the abstraction and
18 usage via &input_pool. Rather than this uneasy mixture, just get rid of
19 the abstraction entirely and have things always use the global. This
20 simplifies the code and makes reading it a bit easier.
21
22 Upstream-Status: Backport [lttng-modules commit 98b7729a776bc5babb39345eeeba3cd1f60d8c9a]
23
24 Change-Id: I1a2a14d7b6e69a047804e1e91e00fe002f757431
25 Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
26 Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
27 ---
28 include/instrumentation/events/random.h | 81 ++++++++++++++++++++++++-
29 1 file changed, 80 insertions(+), 1 deletion(-)
30
31 diff --git a/include/instrumentation/events/random.h b/include/instrumentation/events/random.h
32 index ed05d26a..8cc88adb 100644
33 --- a/include/instrumentation/events/random.h
34 +++ b/include/instrumentation/events/random.h
35 @@ -8,6 +8,36 @@
36 #include <lttng/tracepoint-event.h>
37 #include <linux/writeback.h>
38
39 +#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,17,0))
40 +LTTNG_TRACEPOINT_EVENT_CLASS(random__mix_pool_bytes,
41 + TP_PROTO(int bytes, unsigned long IP),
42 +
43 + TP_ARGS(bytes, IP),
44 +
45 + TP_FIELDS(
46 + ctf_integer(int, bytes, bytes)
47 + ctf_integer_hex(unsigned long, IP, IP)
48 + )
49 +)
50 +
51 +LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(random__mix_pool_bytes, mix_pool_bytes,
52 +
53 + random_mix_pool_bytes,
54 +
55 + TP_PROTO(int bytes, unsigned long IP),
56 +
57 + TP_ARGS(bytes, IP)
58 +)
59 +
60 +LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(random__mix_pool_bytes, mix_pool_bytes_nolock,
61 +
62 + random_mix_pool_bytes_nolock,
63 +
64 + TP_PROTO(int bytes, unsigned long IP),
65 +
66 + TP_ARGS(bytes, IP)
67 +)
68 +#else
69 LTTNG_TRACEPOINT_EVENT_CLASS(random__mix_pool_bytes,
70 TP_PROTO(const char *pool_name, int bytes, unsigned long IP),
71
72 @@ -37,8 +67,24 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(random__mix_pool_bytes, mix_pool_bytes_noloc
73
74 TP_ARGS(pool_name, bytes, IP)
75 )
76 +#endif
77
78 -#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,2,0))
79 +#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,17,0))
80 +LTTNG_TRACEPOINT_EVENT_MAP(credit_entropy_bits,
81 +
82 + random_credit_entropy_bits,
83 +
84 + TP_PROTO(int bits, int entropy_count, unsigned long IP),
85 +
86 + TP_ARGS(bits, entropy_count, IP),
87 +
88 + TP_FIELDS(
89 + ctf_integer(int, bits, bits)
90 + ctf_integer(int, entropy_count, entropy_count)
91 + ctf_integer_hex(unsigned long, IP, IP)
92 + )
93 +)
94 +#elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,2,0))
95 LTTNG_TRACEPOINT_EVENT_MAP(credit_entropy_bits,
96
97 random_credit_entropy_bits,
98 @@ -89,6 +135,38 @@ LTTNG_TRACEPOINT_EVENT_MAP(get_random_bytes,
99 )
100 )
101
102 +#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,17,0))
103 +LTTNG_TRACEPOINT_EVENT_CLASS(random__extract_entropy,
104 + TP_PROTO(int nbytes, int entropy_count, unsigned long IP),
105 +
106 + TP_ARGS(nbytes, entropy_count, IP),
107 +
108 + TP_FIELDS(
109 + ctf_integer(int, nbytes, nbytes)
110 + ctf_integer(int, entropy_count, entropy_count)
111 + ctf_integer_hex(unsigned long, IP, IP)
112 + )
113 +)
114 +
115 +
116 +LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(random__extract_entropy, extract_entropy,
117 +
118 + random_extract_entropy,
119 +
120 + TP_PROTO(int nbytes, int entropy_count, unsigned long IP),
121 +
122 + TP_ARGS(nbytes, entropy_count, IP)
123 +)
124 +
125 +LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(random__extract_entropy, extract_entropy_user,
126 +
127 + random_extract_entropy_user,
128 +
129 + TP_PROTO(int nbytes, int entropy_count, unsigned long IP),
130 +
131 + TP_ARGS(nbytes, entropy_count, IP)
132 +)
133 +#else
134 LTTNG_TRACEPOINT_EVENT_CLASS(random__extract_entropy,
135 TP_PROTO(const char *pool_name, int nbytes, int entropy_count,
136 unsigned long IP),
137 @@ -123,6 +201,7 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(random__extract_entropy, extract_entropy_use
138
139 TP_ARGS(pool_name, nbytes, entropy_count, IP)
140 )
141 +#endif
142
143
144
145 --
146 2.19.1
147