runtime icon indicating copy to clipboard operation
runtime copied to clipboard

[ARM/Linux] Regressions in 'Interop/MarshalAPI/ReadWrite/ReadWriteInt64'

Open parjong opened this issue 10 years ago • 9 comments

In ARM/Linux, running 'Interop/MarshalAPI/ReadWrite/ReadWriteInt64' with CoreCLR from 23b20c4e737 throws unhandled exception as follows:

$ corerun ut/Interop/MarshalAPI/ReadWrite/ReadWriteInt64/ReadWriteInt64.exe

Unhandled Exception: System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
   at System.Runtime.InteropServices.Marshal.ReadInt64(IntPtr ptr, Int32 ofs)

parjong avatar Jul 29 '16 06:07 parjong

@parjong it can be always reproduced ?

chunseoklee avatar Jul 29 '16 08:07 chunseoklee

@chunseoklee It always happens for me. Interestingly, it does not appear when I set UNW_ARM_UNWIND_METHOD as 6.

parjong avatar Jul 31 '16 23:07 parjong

While digging this issue, I found that libunwind tries to use DWARF-based unwind method, and crashes with invalid memory access just few steps after the DWARD-based unwinding step.

parjong avatar Jul 31 '16 23:07 parjong

@parjong It seems that DWARF-based unwinding requires several sections, which are omitted in coreclr(e.g. debug_loc, debug_frame.) Is it possible to set UWN_ARM_UNWIND_METHOD = 6 ? (if does, there might be regression ?)

chunseoklee avatar Aug 02 '16 23:08 chunseoklee

@chunseoklee There was code that sets UNW_ARM_UNWIND_METHOD as 6 in CoreCLR, but removed due to some regression in Release mode. I'll check whether setting UNW_ARM_UNWIND_METHOD has side-effect, or not.

parjong avatar Aug 03 '16 00:08 parjong

parjong commented 3 days ago @chunseoklee It always happens for me. Interestingly, it does not appear when I set UNW_ARM_UNWIND_METHOD as 6.

@parjong Thanks god! It seems that issue dotnet/runtime#6322 is also related to this and JIT/Performance/CodeQuality/Serialization/Serialize is PASSED with UNW_ARM_UNWIND_METHOD=6. I never thought there is a unwind during the serialization. Thank you again!.

hqueue avatar Aug 04 '16 04:08 hqueue

@chunseoklee @hqueue I checked whether setting UNW_ARM_UNWIND_METHOD as 6 introduces any regressions, but I didn't find any regression:

For Release build, setting UNW_ARM_UNWIND_METHOD as 6 reduces failures from 38~39 into 25~26 (there are some random failures)

It is similar for Debug build (from 35 into 29).

Unfortunately, I'm not sure whether this is also true for ARM (hard-fp) since I tested only ARM (soft-fp)

parjong avatar Aug 11 '16 01:08 parjong

@parjong I've observed that same DWARF inforamtion which cannot be interpreted correctly by libunwind for ARM hard-fp and soft-fp.(#6698)

hqueue avatar Aug 11 '16 06:08 hqueue

I'll close this issue as recent commit that disables the use of DWARF information during stack unwinding addressed it.

parjong avatar Aug 29 '16 00:08 parjong