-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Take advantage of AT_RANDOM for seeding the PRNG #8173
Conversation
Restores some code from 53987c9. - Avoid calling the Gimli permute function so we don't pull Gimli into every executable. - Add an opt-out in the form of root.use_AT_RANDOM_auxval
I still feel like this is not a good idea. Or, maybe the switch should be set to If If our Zig code is used as a library, an application may also have cleared it before. This also constrains us to a 128 bit seed. Which is fine, but 256 bit doesn't hurt, especially with a new and non-ideal permutation. |
The code is only run when zig is the entrypoint: the call site is inside of
See: // don't use AT_RANDOM if it has been zeroed out
if (mem.allEqual(u8, ptr, 0)) return; Though due to the aforementioned reason, this should never be hit by "normal" code. |
Also, clearing it is nice, but with SSP turned on, a copy is still present. |
That doesn't address the issue of libraries possibly using |
oh? howso/where?
|
What's the problem you're trying to solve here? The default state for the TLSPRNG is set to |
Isn't this in The stack canary has to persist somewhere till the end of the process. And if what we clear is not a copy, this kinda defeats the purpose of SSP. But I may be completely wrong here; this is in a glibc context, maybe we don't even support SSP otherwise. Still, that change doesn't make me comfortable at all and I'm not convinced that it solves any actual problem. UPDATE: Quick note on canaries. On x86_64 anything compiled with stack protection expects the canary (a copy of the But when we don't link with libc, we currently don't initialize this, ending up with an all zero canary, making stack protection useless. |
hmmm. I didn't know this. Where is this documented? |
Restores some code from 53987c9/#7482
root.use_AT_RANDOM_auxval