Hello all.
I try using ASan for debug jvm.

All .so library in jvm instrumented with ASan.
But, I have some error here:

LD_PRELOAD=/usr/lib/libclang_rt.asan-x86_64.so 
LD_LIBRARY_PATH=./dist/jdk_7/debug/open/jdk/jre/lib/amd64/drlvm/ 
./dist/jdk_7/debug/open/jdk/jre/bin/java -XX:-UseG1GC -version
=================================================================
==24418==ERROR: AddressSanitizer: unknown-crash on address 0x0000dfff8000 
at pc 0x7f6c2e9ab3d9 bp 0x7f6c28773960 sp 0x7f6c28773110
WRITE of size 4194304 at 0x0000dfff8000 thread T1
    #0 0x7f6c2e9ab3d8 in __asan_memset 
/home/dbezheckov/waratek/tests/asan/sources/llvm/projects/compiler-rt/lib/asan/asan_interceptors.cc:431
    #1 0x7f6c12fbd7d5 in lspace_initialize(GC*, void*, unsigned long) 
/home/dbezheckov/waratek/harmony-custom/drlvm/vm/gc_gen/src/los/lspace.cpp:44:5
    #2 0x7f6c12f9fc8c 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 0x7f6c12f9f63f 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 0x7f6c12f848eb in gc_init 
/home/dbezheckov/waratek/harmony-custom/drlvm/vm/gc_gen/src/common/gc_for_vm.cpp:104:5
    #5 0x7f6c29cc9623 in vm_init1(JavaVM_Internal*, JavaVMInitArgs*, 
JNIEnv_External**) 
/home/dbezheckov/waratek/harmony-custom/drlvm/vm/vmcore/src/init/vm_init.cpp:796:14
    #6 0x7f6c29b27f2c in JNI_CreateJavaVM 
/home/dbezheckov/waratek/harmony-custom/drlvm/vm/vmcore/src/jni/jni.cpp:436:19
    #7 0x7f6c29b286b4 in CVMI_CreateJavaVM 
/home/dbezheckov/waratek/harmony-custom/drlvm/vm/vmcore/src/jni/jni.cpp:526:12
    #8 0x7f6c2abd0634 in JNI_CreateJavaVM 
/home/dbezheckov/waratek/harmony-custom/drlvm/vm/openjdk/src/openjdk.cpp:90:12
    #9 0x7f6c2e6fdb47 
 
(/home/dbezheckov/waratek/harmony-custom/dist/jdk_7/debug/open/jdk/jre/bin/../lib/amd64/jli/libjli.so+0x2b47)
    #10 0x7f6c2df1c181 in start_thread 
/build/buildd/eglibc-2.19/nptl/pthread_create.c:312
    #11 0x7f6c2e43047c in clone 
/build/buildd/eglibc-2.19/misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:111

code for lspace_initialize(GC*, void*, unsigned long):
Lspace *lspace_initialize( GC *gc, void *start, uintptr_t lspace_size ) {
 Lspace *lspace = (Lspace *)STD_MALLOC( sizeof( Lspace ) );
 assert( lspace );
 memset( lspace, 0, sizeof( Lspace ) );
 

 /* commit mspace mem */
 void *reserved_base = start;
 uintptr_t committed_size = lspace_size;
 if( !large_page_hint )
 {
 TRACE2( "gc.initialize", "lspace_initialize() ptr=" << (uintptr_t)
reserved_base
 << " size=" << lspace_size );
 vm_commit_mem( reserved_base, lspace_size );
 }
 memset( reserved_base, 0, lspace_size );
 

 min_los_size_bytes -= LOS_HEAD_RESERVE_FOR_HEAP_BASE;
 lspace->committed_heap_size = committed_size - 
LOS_HEAD_RESERVE_FOR_HEAP_BASE;
 lspace->reserved_heap_size = gc->reserved_heap_size - 
min_none_los_size_bytes - LOS_HEAD_RESERVE_FOR_HEAP_BASE;
 lspace->heap_start = (void *)( (uintptr_t)reserved_base + 
LOS_HEAD_RESERVE_FOR_HEAP_BASE );
 lspace->heap_end = (void *)( (uintptr_t)reserved_base + committed_size );
 

 lspace->gc = gc;
 /*LOS_Shrink:*/
 lspace->move_object = 0;
 

 /*Treat with free area buddies*/
 lspace->free_pool = (Free_Area_Pool *)STD_MALLOC( sizeof( Free_Area_Pool ) 
);
 free_area_pool_init( lspace->free_pool );
 Free_Area *initial_fa = (Free_Area *)lspace->heap_start;
 initial_fa->size = lspace->committed_heap_size;
 free_pool_add_area( lspace->free_pool, initial_fa );
 

 lspace->num_collections = 0;
 lspace->time_collections = 0;
 lspace->survive_ratio = 0.5f;
 lspace->last_allocated_size = 0;
 lspace->accumu_alloced_size = 0;
 lspace->total_alloced_size = 0;
 lspace->last_surviving_size = 0;
 lspace->period_surviving_size = 0;
 

 p_global_lspace_move_obj = &( lspace->move_object );
 los_boundary = lspace->heap_end;
 

 return lspace;
 }

please help.

-- 
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