[PATCH] D36399: [sanitizers] Add a blocking boolean to GetRandom prototype

Aleksey Shlyapnikov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 11 07:53:03 PDT 2017

alekseyshl accepted this revision.
alekseyshl added inline comments.
This revision is now accepted and ready to land.

Comment at: lib/sanitizer_common/sanitizer_linux.cc:1685
+#  define GRND_NONBLOCK 1
+# endif
   static atomic_uint8_t skip_getrandom_syscall;
cryptoad wrote:
> alekseyshl wrote:
> > Can you move those defines to the top of the file and define SANITIZER_USE_GETRANDOM? Then here you can do 
> > 
> >     ...
> >   }
> So the compiler still wants `SYSCALL(getrandom)` and `GRND_NONBLOCK` to be defined with an `if` rather than an `#if`.
> I am unsure how to cleanly address that. Macroing the internal_syscall part to do nothing?
You're right, this is not ideal too. Yep, let's keep #if SANITIZER_LINUX && defined(__NR_getrandom) block at the top of the file and use #if SANITIZER_USE_GETRANDOM here to avoid internal_getrandom definition. Other than that, looks good. Sorry for the delay!


More information about the llvm-commits mailing list