Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upAn in-memory RNG that shares its file descriptor. #14351
Conversation
highfive
commented
Nov 23, 2016
|
Heads up! This PR modifies the following files:
|
highfive
commented
Nov 23, 2016
|
cc @ConnorGBrewster @larsbergstrom @nox |
|
@avadacatavra this replaces the RNG in crypto. We should double-check that we are okay with that. |
|
FWIW, rayon uses |
|
We don't scan dependency source, so it's difficult to see how we can do much better than a whitelist. |
|
That's quite a lot of code. I would rather we use the |
|
@nox: yes, we can use Fnv for hash maps, but that doesn't help for uuids or other cases where we need an RNG, not a hash function. Most of the code here is just cut-and-paste from |
|
|
ae888f8
to
5f79e29
|
|
5f79e29
to
a25da00
|
|
a25da00
to
91ce41f
|
|
dc05dda
to
1026d4d
|
Rebased. |
|
|
1026d4d
to
f2248e4
|
|
|
This is fine for me when rebased, but maybe @nox has still concerns. |
| @@ -81,6 +81,24 @@ | |||
| " accessible to\n// web pages." | |||
| ] | |||
|
|
|||
| WHITELISTED_DEPENDENCIES = { | |||
This comment has been minimized.
This comment has been minimized.
wafflespeanut
Jan 5, 2017
Member
We should really be moving this to the config file, but that shouldn't be a concern for this PR. I'll take care of it in an easy issue
|
IRC conversation with @nox: http://logs.glob.uno/?c=mozilla%23servo&s=5+Jan+2017&e=5+Jan+2017#c587629 TL;DR he r+s once it's split into two commits, and |
f2248e4
to
70ffe1f
70ffe1f
to
e3a8e3b
|
@bors-servo r=emilio |
|
|
An in-memory RNG that shares its file descriptor. <!-- Please describe your changes on the following line: --> This PR implements an in-memory random number generator that only uses an OS RNG for (re)seeding. The OS RNG is shared, so there's only one file descriptor for `/dev/urandom` being used. The PR also implements a tidy check that we don't accidentally introduce an RNG. Rather annoyingly, there are a lot of transitive dependencies on `rand`, notably hash maps in `std`. This PR makes it possible to use uuids for identifiers such as pipeline and frame ids. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes do not require tests because it's fixing a resource issue <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/14351) <!-- Reviewable:end -->
|
|
This comment has been minimized.
This comment has been minimized.
dhardy
commented on 7ace30f
Jan 14, 2018
|
@asajeffrey can you tell me what the motivation for this is? I'm working on improving |
This comment has been minimized.
This comment has been minimized.
|
The motivation was the frequency with which Service would run out of file descriptors during tests. I don't recall seeing that problem since making this change |
This comment has been minimized.
This comment has been minimized.
|
Servo, not Service. |
This comment has been minimized.
This comment has been minimized.
|
@dhardy, sharing the OS RNG among threads, to avoid running out of FDs, but only using the shared RNG for reseeding, to avoid lock contention. |
asajeffrey commentedNov 23, 2016
•
edited
This PR implements an in-memory random number generator that only uses an OS RNG for (re)seeding. The OS RNG is shared, so there's only one file descriptor for
/dev/urandombeing used.The PR also implements a tidy check that we don't accidentally introduce an RNG. Rather annoyingly, there are a lot of transitive dependencies on
rand, notably hash maps instd.This PR makes it possible to use uuids for identifiers such as pipeline and frame ids.
./mach build -ddoes not report any errors./mach test-tidydoes not report any errorsThis change is