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

Run check-continuations in CI #2720

Merged
merged 4 commits into from
Oct 31, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
[Continuations] Fix use after free
The SavedRegisterValues vector was accessed after its allocation went
out of scope, make the value owned to prevent that.
Flakebi committed Oct 27, 2023
commit d06460a0a9f078486a0e0751f248f64cfa79789a
Original file line number Diff line number Diff line change
@@ -174,7 +174,7 @@ class LowerRaytracingPipelinePassImpl final {
struct FunctionEndData {
Instruction *Terminator = nullptr;
const PAQSerializationLayout *OutgoingSerializationLayout = nullptr;
SmallVectorImpl<Value *> *SavedRegisterValues = nullptr;
SmallVector<Value *> SavedRegisterValues;
Value *NewPayload = nullptr;
std::optional<PAQShaderStage> ShaderStage;
Value *HitAttrsAlloca = nullptr;
4 changes: 2 additions & 2 deletions shared/continuations/lib/LowerRaytracingPipeline.cpp
Original file line number Diff line number Diff line change
@@ -1350,7 +1350,7 @@ void LowerRaytracingPipelinePassImpl::processFunctionEnd(

// Restore saved registers. This needs to be done *before* copying
// back the payload, which depends on the restored memory pointer!
restorePayloadRegistersAfterRecursion(B, *EData.SavedRegisterValues);
restorePayloadRegistersAfterRecursion(B, EData.SavedRegisterValues);

// Copy local payload into global payload at end of shader
if (EData.OutgoingSerializationLayout->NumStorageI32s) {
@@ -1652,7 +1652,7 @@ void LowerRaytracingPipelinePassImpl::processFunction(llvm_dialects::Builder &B,
}

EData.OutgoingSerializationLayout = OutgoingSerializationLayout;
EData.SavedRegisterValues = &SavedRegisterValues;
EData.SavedRegisterValues = std::move(SavedRegisterValues);
EData.NewPayload = NewPayload;
EData.ShaderStage = ShaderStage;
EData.HitAttrsAlloca = HitAttrsAlloca;