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

curve25519-dalek-derive performs unsound hiding of unsafety #563

Open
Ralith opened this issue Aug 17, 2023 · 3 comments
Open

curve25519-dalek-derive performs unsound hiding of unsafety #563

Ralith opened this issue Aug 17, 2023 · 3 comments

Comments

@Ralith
Copy link

Ralith commented Aug 17, 2023

Consider a documented example: the simd_avx512ifma::func() function is marked as safe, but will invoke undefined behavior if called when the corresponding target feature is missing.

This could be mitigated through an assert for the presence of the target feature before invoking the inner function (which should optimize out when called from a typical dispatch function), or by marking the function unsafe and documenting the requirements imposed upon callers.

This is not directly a hazard to consumers of curve25519-dalek itself, to whom specialized functions are presumably not directly exposed, but complicates auditing and may present a maintenance hazard.

@tarcieri
Copy link
Contributor

This seems difficult to fix without making breaking changes

@Ralith
Copy link
Author

Ralith commented Feb 12, 2024

An assert as described above would fix this without a breaking change. Fixing unsoundness is a pretty good reason to break compatibility, though!

@burdges
Copy link
Contributor

burdges commented Feb 12, 2024

I suppose rust-lang/rust#120930 means breakage here anyways, but likely addresses this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants