Page MenuHomePhabricator

[NewPM] Port Msan: Alternative approach using a module to create the global constructor
AbandonedPublic

Authored by philip.pfaffe on Dec 12 2018, 9:33 AM.

Details

Summary

Changes in particular:

  • Pull sanitizer and wrapper pass apart
  • Add a newpm msan and msan-init pass
  • Update tests

Caveats:

  • Getting the original msan behavior back requires scheduling both msan and msan-init.
  • msan now tries to add a few global variables and function declaration everytime it runs, i.e. for every function. I deduplicate the global variables by name and type, do I need more?
  • I skip annotating the msan init function created by the init pass by name, which also might not suffice.

Event Timeline

philip.pfaffe created this revision.Dec 12 2018, 9:33 AM
philip.pfaffe edited the summary of this revision. (Show Details)Dec 12 2018, 10:04 AM
fedor.sergeev added inline comments.Dec 12 2018, 2:24 PM
llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
1077

While generally sympathetic to desire for organization of assorted booleans into a MSanOptions struct,
seeing how 86% of this patch is just a replacement of MS.* with MS.MSanOptions.* I would rather like
to see it come separately (as a preceeding, or perhaps followup, NFC refactoring).

vitalybuka added inline comments.Dec 14 2018, 12:15 AM
llvm/include/llvm/Transforms/Instrumentation.h
252

please move MSanOptions into separate patch and rename MSanOptions into just Options

I dropped MSanOptions over in D55647 (or didn't need it there), which will likely supersede this change here.

chandlerc requested changes to this revision.Dec 23 2018, 1:36 AM

Marking as needing changes so it doesn't show up in my queue, but maybe you want to abandon the revision if the other design is working now?

This revision now requires changes to proceed.Dec 23 2018, 1:36 AM
philip.pfaffe abandoned this revision.EditedDec 23 2018, 4:19 AM

Abandoning in favor of D55647.

Abandoning in favor of D55605.

I bet you meant D55647 here :)

Absolutely :)

Edited.

glider added a subscriber: glider.Dec 24 2018, 4:54 AM

A couple of nits.
I also think the newly added classes should be marked as such, not as structs, but YMMV.

llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
576

A comment explaining why there's "Legacy" in the name would be nice. We'll also need a precondition for removing this legacy from the code.

llvm/test/Instrumentation/MemorySanitizer/PowerPC/vararg-ppc64le.ll
1

This command line duplication is fragile. Can it be somehow done in lit?

llvm/test/Instrumentation/MemorySanitizer/X86/vararg-too-large.ll
1

Nit: I think it's more readable if you break the lines before pipes and indent the continued lines, e.g.:

; RUN: opt < %s -msan-check-access-address=0 ... \
; RUN:   | FileCheck %s

A couple of nits.
I also think the newly added classes should be marked as such, not as structs, but YMMV.

@glider: I closed this revision. Did you want to raise your concerns on D55647 instead?