mmap(... MAP_FIXED ...) will not work if the address is outside of the
ASan application memory area.
Non-fixed mmap is supposed to work.
Is this heap base address a hardcoded constant?


On Mon, Jun 8, 2015 at 1:03 AM, Dmitriy - <[email protected]> wrote:
> Full asan log:
>
> =================================================================
> ==8250==ERROR: AddressSanitizer: unknown-crash on address 0x0000dfff8000 at
> pc 0x7ffff6e743d9 bp 0x7ffff0c74960 sp 0x7ffff0c74110
> WRITE of size 4194304 at 0x0000dfff8000 thread T1
>     #0 0x7ffff6e743d8 in __asan_memset
> /home/dbezheckov/waratek/tests/asan/sources/llvm/projects/compiler-rt/lib/asan/asan_interceptors.cc:431
>     #1 0x7fffdb4be7d5 in lspace_initialize(GC*, void*, unsigned long)
> /home/dbezheckov/waratek/harmony-custom/drlvm/vm/gc_gen/src/los/lspace.cpp:44:5
>     #2 0x7fffdb4a0c8c in gc_los_initialize(GC_Gen*, void*, unsigned long)
> /home/dbezheckov/waratek/harmony-custom/drlvm/vm/gc_gen/src/gen/gen.cpp:476:24
>     #3 0x7fffdb4a063f in gc_gen_initialize(GC_Gen*, unsigned long, unsigned
> long)
> /home/dbezheckov/waratek/harmony-custom/drlvm/vm/gc_gen/src/gen/gen.cpp:313:5
>     #4 0x7fffdb4858eb in gc_init
> /home/dbezheckov/waratek/harmony-custom/drlvm/vm/gc_gen/src/common/gc_for_vm.cpp:104:5
>     #5 0x7ffff21ca433 in vm_init1(JavaVM_Internal*, JavaVMInitArgs*,
> JNIEnv_External**)
> /home/dbezheckov/waratek/harmony-custom/drlvm/vm/vmcore/src/init/vm_init.cpp:796:14
>     #6 0x7ffff2028e4c in JNI_CreateJavaVM
> /home/dbezheckov/waratek/harmony-custom/drlvm/vm/vmcore/src/jni/jni.cpp:436:19
>     #7 0x7ffff20295d4 in CVMI_CreateJavaVM
> /home/dbezheckov/waratek/harmony-custom/drlvm/vm/vmcore/src/jni/jni.cpp:526:12
>     #8 0x7ffff30d0634 in JNI_CreateJavaVM
> /home/dbezheckov/waratek/harmony-custom/drlvm/vm/openjdk/src/openjdk.cpp:90:12
>     #9 0x7ffff6bc6b47
> (/home/dbezheckov/waratek/harmony-custom/dist/jdk_7/debug/open/jdk/jre/bin/../lib/amd64/jli/libjli.so+0x2b47)
>     #10 0x7ffff63e5181 in start_thread
> /build/buildd/eglibc-2.19/nptl/pthread_create.c:312
>     #11 0x7ffff68f947c in clone
> /build/buildd/eglibc-2.19/misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:111
>
> Address 0x0000dfff8000 is located in the shadow gap area.
> SUMMARY: AddressSanitizer: unknown-crash
> /home/dbezheckov/waratek/tests/asan/sources/llvm/projects/compiler-rt/lib/asan/asan_interceptors.cc:431
> in __asan_memset
> Thread T1 created by T0 here:
>     #0 0x7ffff6e0257d in __interceptor_pthread_create
> /home/dbezheckov/waratek/tests/asan/sources/llvm/projects/compiler-rt/lib/asan/asan_interceptors.cc:225
>     #1 0x7ffff6bcd98e
> (/home/dbezheckov/waratek/harmony-custom/dist/jdk_7/debug/open/jdk/jre/bin/../lib/amd64/jli/libjli.so+0x998e)
>     #2 0x7ffff6bc84f6
> (/home/dbezheckov/waratek/harmony-custom/dist/jdk_7/debug/open/jdk/jre/bin/../lib/amd64/jli/libjli.so+0x44f6)
>     #3 0x7ffff6bc9043 in JLI_Launch
> (/home/dbezheckov/waratek/harmony-custom/dist/jdk_7/debug/open/jdk/jre/bin/../lib/amd64/jli/libjli.so+0x5043)
>     #4 0x4006b4
> (/home/dbezheckov/waratek/harmony-custom/dist/jdk_7/debug/open/jdk/jre/bin/java+0x4006b4)
>     #5 0x7ffff6820ec4 in __libc_start_main
> /build/buildd/eglibc-2.19/csu/libc-start.c:287
>
> ==8250==ABORTING
>
> "Address 0x0000dfff8000 is located in the shadow gap area"
> (gdb) print gc_heap_base_address()
> $1 = (void *) 0xdfff8000
>
> That is the address precisely indicates the protected memory segment (heap
> base in jvm protected by a read/write/execution).
>
> That is, if I use in program mmap function, ASan will not work? Unless of
> course it is not hacked.
>
> @Yury: nothing shadow memory contents after the backtrace(
>
> On Monday, June 8, 2015 at 1:08:54 PM UTC+6, Yury Gribov wrote:
>>
>> On 06/08/2015 09:58 AM, Dmitriy - wrote:
>> > How to force ASan to intercept mmap? Or how to understand that it
>> > intercepts it?
>>
>> You can add a new interceptor in
>> compiler-rt/lib/asan/asan_interceptors.cc (similar to existing TSan mmap
>> interceptor in tsan_interceptors.cc). If you are not interested in
>> hacking compiler-rt, you could simply run your app under strace and look
>> for mmap syscalls which overlap ASan shadow.
>>
>> -Y
>>
> --
> You received this message because you are subscribed to the Google Groups
> "address-sanitizer" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"address-sanitizer" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to