use shared buffer for retrieving random bytes #5444
Conversation
0c342d0 to
8d2b2b6
Compare
|
Needs tests for the new utility |
0aeedfc to
cd9aa70
Compare
CodSpeed Performance ReportMerging #5444 will not alter performanceComparing Summary
Footnotes
|
cd9aa70 to
d8f1256
Compare
|
This design based on This should use a Then we can replace all the This makes the change light-touch with no need to change any design around |
d8f1256 to
4642d32
Compare
kentonv
left a comment
There was a problem hiding this comment.
OK, this now looks pretty good to me but I wonder if we should check in with a security person to be extra-sure we aren't doing something bad here -- random number generation problems can be catastrophic for crypto.
@mschwarzl what do you think?
4642d32 to
63ec89a
Compare
|
Point raised from the security team: is forking an issue here? Specifically, if the process is forked after the cache is populated, the cache for the current thread will be duplicated in the fork. We either need to (a) require that the cache is only populated after forking happens or (b) refresh the cache when forking happens. |
FWIW, since this code is most likely invoked in the sandbox, it shouldn't be forking. We avoid forking in a process that already has additional threads, since another thread could be holding locks that would never release in the new process. In the past, this has typically manifested as "interrupt" signals in tcmalloc functions. |
|
This code should be called strictly post-fork, but we should nevertheless add some debug checks to verify that the value returned by We should skip these checks in release builds as |
63ec89a to
f7310ec
Compare
|
Applied the pid check, rebased and force pushed. |
f7310ec to
0d8310f
Compare
0d8310f to
f69afd4
Compare
Another take to #5442 which should be a lot faster since we're basically caching now.