Skip to content

[LTO] Fix a use-after-free in legacy LTO C APIs #107896

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

Conversation

cachemeifyoucan
Copy link
Collaborator

Fix a bug that lto_runtime_lib_symbols_list is returning the address
of a local variable that will be freed when getting out of scope. This
is a regression from #98512 that rewrites the runtime libcall function
lists into a SmallVector.

rdar://135559037

Created using spr 1.3.5
Copy link
Contributor

@jhuber6 jhuber6 left a comment

Choose a reason for hiding this comment

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

Thanks, I totally forgot about the C API when this was done unfortunately.

@cachemeifyoucan
Copy link
Collaborator Author

Thanks, I totally forgot about the C API when this was done unfortunately.

No worries. We kind of lack a bit test coverage in legacy API and it doesn't seem to be a good investment to fix that now.

@cachemeifyoucan cachemeifyoucan merged commit 66e9078 into main Sep 9, 2024
9 checks passed
@cachemeifyoucan cachemeifyoucan deleted the users/cachemeifyoucan/spr/lto-fix-a-use-after-free-in-legacy-lto-c-apis branch September 9, 2024 21:12
cachemeifyoucan added a commit to cachemeifyoucan/llvm-project that referenced this pull request Sep 9, 2024
Fix a bug that `lto_runtime_lib_symbols_list` is returning the address
of a local variable that will be freed when getting out of scope. This
is a regression from llvm#98512 that rewrites the runtime libcall function
lists into a SmallVector.

rdar://135559037
(cherry picked from commit 66e9078)
cachemeifyoucan added a commit to swiftlang/llvm-project that referenced this pull request Sep 9, 2024
Fix a bug that `lto_runtime_lib_symbols_list` is returning the address
of a local variable that will be freed when getting out of scope. This
is a regression from llvm#98512 that rewrites the runtime libcall function
lists into a SmallVector.

rdar://135559037
(cherry picked from commit 66e9078)
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.

2 participants