-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Mitigation enforcement #3855
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
base: master
Are you sure you want to change the base?
Mitigation enforcement #3855
Conversation
2a83ea5
to
52f7403
Compare
FYI: Your rendered link doesn't work because you updated the filename in the URL to account for the PR number, but didn't actually update the filename in the code itself. |
52f7403
to
1305c42
Compare
Fixed |
text/3855-mitigation-enforcement.md
Outdated
For example, with `-C stack-protector`, the compatibility table will be | ||
as follows: | ||
|
||
| Base\Child | none | none-noenforce | strong | strong-noenforce | all | all-noenforce | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you use the words "dependency" instead of "child" here and above? Child is not a word we generally use for crate relationships which makes it a bit confusing
and vulnerabilities. | ||
|
||
Mitigations are generally enabled by passing a flag to the compiler (for | ||
example, [`-Z harden-sls`] or [`-Z stack-protector`]). If the compilation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You always talk about stack-protector here, since that's your primary motivation of course, but I think it would be good to more explicitly list out all kinds of mitigations that Rust has it that people would like Rust to have in the future, to ensure that this makes sense for all of them (for example, the ones from https://doc.rust-lang.org/nightly/rustc/exploit-mitigations.html#exploit-mitigations-1).
I would especially be interested in whether there are existing stable mitigations that would like to make use of this, especially if it has a flag to toggle it.
Some projects may already have tooling to check certain things are as expected, e.g. |
I mentioned hardening-check. If you have experience with objtool, you can add that as well. I also couldn't find any documentation for objtool used as a hardening check tool, so if you could provide me some I would try to include it. |
The docs are here: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/tools/objtool/Documentation/objtool.txt I mentioned |
So it looks like it works on a per- Is that right?
I do think that the big difference is "tool that works on .o files vs. tool that works on executables", since if the tool needs |
3af6d94
to
3f7188b
Compare
I don't think the
Anyway, none of the above really matters -- I mentioned Thanks for working on this! |
If there was a "magic" analyzer that would reliably do the sanitizer enforcement, there would be much less need for it as a compiler flag. As far as I can tell, the existing analyzers either have large holes or require significant project-specific intervention. That of course does not mean they are not useful, only that they don't automatically solve the problem for everyone. |
Not sure if there is a disagreement here, but just in case: I didn't claim there is a "magic" analyzer out there solving this. Quite the contrary -- I said that even if such a tool existed that covered everything, having an independent check at another layer like this RFC proposes would still be useful. The |
library only comes with a single set of enabled mitigations per target. | ||
|
||
Mitigation enforcement should be disableable by the end-user via a compiler | ||
flag. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's be cool if this was somehow per dependency, like maybe you'd add some disable-mitigation-enforcement = {std}
into the binary's Cargo.toml.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's be cool if this was somehow per dependency, like maybe you'd add some disable-mitigation-enforcement = {std} into the binary's Cargo.toml.
You probably want something in the style of -C allow-partial-mitigations=stack-protector=std+alloc+core
, so you know which mitigations you are allowing.
(Of course, with also a syntax in Cargo, which should come with a separate RFC I think).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added that to alternatives
Zulip: https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/Mitigation.20enforcement.20.28.60-C.20allow-partial-mitigations.60.29/with/539293124
Rendered