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

[SYCL][ClangLinkerWrapper] Fix read of invalid memory #15472

Merged
merged 1 commit into from
Sep 25, 2024
Merged

Conversation

sarnex
Copy link
Contributor

@sarnex sarnex commented Sep 23, 2024

The problem was the buffer gets freed when we go out of the if because the unique_ptr is created there, so just make a copy that will stay alive as long as we need it. Confirmed fix with valgrind.

This is already tested by sycl/test-e2e/NewOffloadDriver/multisource.cpp and it fails sporadically which led me to this fix.

Signed-off-by: Sarnie, Nick <nick.sarnie@intel.com>
@sarnex sarnex marked this pull request as ready for review September 23, 2024 15:57
@sarnex sarnex requested a review from a team as a code owner September 23, 2024 15:57
// the file.
StringRef UnbundledArchiveList =
Args.MakeArgString((*ObjList)->getBuffer());
UnbundledArchiveList.split(ObjectFilePaths, '\n', /*MaxSplit=*/-1,
Copy link
Contributor

Choose a reason for hiding this comment

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

Where will this variable be used? Not a blocking question.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the review. It's used here, we immediately split it into the ObjectFilePaths vector .

Copy link
Contributor

@asudarsa asudarsa Sep 25, 2024

Choose a reason for hiding this comment

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

Ah..of course..I was naive and was looking for this variable on the RHS of an assignment statement. :-(. Thinking more, may be not so naive. I was just wondering where else we would be using UnbundledArchiveList that we needed to store it.

Copy link
Contributor

@asudarsa asudarsa left a comment

Choose a reason for hiding this comment

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

Change looks good as something that will be used in upcoming patches.

@asudarsa
Copy link
Contributor

@intel/llvm-gatekeepers
Ready to merge.
Thanks

@sarnex sarnex merged commit 30578ba into intel:sycl Sep 25, 2024
13 checks passed
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