This is an archive of the discontinued LLVM Phabricator instance.

[Compiler-rt][CFI] Enabling CFI for MIPS64
ClosedPublic

Authored by mohit.bhakkad on Apr 26 2016, 3:45 AM.

Details

Summary

Current test results are:

Failing Tests (2):

  cfi :: cross-dso/dlopen.cpp
  cfi :: cross-dso/simple-fail.cpp

Expected Passes    : 15
Expected Failures  : 1
Unsupported Tests  : 6
Unexpected Failures: 2

Diff Detail

Repository
rL LLVM

Event Timeline

mohit.bhakkad retitled this revision from to [Compiler-rt][CFI] Enabling CFI for MIPS64.
mohit.bhakkad updated this object.
mohit.bhakkad added reviewers: eugenis, pcc, kcc.
mohit.bhakkad set the repository for this revision to rL LLVM.
mohit.bhakkad added subscribers: jaydeep, slthakur.

I am debugging the cause of failing test cases. Both these cases fail as we are
not getting string "vtable is of type '{{(struct )?}}B'"

To get this error, condition at lib/cfi/cfi.cc:99 should pass.
i.e. MemToShadowOffset(addr) > ShadowSize()

Now looking at code,
shadow size is calculated as (vma >> kShadowGranularity)
shadow offset for addr is calculated as (addr >> kShadowGranularity)

In my understanding (addr > vma) is impossible, failing above condition forever.

Could you please throw some light here?

eugenis edited edge metadata.Apr 26 2016, 1:06 PM

I am debugging the cause of failing test cases. Both these cases fail as we are
not getting string "vtable is of type '{{(struct )?}}B'"

To get this error, condition at lib/cfi/cfi.cc:99 should pass.
i.e. MemToShadowOffset(addr) > ShadowSize()

Now looking at code,
shadow size is calculated as (vma >> kShadowGranularity)
shadow offset for addr is calculated as (addr >> kShadowGranularity)

In my understanding (addr > vma) is impossible, failing above condition forever.

Could you please throw some light here?

I don't think this is right. That condition protects against wild access when addr > vma; i've just removed the check and all tests still pass (which is actually bad and should be fixed by adding more tests).

eugenis accepted this revision.Apr 26 2016, 1:10 PM
eugenis edited edge metadata.

This change LGTM

This revision is now accepted and ready to land.Apr 26 2016, 1:10 PM
mohit.bhakkad added a subscriber: Restricted Project.
This revision was automatically updated to reflect the committed changes.