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

Update to use safe nonces #285

Merged
merged 8 commits into from
Jul 17, 2019
Merged

Update to use safe nonces #285

merged 8 commits into from
Jul 17, 2019

Conversation

robdockins
Copy link
Contributor

This update changes the HandleAllocator to use the global nonce generator from Data.Parameterized.Nonce, instead of creating a fresh nonce counter from Data.Parameterized.Nonce.Unsafe.

This changes requires the handle allocation to occur in IO, which is fine since we are already basically in IO everywhere we needed to be anyway, and this simplifies quite a few things.

This PR will require downstream fixes, but they are very straightforward.

Will fix #284

the `globalNonceGenerator` instead of generating new counters.
This avoids the potential for mixing nonces from different generators,
which has caused a variety of memory safety problems in the past.

As a result, fresh handles are created in IO rather than ST.
This mostly simplifies things, however, as creating fresh handles
was basically always done under `stToIO` anyway.
mostly involves replacing `ST` with `IO` in a variety of places.
This mostly involves replacing ST with IO in various places.
This mostly involves replacing ST with IO in various places
@robdockins robdockins requested a review from kquick July 15, 2019 20:27
Copy link
Member

@kquick kquick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

@@ -674,14 +671,9 @@ printSyntaxError (SyntaxError rs) =
, ", expected ", T.intercalate " or " (nub $ sort [ wanted | Reason _ wanted <- r:more ])
, " but got ", toText mempty found]

-- | Invoke the default parsing monad on a piece of syntax, returning
-- the first success found, or the error(s) with the greatest progress
-- otherwise.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we keep this haddock for syntaxParseIO?

@robdockins robdockins merged commit 847bd2d into master Jul 17, 2019
kquick added a commit to GaloisInc/macaw that referenced this pull request Jul 19, 2019
Update for compatibility with Crucible changes in
GaloisInc/crucible#285.
kquick added a commit to GaloisInc/macaw that referenced this pull request Jul 19, 2019
Changes for compatibility with Crucible pull request
285 (GaloisInc/crucible#285) and the
corresponding changes in macaw symbolic.
kquick added a commit to GaloisInc/macaw that referenced this pull request Jul 19, 2019
Changes for compatibility with Crucible pull request
285 (GaloisInc/crucible#285) and the
corresponding changes in macaw symbolic.
kquick added a commit to GaloisInc/macaw that referenced this pull request Jul 19, 2019
Changes for compatibility with Crucible pull request
285 (GaloisInc/crucible#285) and the
corresponding changes in macaw symbolic.
kquick added a commit to GaloisInc/macaw that referenced this pull request Jul 19, 2019
Changes for compatibility with Crucible pull request
285 (GaloisInc/crucible#285) and the
corresponding changes in macaw symbolic.
kquick added a commit to GaloisInc/renovate that referenced this pull request Jul 22, 2019
Changes for compatibility with Crucible pull request
285 (GaloisInc/crucible#285) and the
corresponding changes in macaw symbolic.
@langston-barrett langston-barrett deleted the rwd/nonces branch July 24, 2019 22:21
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.

HandleAllocator is unsafe
2 participants