Comments (6)
The above is an exaggeration because in almost every target architecture, a function pointer will never be 1
, and we have const UNINIT: *mut c_void = 1 as *mut c_void;
since functions are almost often required to be aligned on even addresses, and also the lowest word of the address space is often reserved for allowing such things.
from getrandom.
Note that #427 changes UNINIT
from 1
to usize::MAX
. It should make the "inefficient" scenario even less likelier.
from getrandom.
One other thing to note: calling libc::dlsym(RTLD_DEFAULT, ...)
(or GetProcAddress
on Windows) inside a sandbox probably works just fine, provided the symbol you are looking up has already had its dynamic library loaded. Generally, it's things like libc::dlopen
(or LoadLibrary
on Windows) which cause issues as they load new code into a process. Things like lazy loading can complicate this, but that generally doesn't apply to libc
.
So I think the current implementation is fine, even if the first call to getrandom
was within a sandbox. In order to even call dlsym
, libc.so
will already have to be loaded, so the call to dlsym
will either succeed if the symbol is present in libc, or fail otherwise.
from getrandom.
I agree with @josephlr and think that we can close this issue.
from getrandom.
Related Issues (20)
- Failed to build for wasm32-unknown-unknown with no_std HOT 1
- Is the ESPIDF implementation actually correct? HOT 3
- Spurious failures of Web tests on Windows HOT 1
- Port from libc to rustix HOT 7
- Remove file-based RNG fallback on DragonflyBSD HOT 1
- man7 link should be replaced
- The newly updated version "0.2.13" cannot run on mipsel HOT 7
- Error: target is not supported (cargo build-bpf) HOT 2
- Remove fallback logic for FreeBSD
- Investigate removing fallback logic for Solaris/Illumos HOT 1
- Windows: Switch to using ProcessPRNG by default. HOT 31
- `libc` `v0.2.154` yanked HOT 2
- Support `x86_64-unknown-linux-none` HOT 32
- Use VM to run tests
- Release 0.3? HOT 8
- Document and Test that `getrandom()` never panics. HOT 3
- Feature handing changes HOT 2
- API Changes HOT 6
- Run `cargo clippy` in CI for all targets
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from getrandom.