Harmony
  1. Harmony
  2. HARMONY-3715

[drlvm] Memory access errors in DRLVM

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: DRLVM
    • Labels:
      None
    • Estimated Complexity:
      Advanced

      Description

      Here are results from valgrind (http://valgrind.org/) run with DRLVM

      1)
      ==21788== Conditional jump or move depends on uninitialised value(s)
      ==21788== at 0x4BFF1E9: EncoderBase::Operands::add(EncoderBase::Operand const&) (enc_base.h:546)
      ==21788== by 0x5E8FB40: Jitrino::Ia32::Encoder::emit(unsigned char*, Jitrino::Ia32::Inst const*) (Ia32Encoder.cpp:226)
      ==21788== by 0x5EBEEEB: Jitrino::Ia32::Inst::emit(unsigned char*) (Ia32Inst.cpp:441)
      ==21788== by 0x5E68CB5: Jitrino::Ia32::CodeEmitter::emitCode() (Ia32CodeEmitter.cpp:427)
      ==21788== by 0x5E68500: Jitrino::Ia32::CodeEmitter::runImpl() (Ia32CodeEmitter.cpp:300)
      ==21788== by 0x5EB7F41: Jitrino::Ia32::SessionAction::run() (Ia32IRManager.cpp:2269)
      ==21788== by 0x5F3DAA4: Jitrino::runPipeline(Jitrino::CompilationContext*) (Jitrino.cpp:227)
      ==21788== by 0x5F3DC26: Jitrino::compileMethod(Jitrino::CompilationContext*) (Jitrino.cpp:262)
      ==21788== by 0x5F3DD3E: Jitrino::Jitrino::CompileMethod(Jitrino::CompilationContext*) (Jitrino.cpp:287)
      ==21788== by 0x5E2D144: JIT_compile_method_with_params (DrlJITInterface.cpp:279)
      ==21788== by 0x4C05384: Dll_JIT::compile_method_with_params(void*, Method*, OpenMethodExecutionParams) (dll_jit_intf.h:86)
      ==21788== by 0x4BFC8D6: compile_do_compilation_jit(Method*, JIT*) (compile.cpp:657)

      2)
      ==21788== Conditional jump or move depends on uninitialised value(s)
      ==21788== at 0x5EB7F80: Jitrino::Ia32::SessionAction::run() (Ia32IRManager.cpp:2274)
      ==21788== by 0x5F3DAA4: Jitrino::runPipeline(Jitrino::CompilationContext*) (Jitrino.cpp:227)
      ==21788== by 0x5F3DC26: Jitrino::compileMethod(Jitrino::CompilationContext*) (Jitrino.cpp:262)
      ==21788== by 0x5F3DD3E: Jitrino::Jitrino::CompileMethod(Jitrino::CompilationContext*) (Jitrino.cpp:287)
      ==21788== by 0x5E2D144: JIT_compile_method_with_params (DrlJITInterface.cpp:279)
      ==21788== by 0x4C05384: Dll_JIT::compile_method_with_params(void*, Method*, OpenMethodExecutionParams) (dll_jit_intf.h:86)
      ==21788== by 0x4BFC8D6: compile_do_compilation_jit(Method*, JIT*) (compile.cpp:657)
      ==21788== by 0x4BADDBE: vm_compile_method (C_Interface.cpp:2492)
      ==21788== by 0x5B56F66: DrlEMImpl::methodProfileIsReady(MethodProfile*) (DrlEMImpl.cpp:772)
      ==21788== by 0x5B6086E: EBProfileCollector::syncModeJitCallback(MethodProfile*) (EBProfileCollector.cpp:191)
      ==21788== by 0x5B5FBF5: eb_profiler_sync_mode_callback(void*) (EBProfileCollector.cpp:91)
      ==21788== by 0x4441039: ???
      ==21788==

      3)
      ==21788== Conditional jump or move depends on uninitialised value(s)
      ==21788== at 0x5EB7F65: Jitrino::Ia32::SessionAction::run() (Ia32IRManager.cpp:2272)
      ==21788== by 0x5F3DAA4: Jitrino::runPipeline(Jitrino::CompilationContext*) (Jitrino.cpp:227)
      ==21788== by 0x5F3DC26: Jitrino::compileMethod(Jitrino::CompilationContext*) (Jitrino.cpp:262)
      ==21788== by 0x5F3DD3E: Jitrino::Jitrino::CompileMethod(Jitrino::CompilationContext*) (Jitrino.cpp:287)
      ==21788== by 0x5E2D144: JIT_compile_method_with_params (DrlJITInterface.cpp:279)
      ==21788== by 0x4C05384: Dll_JIT::compile_method_with_params(void*, Method*, OpenMethodExecutionParams) (dll_jit_intf.h:86)
      ==21788== by 0x4BFC8D6: compile_do_compilation_jit(Method*, JIT*) (compile.cpp:657)
      ==21788== by 0x4BADDBE: vm_compile_method (C_Interface.cpp:2492)
      ==21788== by 0x5B56F66: DrlEMImpl::methodProfileIsReady(MethodProfile*) (DrlEMImpl.cpp:772)
      ==21788== by 0x5B6086E: EBProfileCollector::syncModeJitCallback(MethodProfile*) (EBProfileCollector.cpp:191)
      ==21788== by 0x5B5FBF5: eb_profiler_sync_mode_callback(void*) (EBProfileCollector.cpp:91)
      ==21788== by 0x4441039: ???

      4)
      ==22293== Conditional jump or move depends on uninitialised value(s)
      ==22293== at 0x5F0243C: Jitrino::Ia32::StackLayouter::createProlog() (Ia32StackLayout.cpp:332)
      ==22293== by 0x5F01E10: Jitrino::Ia32::StackLayouter::runImpl() (Ia32StackLayout.cpp:181)
      ==22293== by 0x5EB7F49: Jitrino::Ia32::SessionAction::run() (Ia32IRManager.cpp:2269)
      ==22293== by 0x5F3DAAC: Jitrino::runPipeline(Jitrino::CompilationContext*) (Jitrino.cpp:227)
      ==22293== by 0x5F3DC2E: Jitrino::compileMethod(Jitrino::CompilationContext*) (Jitrino.cpp:262)
      ==22293== by 0x5F3DD46: Jitrino::Jitrino::CompileMethod(Jitrino::CompilationContext*) (Jitrino.cpp:287)
      ==22293== by 0x5E2D144: JIT_compile_method_with_params (DrlJITInterface.cpp:279)
      ==22293== by 0x4C0538C: Dll_JIT::compile_method_with_params(void*, Method*, OpenMethodExecutionParams) (dll_jit_intf.h:86)
      ==22293== by 0x4BFC8D6: compile_do_compilation_jit(Method*, JIT*) (compile.cpp:657)
      ==22293== by 0x4BADDBE: vm_compile_method (C_Interface.cpp:2492)
      ==22293== by 0x5B56F66: DrlEMImpl::methodProfileIsReady(MethodProfile*) (DrlEMImpl.cpp:772)
      ==22293== by 0x5B6086E: EBProfileCollector::syncModeJitCallback(MethodProfile*) (EBProfileCollector.cpp:191)
      ==22293==

      5)
      ==22293== Conditional jump or move depends on uninitialised value(s)
      ==22293== at 0x4BD22EA: Class::assign_offsets_to_methods(Global_Env*) (Prepare.cpp:833)
      ==22293== by 0x4BD3BBD: Class::prepare(Global_Env*) (Prepare.cpp:1223)
      ==22293== by 0x4BEEC56: ClassLoader::LoadVerifyAndPrepareClass(Global_Env*, String const*) (classloader.cpp:366)
      ==22293== by 0x4BCB98E: Global_Env::LoadCoreClass(String const*) (Environment.cpp:280)
      ==22293== by 0x4CBCB5E: preload_class(Global_Env*, String*) (vm_init.cpp:72)
      ==22293== by 0x4CBD856: bootstrap_initial_java_classes(Global_Env*) (vm_init.cpp:308)
      ==22293== by 0x4CBDAAC: preload_classes(Global_Env*) (vm_init.cpp:342)
      ==22293== by 0x4CBF097: vm_init1(JavaVM_Internal*, JavaVMInitArgs*) (vm_init.cpp:713)
      ==22293== by 0x4C29F54: JNI_CreateJavaVM (jni.cpp:499)
      ==22293== by 0x80499BC: invocation (main.c:658)
      ==22293== by 0x80490AF: gpProtectedMain (main.c:379)
      ==22293== by 0x804B506: main (cmain.c:147)

      6)
      ==22293== Conditional jump or move depends on uninitialised value(s)
      ==22293== at 0x4BDC368: String_Pool::hash_it(char const*, unsigned*, unsigned*) (String_Pool.cpp:110)
      ==22293== by 0x4BDC7F9: String_Pool::lookup(char const*) (String_Pool.cpp:263)
      ==22293== by 0x4BEEDB1: ClassLoader::ReportFailedClass(char const*, char const*, std::basic_stringstream<char, std::char_traits<char>, std::allocator<char> >&) (classloader.cpp:398)
      ==22293== by 0x4BF7D7E: BootstrapClassLoader::ReportFailedClass(char const*, char const*, std::basic_stringstream<char, std::char_traits<char>, std::allocator<char> >&) (classloader.h:352)
      ==22293== by 0x4BF3F22: BootstrapClassLoader::LoadFromFile(String const*) (classloader.cpp:1659)
      ==22293== by 0x4BF2FE6: BootstrapClassLoader::DoLoadClass(Global_Env*, String const*) (classloader.cpp:1435)
      ==22293== by 0x4BF2D68: ClassLoader::LoadClass(Global_Env*, String const*) (classloader.cpp:1390)
      ==22293== by 0x4BEEC15: ClassLoader::LoadVerifyAndPrepareClass(Global_Env*, String const*) (classloader.cpp:363)
      ==22293== by 0x4BC8D9E: class_load_verify_prepare_from_jni(Global_Env*, String const*) (Class_File_Loader.cpp:3642)
      ==22293== by 0x4BAA582: class_find_class_from_loader (C_Interface.cpp:1036)
      ==22293== by 0x4C114DA: Java_java_lang_VMClassRegistry_loadBootstrapClass (java_lang_VMClassRegistry.cpp:82)
      ==22293== by 0x786AE35: ???

      7)
      ==22293== Invalid read of size 4
      ==22293== at 0x4BDC350: String_Pool::hash_it(char const*, unsigned*, unsigned*) (String_Pool.cpp:109)
      ==22293== by 0x4BDC7F9: String_Pool::lookup(char const*) (String_Pool.cpp:263)
      ==22293== by 0x4C2A5FD: FindClass(JNIEnv_External*, char const*) (jni.cpp:637)
      ==22293== by 0x804AA95: main_runJavaMain (main.c:1232)
      ==22293== by 0x8049AF0: invocation (main.c:730)
      ==22293== by 0x80490AF: gpProtectedMain (main.c:379)
      ==22293== by 0x804B506: main (cmain.c:147)

      8)
      ==22293== Address 0x70CCE14 is 4 bytes inside a block of size 6 alloc'd
      ==22293== at 0x401B85E: malloc (vg_replace_malloc.c:149)
      ==22293== by 0x4CC83B5: string_get_utf8_chars(ManagedObject*) (vm_strings.cpp:478)
      ==22293== by 0x4CC84D1: string_get_utf8_chars_h(_jobject*) (vm_strings.cpp:492)
      ==22293== by 0x4C2D3E7: GetStringUTFChars(JNIEnv_External*, _jobject*, unsigned char*) (jni.cpp:1179)
      ==22293== by 0x804AA39: main_runJavaMain (main.c:1222)
      ==22293== by 0x8049AF0: invocation (main.c:730)
      ==22293== by 0x80490AF: gpProtectedMain (main.c:379)
      ==22293== by 0x804B506: main (cmain.c:147)

      ================================================
      To reproduce the results you use these files:

      Empty.java:
      public class Empty {
      public static void main(String[] args)

      { System.loadLibrary("empty"); nat(); }

      static native void nat();
      }

      Empty.c:
      #include <jni.h>
      #include "stdlib.h"
      #ifdef __cplusplus
      extern "C" {
      #endif
      JNIEXPORT void JNICALL Java_Empty_nat (JNIEnv *p1, jclass p2) {
      int a;
      if( a == 4 ) a = 3;

      }
      #ifdef __cplusplus
      }
      #endif

        Activity

        Hide
        Gregory Shimansky added a comment -

        I am just curious, what is the reason to use a native function which executes an unsafe (depends on unintialized variable) code? Is it intended?

        Show
        Gregory Shimansky added a comment - I am just curious, what is the reason to use a native function which executes an unsafe (depends on unintialized variable) code? Is it intended?
        Hide
        Mikhail Fursov added a comment -

        Yes, this is the test to check valgrind does work.

        Show
        Mikhail Fursov added a comment - Yes, this is the test to check valgrind does work.
        Hide
        Mikhail Loenko added a comment -

        I've run the same test with -Xem:opt and it reported the following error:
        Conditional jump or move depends on uninitialised value(s)
        CGSupport.cpp:245

        Also I tried several tests from "intermittent" exclude lists,
        on the java.awt.WindowTest it was reported about the following:

        Conditional jump or move depends on uninitialised value(s)
        at 0x5F9C344: Jitrino::Jet::rt_h_lcmp(long long, long long) (arith_rt.cpp:69)
        by 0x1993E336: ???

        Conditional jump or move depends on uninitialised value(s)
        at 0x5F9C371: Jitrino::Jet::rt_h_lcmp(long long, long long) (arith_rt.cpp:70)
        by 0x1993E336: ???

        Show
        Mikhail Loenko added a comment - I've run the same test with -Xem:opt and it reported the following error: Conditional jump or move depends on uninitialised value(s) CGSupport.cpp:245 Also I tried several tests from "intermittent" exclude lists, on the java.awt.WindowTest it was reported about the following: Conditional jump or move depends on uninitialised value(s) at 0x5F9C344: Jitrino::Jet::rt_h_lcmp(long long, long long) (arith_rt.cpp:69) by 0x1993E336: ??? Conditional jump or move depends on uninitialised value(s) at 0x5F9C371: Jitrino::Jet::rt_h_lcmp(long long, long long) (arith_rt.cpp:70) by 0x1993E336: ???
        Hide
        Alexey Varlamov added a comment -

        Mikhail L,
        most such reports are nearly useless without backtrace: uninitialized values come as arguments and it is hard to find real cause.
        In particular, those warnings in JET are caused by managed code and I'm not sure how we could trace them without manual debugging.

        Show
        Alexey Varlamov added a comment - Mikhail L, most such reports are nearly useless without backtrace: uninitialized values come as arguments and it is hard to find real cause. In particular, those warnings in JET are caused by managed code and I'm not sure how we could trace them without manual debugging.

          People

          • Assignee:
            Unassigned
            Reporter:
            Mikhail Fursov
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:

              Development