Generate checks for all forms of UB in Debug and ReleaseSafe modes
It's always going to be possible to do unsafe things in Zig, because we have inline assembly, `@intToPtr`, and ability to call extern functions with the wrong ABI. But what if we could eliminate everything else? What if, after enumerating all kinds of undefined behavior (See #1966), we could make all of them safety-checked, with only some obvious exceptions such as inline assembly? * even `@intToPtr` could look at the type it was casting to and make sure it is correct, somehow? * runtime safety for pointer lifetimes? can we solve use-after-free? This is the big one. * try to solve everything on the list turned up by #1966. This might turn out to be impossible or impractical, but it's worth investigating. If we could reduce the unchecked undefined behavior surface to a minimum level, there could be auditing/linting tools to point out where unsafety lies in zig software. It would be possible to say something like, "Debug and ReleaseSafe builds of Zig code are safe (in that they crash rather than have undefined behavior), except for inline assembly and extern function ABI mismatch", or some short list of exceptions. If the cost of these protections is high, that's what we have `@setRuntimeSafety` for (see #978). It would be reasonable for these protections to depend on OS-specific behavior, and to be unavailable on some targets, such as freestanding.
Posted by andrewrk on Apr 18, 2019, 5:07 AM
Tags
Related issues
- IMO it's a bit more nuanced than what the author portrays it as.
- In the UK Amazon have now raised the price of general shipping to be 2/3 the price of a months prime subscription.
- Credit where credit is due, critics claiming "[Apple device] is too expensive for something that just does [basic function]" have been pr...
- I like to buy music.
- Meet K-Claw.
- Fable is way too expensive for basic software stuff.
Raise real-world problems, find people facing the same issue, and discuss solutions.4,000 issues0 comments
pricing (SaaS)
IMO it's a bit more nuanced than what the author portrays it as.
NewIn the UK Amazon have now raised the price of general shipping to be 2/3 the price of a months prime subscription.
Credit where credit is due, critics claiming "[Apple device] is too expensive for something that just does [basic function]" have been pr...
I like to buy music.
Meet K-Claw.
Fable is way too expensive for basic software stuff.
[Meta] Abnormal Codex usage/quota depletion and usage-accounting inconsistencies — cross-report tracker
[FEATURE] Passkey (WebAuthn) sign-in for Claude accounts, across every surface
Generate checks for all forms of UB in Debug and ReleaseSafe modes
It's always going to be possible to do unsafe things in Zig, because we have inline assembly, `@intToPtr`, and ability to call extern functions with the wrong ABI. But what if we could eliminate everything else? What if, after enumerating all kinds of undefined behavior (See #1966), we could make all of them safety-checked, with only some obvious exceptions such as inline assembly? * even `@intToPtr` could look at the type it was casting to and make sure it is correct, somehow? * runtime safety for pointer lifetimes? can we solve use-after-free? This is the big one. * try to solve everything on the list turned up by #1966. This might turn out to be impossible or impractical, but it's worth investigating. If we could reduce the unchecked undefined behavior surface to a minimum level, there could be auditing/linting tools to point out where unsafety lies in zig software. It would be possible to say something like, "Debug and ReleaseSafe builds of Zig code are safe (in that they crash rather than have undefined behavior), except for inline assembly and extern function ABI mismatch", or some short list of exceptions. If the cost of these protections is high, that's what we have `@setRuntimeSafety` for (see #978). It would be reasonable for these protections to depend on OS-specific behavior, and to be unavailable on some targets, such as freestanding.
Comments (0)
No comments yet. Start the discussion.