> So, when using the MemToShadow(addr) (1UL << 43) + ((addr << 12) >> (12 + > 3)) mapping, the first valid address above the hole will have shadow at: > 0x0002070000000000UL (will not work, as it is inside of the VA hole) > 0x0001f80000000000UL (will not work, as it is inside of the VA hole) > 0x0001080000000000UL (this is the only case that will work) > 0x0000080000000000UL (will not work; that would mean that both the low and > high memory share the same shadow memory; > it could be made to work by doing mmap > (0xfff0000000000000UL, 0x8000000000000UL, MAP_FIXED, > PROT_NONE) > at libasan initialization and failing if that doesn't > succeed)
OK, I can certainly do the last thing. > Note for the first VA layout even the shadow offset 1UL << 43 will not work > at all even for the low part of the memory, as all of shadow memory is then > in the hole. Yes, you need a kernel configured for SPARC-T4 or later. > I think hardcoding one of the 4 choices in the ABI is undesirable. Frankly I'm not sure why you care about the ABI of the AddressSanitizer... > Another possibility is instead of using constant offset + 2 shifts use a > variable offset + the normal >> 3, where the offset would be chosen by the > runtime library depending on the VA hole size and where the shadow for the > high memory would precede the shadow for the low memory. But you still need to chop the high bits, otherwise you end up in the hole. -- Eric Botcazou