- Intercept the native apple (both iOs and macOS) which is even allowed on App Store (contrary to getentropy for example), thus checking its proper usage in code consumers.
Details
- Reviewers
yln delcypher aralisza eugenis vitalybuka
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Hi David, thanks for the patch for this previously unintercepted API. I am happy with the interceptor implementation itself; it follows our "recipe" nicely! :)
I have two small asks:
- In the commit message, can you explain which issue (crash, false positive) for which sanitizer this is addressing?
- Can we write a test that shows this issue? I think the current test only shows that we don't crash, right?
compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc | ||
---|---|---|
7246 | Nitpick: can we use the parameter names "bytes" and "count" from the header declaration? CCRNGStatus CCRandomGenerateBytes(void *bytes, size_t count) __OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_8_0); | |
compiler-rt/test/sanitizer_common/TestCases/Darwin/ccrandomgeneratebytes.c | ||
1 | Are we testing here simply that we don't crash in our interceptor? Can we add a comment what we intend to test here. | |
4 | I don't think this will work as intended. We would try to compile and run an empty file. | |
12 | I don't think we will ever return "false", i.e., failing the test here? success -> n = 0 failure -> n = 1 return n <= 0 // n is never <= 0, right?! Maybe just return the return value of CCRandomGenerateBytes() (assuming kCCSuccess is 0)? |
compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc | ||
---|---|---|
9836–9845 | Why this renaming? As it it matches https://man7.org/linux/man-pages/man2/getrandom.2.html |
It's titled "Intercept CCRandomGenerateBytes", but I don't see changes in interceptors, only new test.
compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc | ||
---|---|---|
9836–9845 | My bad wrong lines. |
Hi David,
Before I approve this can we do the following?
- In the commit message, can you explain which issue (crash, false positive) for which sanitizer this is addressing?
- Can we write a test that shows this issue, i.e., a test that fails without the added interceptor? (Maybe this test needs to be for a specific sanitizer instead of sanitizer_common?)
Note: my understanding is that the added test is "green" even without the new interceptor. Ignore my second point if that is not the case.
Nitpick: can we use the parameter names "bytes" and "count" from the header declaration?