summaryrefslogtreecommitdiff
path: root/src/vm
diff options
context:
space:
mode:
authorJan Vorlicek <janvorli@microsoft.com>2018-11-21 19:20:01 +0100
committerGitHub <noreply@github.com>2018-11-21 19:20:01 +0100
commit9170c7f90a55befbd4b43db3a824479592a96eb7 (patch)
treec5011e5646f2479ebd5804ad4a383f0a5ba7cda0 /src/vm
parent844aa45629e683d546e98e4a8bb5dd660f8dacae (diff)
downloadcoreclr-9170c7f90a55befbd4b43db3a824479592a96eb7.tar.gz
coreclr-9170c7f90a55befbd4b43db3a824479592a96eb7.tar.bz2
coreclr-9170c7f90a55befbd4b43db3a824479592a96eb7.zip
Fix Unix ARM JIT_MemCpy and JIT_MemSet (#21141)
The functions were incorrectly using 4 byte loads to probe for the address validity. While the comment on JIT_MemCpy requires 4 byte aligned address, it doesn't match the way JIT uses it and the Windows version of the function works with unaligned addresses too. This bug was discovered as a crash in an application where the JIT_MemCpy was called with count=2 and an address that was two bytes below the end of a memory page where the following page was not mapped.
Diffstat (limited to 'src/vm')
-rw-r--r--src/vm/arm/crthelpers.S8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/vm/arm/crthelpers.S b/src/vm/arm/crthelpers.S
index b561f2790c..a7124185fa 100644
--- a/src/vm/arm/crthelpers.S
+++ b/src/vm/arm/crthelpers.S
@@ -33,7 +33,7 @@ LEAF_ENTRY JIT_MemSet, _TEXT
it eq
bxeq lr
- ldr r3, [r0]
+ ldrb r3, [r0]
b C_PLTFUNC(memset)
@@ -43,15 +43,13 @@ LEAF_END_MARKED JIT_MemSet, _TEXT
//EXTERN_C void __stdcall JIT_MemCpy(void* _dest, const void *_src, size_t count)
LEAF_ENTRY JIT_MemCpy, _TEXT
//
-// It only requires 4 byte alignment
-// and doesn't return a value
cmp r2, #0
it eq
bxeq lr
- ldr r3, [r0]
- ldr r3, [r1]
+ ldrb r3, [r0]
+ ldrb r3, [r1]
b C_PLTFUNC(memcpy)