Skip to content

Commit c3e5b7c

Browse files
rmacnak-googleCommit Queue
authored andcommitted
[standalone] Fix Linux Crypto::GetRandomBytes on MSAN.
TEST=msan Change-Id: Ifcf3c2939363eade8fb9e2e169b74a6d102c74a6 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/452908 Reviewed-by: Alexander Aprelev <[email protected]> Commit-Queue: Ryan Macnak <[email protected]>
1 parent ad31812 commit c3e5b7c

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

runtime/bin/crypto_linux.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
#include "bin/crypto.h"
1313
#include "bin/fdutils.h"
14+
#include "platform/memory_sanitizer.h"
1415
#include "platform/signal_blocker.h"
1516

1617
namespace dart {
@@ -55,6 +56,9 @@ bool Crypto::GetRandomBytes(intptr_t count, uint8_t* buffer) {
5556
}
5657
bytes_read += res;
5758
} while (bytes_read < count);
59+
// Not using the libc wrapper `getrandom`, which MSAN is missing an
60+
// interceptor for anyway.
61+
MSAN_UNPOISON(buffer, count);
5862
return true;
5963
}
6064

0 commit comments

Comments
 (0)