Harmony
  1. Harmony
  2. HARMONY-2987

[drlvm][exception][tc] Race condition in vmcore\src\util\win\ia32\ nt_exception_filter.cpp stack functions

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: DRLVM
    • Labels:
      None
    • Patch Info:
      Patch Available

      Description

      There are 3 occurrences of thread unsafe access to follow fields that result in race condition.

      static size_t common_stack_size;
      static size_t common_guard_stack_size;
      static size_t common_guard_page_size;


      First race condition occur during concurrent execution of get_stack_size() and init_stack_info() with respect to common_stack_size field.
      Read -> Write data-race:
      Memory write at "nt_exception_filter.cpp":175 conflicts with a prior memory read at "nt_exception_filter.cpp":161

      Stack Traces:

      Context
      Function hythread_create_with_group "thread_native_basic.c":142
      Function apr_thread_create "thread.c":113
      Function _beginthreadex "threadex.c":145
      Function EntryPoint "dllcrt0.c":323
      Function threadstartex "threadex.c":241
      Function dummy_worker "thread.c":79
      Function thread_start_proc "thread_native_basic.c":723
      Function wrapper_proc "thread_java_basic.c":83
      Function vm_attach "thread_generic.cpp":193
      Function void init_stack_info(void) "nt_exception_filter.cpp":173

      1st Access
      Function Opcode_INVOKEVIRTUAL "interpreter.cpp":2054
      Function interpreterInvokeVirtual "interpreter.cpp":3463
      Function interpreterInvoke "interpreter.cpp":3381
      Function void interpreter(struct StackFrame &) "interpreter.cpp":2900
      Function Opcode_INVOKEVIRTUAL "interpreter.cpp":2054
      Function interpreterInvokeVirtual "interpreter.cpp":3463
      Function interpreterInvoke "interpreter.cpp":3381
      Function void interpreter(struct StackFrame &) "interpreter.cpp":2543
      Function unsigned int get_available_stack_size(void) "nt_exception_filter.cpp":207
      Function unsigned int get_stack_size(void) "nt_exception_filter.cpp":161

      2nd Access
      Function hythread_create_with_group "thread_native_basic.c":142
      Function apr_thread_create "thread.c":113
      Function _beginthreadex "threadex.c":145
      Function EntryPoint "dllcrt0.c":323
      Function threadstartex "threadex.c":241
      Function dummy_worker "thread.c":79
      Function thread_start_proc "thread_native_basic.c":723
      Function wrapper_proc "thread_java_basic.c":83
      Function vm_attach "thread_generic.cpp":193
      Function void init_stack_info(void) "nt_exception_filter.cpp":175

      (ii)
      Second race condition occur during concurrent execution of get_guard_stack_size() and init_stack_info() with respect to common_guard_stack_size field.

      Read -> Write data-race: Memory write at "nt_exception_filter.cpp":176 conflicts with a prior memory read at "nt_exception_filter.cpp":165

      Stack Traces:

      Context
      Function hythread_create_with_group "thread_native_basic.c":142
      Function apr_thread_create "thread.c":113
      Function _beginthreadex "threadex.c":145
      Function EntryPoint "dllcrt0.c":323
      Function threadstartex "threadex.c":241
      Function dummy_worker "thread.c":79
      Function thread_start_proc "thread_native_basic.c":723
      Function wrapper_proc "thread_java_basic.c":83
      Function vm_attach "thread_generic.cpp":193
      Function void init_stack_info(void) "nt_exception_filter.cpp":173

      1st Access
      Function Opcode_INVOKEVIRTUAL "interpreter.cpp":2054
      Function interpreterInvokeVirtual "interpreter.cpp":3463
      Function interpreterInvoke "interpreter.cpp":3381
      Function void interpreter(struct StackFrame &) "interpreter.cpp":2900
      Function Opcode_INVOKEVIRTUAL "interpreter.cpp":2054
      Function interpreterInvokeVirtual "interpreter.cpp":3463
      Function interpreterInvoke "interpreter.cpp":3381
      Function void interpreter(struct StackFrame &) "interpreter.cpp":2543
      Function unsigned int get_available_stack_size(void) "nt_exception_filter.cpp":207
      Function unsigned int get_guard_stack_size(void) "nt_exception_filter.cpp":165

      2nd Access
      Function hythread_create_with_group "thread_native_basic.c":142
      Function apr_thread_create "thread.c":113
      Function _beginthreadex "threadex.c":145
      Function EntryPoint "dllcrt0.c":323
      Function threadstartex "threadex.c":241
      Function dummy_worker "thread.c":79
      Function thread_start_proc "thread_native_basic.c":723
      Function wrapper_proc "thread_java_basic.c":83
      Function vm_attach "thread_generic.cpp":193
      Function void init_stack_info(void) "nt_exception_filter.cpp":176

      (iii)
      Third race condition occur during concurrent execution of get_guard_page_size() and init_stack_info() with respect to common_guard_page_size.

      Read -> Write data-race: Memory write at "nt_exception_filter.cpp":177 conflicts with a prior memory read at "nt_exception_filter.cpp":169

      Stack Traces:

      Context
      Function hythread_create_with_group "thread_native_basic.c":142
      Function apr_thread_create "thread.c":113
      Function _beginthreadex "threadex.c":145
      Function EntryPoint "dllcrt0.c":323
      Function threadstartex "threadex.c":241
      Function dummy_worker "thread.c":79
      Function thread_start_proc "thread_native_basic.c":723
      Function wrapper_proc "thread_java_basic.c":83
      Function vm_attach "thread_generic.cpp":193
      Function void init_stack_info(void) "nt_exception_filter.cpp":173

      1st Access
      Function Opcode_INVOKEVIRTUAL "interpreter.cpp":2054
      Function interpreterInvokeVirtual "interpreter.cpp":3463
      Function interpreterInvoke "interpreter.cpp":3381
      Function void interpreter(struct StackFrame &) "interpreter.cpp":2900
      Function Opcode_INVOKEVIRTUAL "interpreter.cpp":2054
      Function interpreterInvokeVirtual "interpreter.cpp":3463
      Function interpreterInvoke "interpreter.cpp":3381
      Function void interpreter(struct StackFrame &) "interpreter.cpp":2543
      Function unsigned int get_available_stack_size(void) "nt_exception_filter.cpp":207
      Function unsigned int get_guard_page_size(void) "nt_exception_filter.cpp":169

      2nd Access
      Function hythread_create_with_group "thread_native_basic.c":142
      Function apr_thread_create "thread.c":113
      Function _beginthreadex "threadex.c":145
      Function EntryPoint "dllcrt0.c":323
      Function threadstartex "threadex.c":241
      Function dummy_worker "thread.c":79
      Function thread_start_proc "thread_native_basic.c":723
      Function wrapper_proc "thread_java_basic.c":83
      Function vm_attach "thread_generic.cpp":193
      Function void init_stack_info(void) "nt_exception_filter.cpp":177

        Activity

          People

          • Assignee:
            weldon washburn
            Reporter:
            Ilya Leviev
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:

              Development