Harmony
  1. Harmony
  2. HARMONY-5617

[drlvm] On Linux crash handler may crash itself when handling SOE condition

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: 5.0M6
    • Fix Version/s: None
    • Component/s: DRLVM
    • Labels:
      None
    • Environment:
      Linux x86 and x86_64
    • Estimated Complexity:
      Advanced

      Description

      When crash handler receives a SIGSEGV signal that is caused by a stack overflow, it tries to transfer control out of signal handler (just like it does for other kind of signals). But the problem is that it tries to write memory pointed to by SP register (ESP or RSP) of the original crash context. When crash happened because of stack overflow, writing to that memory may not be possible since it is protected by a guard page. In this case crash handler crashes itself:

      Program terminated with signal 11, Segmentation fault.
      #0 0x00002aaaaac27bbf in port_set_longjump_regs (fn=0x2aaaaac2658e, regs=0x7fffbd422b90, num=3)
      at /home/gregory/work/64/trunk/working_vm/vm/port/src/thread/linux/thread_em64t.c:86
      86 sp = (void)regs->rip;
      (gdb) bt
      #0 0x00002aaaaac27bbf in port_set_longjump_regs (fn=0x2aaaaac2658e, regs=0x7fffbd422b90, num=3)
      at /home/gregory/work/64/trunk/working_vm/vm/port/src/thread/linux/thread_em64t.c:86
      #1 0x00002aaaaac26579 in general_signal_handler (signum=11, info=0x7fffbd422d70,
      context=0x7fffbd422c40)
      at /home/gregory/work/64/trunk/working_vm/vm/port/src/signals/linux/signals_common.cpp:107
      #2 <signal handler called>
      #3 0x00002aaabf5254c8 in ?? ()

      The crash happens for me on Gentoo Linux installations both on x86 and x86_64. The easiest way to reproduce it is to run StackTest from the smoke VM tests.

      1. ThreadManager.html.patch
        2 kB
        Ilya Berezhniuk
      2. ThreadCreation.gif
        20 kB
        Ilya Berezhniuk
      3. ThreadCreation.gif
        11 kB
        Ilya Berezhniuk
      4. H-5617-workaround.patch
        3 kB
        Ilya Berezhniuk
      5. 0001-HARMONY-5617.patch
        178 kB
        Ilya Berezhniuk
      6. 0001-HARMONY-5617.patch
        183 kB
        Ilya Berezhniuk
      7. 0001-HARMONY-5617.patch
        175 kB
        Ilya Berezhniuk

        Issue Links

          Activity

          Gregory Shimansky created issue -
          Ilya Berezhniuk made changes -
          Field Original Value New Value
          Attachment H-5617-workaround.patch [ 12378449 ]
          Gregory Shimansky made changes -
          Assignee Gregory Shimansky [ gshimansky ]
          Ilya Berezhniuk made changes -
          Attachment 0001-HARMONY-5617.patch [ 12380960 ]
          Ilya Berezhniuk made changes -
          Attachment ThreadCreation.gif [ 12381010 ]
          Attachment ThreadManager.html.patch [ 12381009 ]
          Ilya Berezhniuk made changes -
          Attachment 0001-HARMONY-5617.patch [ 12381197 ]
          Ilya Berezhniuk made changes -
          Attachment ThreadCreation.gif [ 12381429 ]
          Ilya Berezhniuk made changes -
          Link This issue blocks HARMONY-5819 [ HARMONY-5819 ]
          Ilya Berezhniuk made changes -
          Attachment 0001-HARMONY-5617.patch [ 12382687 ]
          Gregory Shimansky made changes -
          Assignee Gregory Shimansky [ gshimansky ] Ilya Berezhniuk [ iberezhn ]
          Gavin made changes -
          Link This issue blocks HARMONY-5819 [ HARMONY-5819 ]
          Gavin made changes -
          Link This issue is depended upon by HARMONY-5819 [ HARMONY-5819 ]

            People

            • Assignee:
              Ilya Berezhniuk
              Reporter:
              Gregory Shimansky
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:

                Development