Skip to content

[2025H1] Propose a null and alignment checks goal #162

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

Closed
wants to merge 1 commit into from

Conversation

1c3t3a
Copy link
Member

@1c3t3a 1c3t3a commented Nov 28, 2024

@RalfJung
Copy link
Member

RalfJung commented Nov 28, 2024 via email

@1c3t3a
Copy link
Member Author

1c3t3a commented Nov 28, 2024

Oh I didn't see that! I could pivot this goal to something different in the area? E.g. around pointer arithmetics or checking enum discriminants?

@saethlin
Copy link
Member

Aye, we already have checks for reads/writes through misaligned pointers and those have been on stable for a long time. The MIR transform that implements that could be extended to catch reads/writes to null but I suspect that will be very low-yield because on most hosted systems, that operation will fault anyway.

In addition, the standard library has runtime checks for invalid pointer offsets starting in 1.83 which is stable today.

I have prototyped something like invalid enum discriminants here: rust-lang/rust#121174. I'm sure the PR needs work to just get it to build. I was going for a more general approach of checking all niches not just enums, and that mostly emits a lot of checks for references being null, so maybe targeting enums only is the way.

This goals PR seems well-intentioned, but I'm surprised to see it so disconnected from our current state. I would be happy to collaborate on sketching out a coherent story for our hodgepodge of runtime UB checks, but I'm a bit busy this week and next.

@1c3t3a
Copy link
Member Author

1c3t3a commented Nov 29, 2024

I would be happy to collaborate on sketching out a coherent story for our hodgepodge of runtime UB checks, but I'm a bit busy this week and next.

I would like to collaborate on this! I send you a message on Zulip to discuss this further.

For this goal: I'd love to pivot it to something helpful regarding runtime checks, so probably update it after having synced with @saethlin.

@nikomatsakis
Copy link
Contributor

@1c3t3a ok, I'll hold off on merging until you and @saethlin align on the right description.

@nikomatsakis
Copy link
Contributor

I haven't heard anything here, I'm going to close this PR as the initial deadline for goals has passed and I don't think it's ready to merge -- please feel free to re-open once you've got a consensus plan in place (although time IS running out...).

@1c3t3a
Copy link
Member Author

1c3t3a commented Dec 4, 2024

I actually pivoted the proposal here and just uploaded the new version. I was waiting for @saethlin's feedback but I think I can work that in later as well. The new PR is: #177. I hope I am not too late, sorry for the delay!

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

Successfully merging this pull request may close these issues.

5 participants