From 812d4ed2a2d3dafd22a25e683689472a3d51b7eb Mon Sep 17 00:00:00 2001 From: Evgenii Stepanov Date: Mon, 16 Dec 2019 16:18:53 -0800 Subject: [PATCH] Relax assert in mono_arch_build_imt_trampoline. (mono/mono#18195) This assert fails when the trampoline code size worst case is realized. Observed on a Android device with HWASan [1] enabled, where heap addresses have a non-zero tag in the most significant byte, and thus require 4 instructions to materialize in emit_imm64. [1] https://source.android.com/devices/tech/debug/hwasan Commit migrated from https://github.com/mono/mono/commit/06673e723ec3d59b071a1b763680f252b71c5de4 --- src/mono/mono/mini/mini-arm64.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mono/mono/mini/mini-arm64.c b/src/mono/mono/mini/mini-arm64.c index 2ca8a21..8452d60 100644 --- a/src/mono/mono/mini/mini-arm64.c +++ b/src/mono/mono/mini/mini-arm64.c @@ -5399,7 +5399,7 @@ mono_arch_build_imt_trampoline (MonoVTable *vtable, MonoDomain *domain, MonoIMTC arm_patch_rel (item->jmp_code, imt_entries [item->check_target_idx]->code_target, MONO_R_ARM64_BCC); } - g_assert ((code - buf) < buf_len); + g_assert ((code - buf) <= buf_len); mono_arch_flush_icache (buf, code - buf); MONO_PROFILER_RAISE (jit_code_buffer, (buf, code - buf, MONO_PROFILER_CODE_BUFFER_IMT_TRAMPOLINE, NULL)); -- 2.7.4