summaryrefslogtreecommitdiff
path: root/src/basic
diff options
context:
space:
mode:
authorEvgeny Vereshchagin <evvers@ya.ru>2018-11-10 09:10:49 +0100
committerLennart Poettering <lennart@poettering.net>2018-11-10 11:58:09 +0100
commit313992dfb58ab0ca2d1ab33a3f450fd772069605 (patch)
tree78fea9865cc03eb504333c5614ae05cb9d3d1efa /src/basic
parentb0395ac5cdce48af0d946f5d107e2f794c2ecf43 (diff)
downloadsystemd-313992dfb58ab0ca2d1ab33a3f450fd772069605.tar.gz
systemd-313992dfb58ab0ca2d1ab33a3f450fd772069605.tar.bz2
systemd-313992dfb58ab0ca2d1ab33a3f450fd772069605.zip
basic: make rdrand64 a little bit more MSAn-friendly
MSan doesn't instrument inline asm calls so let's help it by marking err as initialized manually. Fixes: https://github.com/systemd/systemd/issues/10714.
Diffstat (limited to 'src/basic')
-rw-r--r--src/basic/random-util.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/basic/random-util.c b/src/basic/random-util.c
index 8eb6acfbbf..c17c09765b 100644
--- a/src/basic/random-util.c
+++ b/src/basic/random-util.c
@@ -30,6 +30,9 @@
#include "random-util.h"
#include "time-util.h"
+#if HAS_FEATURE_MEMORY_SANITIZER
+#include <sanitizer/msan_interface.h>
+#endif
int rdrand64(uint64_t *ret) {
@@ -56,6 +59,11 @@ int rdrand64(uint64_t *ret) {
"setc %1"
: "=r" (*ret),
"=qm" (err));
+
+#if HAS_FEATURE_MEMORY_SANITIZER
+ __msan_unpoison(&err, sizeof(err));
+#endif
+
if (!err)
return -EAGAIN;