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

Reland "[FIRRTL][LowerClass] Pre-allocate namespaces before capturing refs (#7102)". #7328

Merged
merged 1 commit into from
Jul 16, 2024

Conversation

mikeurbach
Copy link
Contributor

This was originally added to avoid a use-after-free. However, it got removed as part of f4920aa. It seems this is still required, even when we process PathTrackers sequentially. I confirmed there was a use-after-free without this change, which is fixed after adding this back.

Closes #7327.

… refs (#7102)".

This was originally added to avoid a use-after-free. However, it got
removed as part of f4920aa. It seems this is still required, even when
we process PathTrackers sequentially. I confirmed there was a
use-after-free without this change, which is fixed after adding this
back.

Closes #7327.
Copy link
Contributor

@dtzSiFive dtzSiFive left a comment

Choose a reason for hiding this comment

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

LGTM, especially if its fixes the issue found.

Doing this lazily is nice, although perhaps as we lean more on these things we're likely to need this for all modules anyway.

I'd like to root this out a bit more thoroughly (is there a move constructor missing? maybe the collection uses unique_ptr's? or just a comment?) but this looks correct and reliable way to fix this with what we have now, thanks!

@mikeurbach
Copy link
Contributor Author

Yeah, I will say that I haven't yet dug more deeply into this, just confirmed that @uenoku's original fix here does fix the issue we see in single threaded PathTracker processing. I'll go ahead and merge this for now so main is clean.

@mikeurbach mikeurbach merged commit de80eb4 into main Jul 16, 2024
4 checks passed
@mikeurbach mikeurbach deleted the mikeurbach/lower-classes-uaf branch July 16, 2024 21:06
@mikeurbach
Copy link
Contributor Author

Opened the linked ticket to continue the investigation: #7329

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.

[FIRRTL] Crash in LowerClasses related to StringMap buckets
2 participants