summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonghyun Park <parjong@gmail.com>2016-12-14 09:46:40 +0900
committerJan Kotas <jkotas@microsoft.com>2016-12-13 16:46:40 -0800
commit2a7f2ffeb1b6a39f295cc819d3e1187bcc0507a0 (patch)
treed1f4825cda06060b23eae590b0036d11465955d5
parent71d73fc56b9dc295d1f9ffcc7882e8b0765d10d6 (diff)
downloadcoreclr-2a7f2ffeb1b6a39f295cc819d3e1187bcc0507a0.tar.gz
coreclr-2a7f2ffeb1b6a39f295cc819d3e1187bcc0507a0.tar.bz2
coreclr-2a7f2ffeb1b6a39f295cc819d3e1187bcc0507a0.zip
[x86/Linux] Fix "Bad opcode" assert in unwindLazyState (#8609)
* [x86/Linux] Fix "Bad opcode" assert in unwindLazyState This commit suppresses "Bad opcode" assert while runing "Hello, World" example. This commit address the following three code patterns discovered while digging the assert failure: - and $0x1, %al - xor $0xff, %al - stack protection code: mov %gs:<off>, <reg> cmp <off>(%esp), <reg> mov <reg>, <off>($esp) jne <disp32> This commit revises LazyMachState::unwindLazyState to handle the first two patterns, and revises compile options not to emit the third pattern.
-rw-r--r--compileoptions.cmake6
-rw-r--r--src/vm/i386/gmsx86.cpp8
2 files changed, 13 insertions, 1 deletions
diff --git a/compileoptions.cmake b/compileoptions.cmake
index 75d51fd5bb..7baa86baf1 100644
--- a/compileoptions.cmake
+++ b/compileoptions.cmake
@@ -15,7 +15,11 @@ if (CLR_CMAKE_PLATFORM_UNIX)
# We cannot enable "stack-protector-strong" on OS X due to a bug in clang compiler (current version 7.0.2)
add_compile_options(-fstack-protector)
else()
- add_compile_options(-fstack-protector-strong)
+ if(NOT CLR_CMAKE_PLATFORM_ARCH_I386)
+ # x86 unwinder cannot handle stack protection code, yet
+ # see https://github.com/dotnet/coreclr/issues/8625 for details
+ add_compile_options(-fstack-protector-strong)
+ endif(NOT CLR_CMAKE_PLATFORM_ARCH_I386)
endif(CLR_CMAKE_PLATFORM_DARWIN)
add_definitions(-DDISABLE_CONTRACTS)
diff --git a/src/vm/i386/gmsx86.cpp b/src/vm/i386/gmsx86.cpp
index 75d37ba0d3..ae4b9dda98 100644
--- a/src/vm/i386/gmsx86.cpp
+++ b/src/vm/i386/gmsx86.cpp
@@ -683,6 +683,10 @@ void LazyMachState::unwindLazyState(LazyMachState* baseState,
ip += 2;
break;
+ case 0x34: // XOR AL, imm8
+ ip += 2;
+ break;
+
case 0x31:
case 0x32:
case 0x33:
@@ -879,6 +883,10 @@ void LazyMachState::unwindLazyState(LazyMachState* baseState,
datasize = b16bit?2:4;
goto decodeRM;
+ case 0x24: // AND AL, imm8
+ ip += 2;
+ break;
+
case 0x01: // ADD mod/rm
case 0x03:
case 0x29: // SUB mod/rm