This is an archive of the discontinued LLVM Phabricator instance.

Support atomic write operations in stack safety
ClosedPublic

Authored by fmayer on Aug 29 2023, 7:30 PM.

Details

Summary

This has two benefits:

  • we can now mark allocas that are used in atomic operations as safe
  • this fixes a bug that would incorrectly mark all atomic writes as safe in HWASan instrumentation. this is because stack safety keeps a list of all *unsafe* operations that are reachable from an alloca, but it did not analyze atomic writes, so it would always mark them as safe.

Diff Detail

Event Timeline

fmayer created this revision.Aug 29 2023, 7:30 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 29 2023, 7:30 PM
Herald added a subscriber: hiraditya. · View Herald Transcript
fmayer published this revision for review.Aug 30 2023, 2:16 PM
fmayer retitled this revision from Support atomic writes in stack safety to Support atomic write operations in stack safety.
fmayer edited the summary of this revision. (Show Details)
fmayer edited the summary of this revision. (Show Details)
fmayer added a reviewer: vitalybuka.
Herald added a project: Restricted Project. · View Herald TranscriptAug 30 2023, 2:17 PM
vitalybuka accepted this revision.Aug 31 2023, 2:23 PM
vitalybuka added inline comments.
llvm/lib/Analysis/StackSafetyAnalysis.cpp
412

maybe instead of introducing getNewValOperandIndex
just change RecordWrite(Value* operand) ?

This revision is now accepted and ready to land.Aug 31 2023, 2:23 PM
fmayer updated this revision to Diff 555183.Aug 31 2023, 3:31 PM
fmayer edited the summary of this revision. (Show Details)

simplify

fmayer marked an inline comment as done.Aug 31 2023, 3:39 PM
This revision was landed with ongoing or failed builds.Aug 31 2023, 3:41 PM
This revision was automatically updated to reflect the committed changes.