This is an archive of the discontinued LLVM Phabricator instance.

[dfsan] Add empty APIs for field-level shadow
ClosedPublic

Authored by stephan.yichao.zhao on Dec 3 2020, 7:07 PM.

Details

Summary
This is a child diff of D92261.

This diff adds APIs that return shadow type/value/zero from origin
objects. For the time being these APIs simply returns primitive
shadow type/value/zero. The following diff will be implementing the
conversion.

As D92261 explains, some cases still use primitive shadow during
the incremential changes. The cases include
1) alloca/load/store
2) custom function IO
3) vectors
At the cases this diff does not use the new APIs, but uses primitive
shadow objects explicitly.

Diff Detail

Event Timeline

stephan.yichao.zhao requested review of this revision.Dec 3 2020, 7:07 PM
Herald added a project: Restricted Project. · View Herald TranscriptDec 3 2020, 7:07 PM
morehouse added inline comments.Dec 4 2020, 8:15 AM
llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
425

This function looks unused by anything except the other getZeroShadow. Can we remove it?

431

Maybe we don't need this function either?

1678

Is this equivalent to getShadowTy(S)? If so, we can save a line of code by doing that instead.

1951–1953

Let's make use of the overloaded getShadowTy to do getShadowTy(PN) instead.

stephan.yichao.zhao marked 2 inline comments as done.Dec 4 2020, 12:30 PM
stephan.yichao.zhao added inline comments.
llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
425

This is a problem of the incremental diffs. In the next diff, this function is used. I removed it from this diff, and will be adding it back in the next one.

431

This one is the same. The next diff will be using it.

We could remove it from this diff. But some APIs, like getArgTLS, already use it.

The version with Value* argument is like a help function to reduce "V->getType()".

1678

S is a shadow value. it could be DFSF.DFS.getShadowTy(RI.getReturnValue()).
But RT is also used by DFSF.getRetvalTLS, so they share the same RT.

stephan.yichao.zhao marked an inline comment as done.

fixed

This revision is now accepted and ready to land.Dec 4 2020, 1:37 PM
This revision was landed with ongoing or failed builds.Dec 4 2020, 1:42 PM
This revision was automatically updated to reflect the committed changes.