[PATCH] D56125: [Sanitizer] Intercept arc4random_buf on FreeBSD/NetBSD

Kamil Rytarowski via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 28 06:06:38 PST 2018


krytarowski added inline comments.


================
Comment at: test/sanitizer_common/TestCases/Posix/arc4random.cc:18
+  for (auto i = 0; i < sizeof(buf); i ++)
+    printf("%" PRIx8, buf[i]);
+  printf("'\n");
----------------
Maybe we want to cast buf[i] to (unsigned char) due to int promotion rules.

Please add calls of arc4random, arc4random_uniform, arc4random_stir in the tests too, just in case that would trigger interceptors inside libc and cause false positives.

This might make harm on NetBSD, as there are installed interceptors for functions like `SHA256_Update`.

Can you also add two types of tests with a short buffer (like 10 elements) and another with 128 elements? There are used different algorithms internally at least on NetBSD for each case.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56125/new/

https://reviews.llvm.org/D56125





More information about the llvm-commits mailing list