Skip to content

Fix unsound var_eq unknown function invalidation #694

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

Merged
merged 5 commits into from
Apr 27, 2022

Conversation

sim642
Copy link
Member

@sim642 sim642 commented Apr 21, 2022

Initially this came up in #618, where a TODO test and commented out possible fix were added. Since those benchmarks ended up not being relevant, we put off fixing the issue.

While analyzing zstd with var_eq I found that the same unsoundness occurs there, making all locking in files other than pool.c dead. This applies the commented out fix from #618 and a couple of others where zstd caused crashes due to the change.

This changes the unknown function invalidation to just use remove like all the other var_eq invalidation. The old algorithm did something weirder: it checked each expression in the local state whether it's reachable from the lvalues reachable from the invalidated variables. I don't recall any more why it was done so, but the change doesn't cause any regressions.
Or is the new invalidation unsound in some different untested way? The extreme solution would be to apply both invalidations in sequence to ensure removal by both, but I'm not sure if we have to go that far.

@sim642 sim642 requested a review from vesalvojdani April 21, 2022 12:16
@sim642 sim642 mentioned this pull request Apr 25, 2022
3 tasks
Copy link
Member

@michael-schwarz michael-schwarz left a comment

Choose a reason for hiding this comment

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

It looks good to me, and I also don't understand why the other invalidation was needed before.

@sim642 sim642 merged commit 8868549 into master Apr 27, 2022
@sim642 sim642 deleted the var_eq-unknown-invalidate branch April 27, 2022 06:16
@sim642 sim642 added this to the v2.0.0 milestone Aug 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants