[PATCH] D23354: [compiler-rt] Support dynamic shadow address instrumentation

Reid Kleckner via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 10 13:12:13 PDT 2016


rnk added a comment.

In https://reviews.llvm.org/D23354#511569, @kcc wrote:

> Wait, wait, this utterly sucks. 
>  I need to know that we've exhausted all other possibilities before reviewing this. 
>  Did we?


I'm pretty confident that Etienne has done a lot of research, and we have found that on Windows, DLLs are spread out widely across the 48-bit address space. We'll be lucky if its possible to satisfy a 16TB allocation, let alone at a fixed address.

On top of that, Windows is a hostile environment where malware and AVs will come and inject DLLs into your process at unpredictable addresses. They don't stay clumped in the upper half like on Linux. We will need dynamic shadow, one way or another, if anyone ever wants to run an asan-ified executable to a machine that they don't control with any degree of reliability.

Also, as he mentioned, having a dynamic shadow makes it easier to run the same ASan binary on pre-Win8.1 machines (44-bit address space) and Win8.1+ machines (48-bit address space). We could technically use one fixed offset for both address space layouts, but the size would be dynamic, so we would still need a lot of runtime complexity.

I'm also skeptical that one load in the prologue is really that expensive. Use-after-return does a conditional branch in the prologue, and it's on by default now. Safestack does more work than that in the prologue, and your team found it had a negligible impact on performance. Anyway, Ettiene said he'd do a benchmark soon, we can how it goes.

We really did spend a while thinking about this, and I really do think we want to bring back dynamic shadow mapping.


https://reviews.llvm.org/D23354





More information about the llvm-commits mailing list