[PATCH] D56146: [Sanitizer] enable arc4random api on Darwin
David CARLIER via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Dec 29 10:27:26 PST 2018
devnexen marked an inline comment as done.
devnexen added a comment.
https://reviews.llvm.org/D56146
================
Comment at: lib/sanitizer_common/sanitizer_mac.cc:1122-1123
+ int rverrno = 0;
+ if (internal_iserror(rnd, &rverrno) && rverrno == EINVAL)
+ return false;
return true;
----------------
cem wrote:
> # Why would getentropy produce an `EINVAL` code? The only documented errors are EFAULT (depends on `buffer`) and EIO (`length` checks above should prevent). Linux documents an additional ENOSYS code if getrandom is absent, but not EINVAL, AFAIK.
>
> - https://man.openbsd.org/getentropy.2
> - http://man7.org/linux/man-pages/man3/getentropy.3.html
> - https://www.freebsd.org/cgi/man.cgi?query=getentropy&sektion=3&manpath=freebsd-release-ports
>
> (I am unfamiliar with `internal_iserror`; please forgive me if it is expected to squash other errors to `EINVAL` for some reason. :-))
>
> # Why should errors other than `EINVAL` be treated as success conditions?
- It is mac os and getentropy could return EINVAL https://www.manpagez.com/man/2/getentropy/
- I change to getentropy because arc4random_buf call is intercepted with this PR.
Repository:
rCRT Compiler Runtime
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D56146/new/
https://reviews.llvm.org/D56146
More information about the llvm-commits
mailing list