This is an archive of the discontinued LLVM Phabricator instance.

[compiler-rt] Add support for the dynamic shadow allocation
ClosedPublic

Authored by etienneb on Aug 10 2016, 11:49 AM.

Details

Summary

This patch is adding the needed code to compiler-rt to support
dynamic shadow.

This is to support this patch:

https://reviews.llvm.org/D23354

It's adding support for using a shadow placed at a dynamic address determined
at runtime.

The dynamic shadow is required to work on windows 64-bits.

Diff Detail

Event Timeline

etienneb updated this revision to Diff 67568.Aug 10 2016, 11:49 AM
etienneb retitled this revision from to [compiler-rt] Add support for the dynamic shadow allocation.
etienneb updated this object.
etienneb added reviewers: rnk, kcc.
etienneb added subscribers: chrisha, llvm-commits.
kcc edited edge metadata.Aug 10 2016, 11:53 AM

I am not a fan of this change because it adds extra complexity and makes asan slower.
As I've commented in the other patch, I first want to know for sure that having a fixed address is impossible.
So far I have not seen an explanation.

In D23363#511583, @kcc wrote:

I am not a fan of this change because it adds extra complexity and makes asan slower.
As I've commented in the other patch, I first want to know for sure that having a fixed address is impossible.
So far I have not seen an explanation.

This is not making ASAN slower, except for the cases where it's configured to use a dynamic shadow.
So, Asan on every plateform should be the same.... except on win64.

With these two patches, asan unittests are passing on windows 64-bit.

https://reviews.llvm.org/D23354
https://reviews.llvm.org/D23363
D:\src\llvm\ninja64>ninja check-asan
-- Testing: 536 tests, 16 threads --
Testing: 0 .. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90..
Testing Time: 68.45s
  Expected Passes    : 374
  Expected Failures  : 15
  Unsupported Tests  : 147
kubamracek added inline comments.Aug 11 2016, 7:02 AM
lib/asan/asan_interface_internal.h
33

Can we get argument names here?

etienneb updated this revision to Diff 70539.Sep 7 2016, 8:47 AM
etienneb marked an inline comment as done.
etienneb edited edge metadata.

rebased, conflicts resolved.

etienneb updated this revision to Diff 71519.Sep 15 2016, 9:49 AM

rebased + cleanup

vitalybuka requested changes to this revision.Sep 15 2016, 11:26 AM
vitalybuka edited edge metadata.
vitalybuka added inline comments.
lib/asan/asan_rtl.cc
472

Not sure how this going to link. This code is going to be compiled for all platforms, but
FindAvailableMemoryRange is defined only for windows.
Probably we need some default {return nulltpr;} implementation.

662

please clang-format this

This revision now requires changes to proceed.Sep 15 2016, 11:26 AM
etienneb updated this revision to Diff 71532.Sep 15 2016, 12:01 PM
etienneb edited edge metadata.
etienneb marked an inline comment as done.

fix linking issue (debug mode)

thx, it was a good catch.
The build was broken in debug. Optimisation was taking away the need for FindAvailableMemoryAddress.

lib/asan/asan_rtl.cc
472

It was compiling on linux because of the compiler optimisaiton.
This is a good catch. Thx!

vitalybuka accepted this revision.Sep 15 2016, 5:57 PM
vitalybuka edited edge metadata.

Maybe CHECK(!"FindAvailableMemoryRange is not available");
LGTM

This revision is now accepted and ready to land.Sep 15 2016, 5:57 PM
etienneb closed this revision.Sep 19 2016, 9:07 AM
pcc added a subscriber: pcc.Sep 20 2016, 3:56 PM

Hi Etienne, I think your change caused asan test failures on the bot:

http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux/builds/25405
http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux/builds/25406

Can you please take a look?