Skip to content
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

Prepare for strict provenance in the Default implementations. #34

Closed
V0ldek opened this issue Jul 4, 2022 · 1 comment
Closed

Prepare for strict provenance in the Default implementations. #34

V0ldek opened this issue Jul 4, 2022 · 1 comment
Labels
enhancement New feature or request go ahead Reviewed, implementation can start good first issue Good for newcomers help wanted Extra attention is needed

Comments

@V0ldek
Copy link
Owner

V0ldek commented Jul 4, 2022

Strict provenance is an attempt on bringing sanity to pointers. It is tracked here. We are already enabling Miri's -Zmiri-strict-provenance flag to catch mistakes, which is pretty useful, since the API dabbles with raw pointers. It caught the Default bug in the first place #11 .

Miri checks now fail, since the fix for #11 introduced an integer-to-pointer cast in https://github.com/V0ldek/aligners/blob/main/src/bytes.rs#L264. This should be relatively easy to fix -- just use conditional compilation with cfg to see if the strict_provenance feature is enabled, and if yes use the new API. When SP is stabilised, this will be the new implementation anyway.

This is the only place in which we do magic with raw integers, since it's a zero-sized allocation, which AFAIK has to be magic.

@V0ldek V0ldek added enhancement New feature or request help wanted Extra attention is needed good first issue Good for newcomers go ahead Reviewed, implementation can start labels Jul 4, 2022
@V0ldek V0ldek assigned V0ldek and unassigned V0ldek Jul 4, 2022
@V0ldek
Copy link
Owner Author

V0ldek commented Jul 4, 2022

Actually, the polyfill crate might be an easier change: https://crates.io/crates/sptr

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request go ahead Reviewed, implementation can start good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant