libsanitizer merge from upstream r175042
Wed Feb 13 12:33:00 GMT 2013
On Wed, Feb 13, 2013 at 3:59 PM, Jakub Jelinek <firstname.lastname@example.org> wrote:
> On Wed, Feb 13, 2013 at 11:32:00AM +0100, Jakub Jelinek wrote:
>> On Wed, Feb 13, 2013 at 02:28:25PM +0400, Konstantin Serebryany wrote:
>> > Right. In LLVM we test only with ASAN_FLEXIBLE_MAPPING_AND_OFFSET==1,
>> > so this came unnoticed.
>> > Fixed in r175049.
>> This is ok, thanks.
> Unfortunately, it seems everything fails with that change :( on Linux.
> The problem is that the default prelink library range for x86_64 is
> 0x3000000000LL to 0x4000000000LL, and that unfortunately overlaps
Forgive my ignorance, what is the default prelink library range?
> with the 0x7fff8000LL to 0x10007fff8000LL range that asan wants to use
> for the shadow mapping. And the reason for that prelink default range is
> that earlier (see e.g.
> ) Linux on x86_64 used much smaller virtual address space than it does now.
> Not sure if there are still systems running pre-2.6.9 kernels or whenever the PML4
> change made it into Linux kernel on x86-64 and whether people use prelink on
> them. But in any case, even if I change the prelink range now (perhaps
> conditionally on the size of address space detected by prelink), it will
> still cause issues.
> So, either we need to revert that i386.c and asan_mapping.h (SHADOW_OFFSET)
> change, or support non-contiguous shadow memory for the Linux x86-64 case.
I suggest to either revert or (better) to support flexible mapping and
revert the offset only in the gcc compiler module
(leaving asan-rt unchanged).
non-contiguous shadow memory sounds too scary and costly to support,
not worth the benefit.
> What could work is if we had:
> 0x000000000000 - 0x00007fff8000 low memory
> 0x00007fff8000 - 0x00008fff7000 shadow mem for low memory
> 0x00008fff7000 - 0x00067fff8000 protected
> 0x00067fff8000 - 0x00087fff8000 shadow mem for mid memory
> 0x00087fff8000 - 0x003000000000 protected
> 0x003000000000 - 0x004000000000 mid memory
> 0x004000000000 - 0x02008fff7000 protected
> 0x02008fff7000 - 0x10007fff8000 shadow mem for high memory
> 0x10007fff8000 - 0x7fffffffffff high memory
> asan_mapping.h then would need to introduce AddrIsInMidMem and
> AddrIsInMidShadow inlines (perhaps defined to false for configurations
> that don't need 3 part memory), use those in AddrIsInMem
> and AddrIsInShadow, tweak AddrIsInShadowGap (as it has now more gaps)
> for this configuration and tweak the mapping code.
More information about the Gcc-patches