This is Xamarin's bug tracking system. For product support, please use the support links listed in your Xamarin Account.
Bug 44918 - "Assertion mini-arm.c:434, condition `lmf_addr_tls_offset != -1' not met" prevent mono to run on ARM
Summary: "Assertion mini-arm.c:434, condition `lmf_addr_tls_offset != -1' not met" pre...
Status: RESOLVED FIXED
Alias: None
Product: Runtime
Classification: Mono
Component: misc (show other bugs)
Version: Trunk
Hardware: Other Linux
: --- normal
Target Milestone: ---
Assignee: Vlad Brezae
URL:
Depends on:
Blocks:
 
Reported: 2016-09-30 09:44 UTC by Sylvain
Modified: 2017-04-03 05:58 UTC (History)
8 users (show)

See Also:
Tags:
Is this bug a regression?: Yes
Last known good build: 4.4.2.11


Attachments

Description Sylvain 2016-09-30 09:44:05 UTC
Everything's fine with all mono versions prior to 4.6.x.

ARM system running petalinux. Executable built with Visual Studio 2015, .Net 4.5.2

When executing "mono myPrg.exe", fails to run with message:
"
No fast tls on device. Using fallbacks. Current implementation :
0xee1d0f70 0xe12fff1e 0xe320f000 0xe320f000 0xe59f3018 0xe3a01000 0xe59f2014 0xe08f3003 0xe7932002 0xe3520000 0x15922000 0xeaf81aa8 0xb6904 0x734 0xe1a02001 0xe1a01000
* Assertion at ../../../mono-src/mono/mini/mini-arm.c:434, condition `lmf_addr_tls_offset != -1' not met

Stacktrace:

  at <unknown> <0xffffffff>
  at System.Exception..cctor () <0x00013>
  at (wrapper runtime-invoke) object.runtime_invoke_void (object,intptr,intptr,intptr) <0x0006f>
  at <unknown> <0xffffffff>
  at System.SystemException..ctor (string) <0x0001b>
  at System.OutOfMemoryException..ctor (string) <0x0001b>
  at (wrapper runtime-invoke) <Module>.runtime_invoke_void__this___object (object,intptr,intptr,intptr) <0x000d7>

Native stacktrace:


Debug info from gdb:


=================================================================
Got a SIGABRT while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries
used by your application.
=================================================================

Aborted
"

mono --version says:
"
Mono JIT compiler version 4.6.1 (Stable 4.6.1.3/abb06f1 Thu Sep 29 07:41:25 PDT 2016)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
        TLS:           __thread
        SIGSEGV:       normal
        Notifications: epoll
        Architecture:  armel,vfp+hard
        Disabled:      attach,com
        Misc:          softdebug
        LLVM:          supported, not enabled.
        GC:            sgen
"
Comment 1 Sylvain 2016-10-03 08:27:43 UTC
Build configure options are: CONF_OPTS=--prefix=$(PREFIX) --disable-mcs-build --with-mcs-doc=no --disable-boehm --with-sgen=yes --with-static_mono=yes --with-xen-opt=no --with-moonlight=no --with-ikvm-native=no --enable-minimal=attach,com
Comment 2 Sylvain 2016-10-03 15:00:45 UTC
Note: same issue with:
CONF_OPTS=--prefix=$(PREFIX) --disable-mcs-build --with-mcs-doc=no
Comment 3 solabc16 2016-10-05 01:03:08 UTC
Hello

FYI, we've just started testing v4.6.x with Marvel Armada 38x processors and discovered the same.

---------------------------------

Mono JIT compiler version 4.6.0 (Stable 4.6.0.245/746756c Tue Oct  4 17:34:54 CST 2016)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
	TLS:           __thread
	SIGSEGV:       normal
	Notifications: epoll
	Architecture:  armel,vfp+hard
	Disabled:      none
	Misc:          softdebug 
	LLVM:          supported, not enabled.
	GC:            sgen

---------------------------------

No fast tls on device. Using fallbacks. Current implementation : 
0xee1d0f70 0xe12fff1e 0xe320f000 0xe320f000 0xe59f3018 0xe3a01000 0xe59f2014 0xe08f3003 0xe7932002 0xe3520000 0x15922000 0xeaf9c9c2 0xb9a78 0x5c8 0x46c04778 0xeafffff3 
* Assertion at mini-arm.c:434, condition `lmf_addr_tls_offset != -1' not met

---------------------------------

Stacktrace:

  at <unknown> <0xffffffff>
  at System.Exception..cctor () <0x00013>
  at (wrapper runtime-invoke) object.runtime_invoke_void (object,intptr,intptr,intptr) <0x0006f>
  at <unknown> <0xffffffff>
  at System.SystemException..ctor (string) <0x0001b>
  at System.OutOfMemoryException..ctor (string) <0x0001b>
  at (wrapper runtime-invoke) <Module>.runtime_invoke_void__this___object (object,intptr,intptr,intptr) <0x000d7>

Native stacktrace:


Debug info from gdb:


=================================================================
Got a SIGABRT while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries 
used by your application.
=================================================================

---------------------------------

Best
- James
Comment 4 Vlad Brezae 2016-11-01 19:44:16 UTC
Hello,

     If you are building from source, could you check whether this commit[1] fixes the problem ? The __thread support is a mess, we are considering to remove it in the near future.

Vlad

https://github.com/BrzVlad/mono/commit/831e66655e7465023109333fca31d036c7b9a514
Comment 5 wince 2016-11-02 10:34:27 UTC
Hello, I also have this issue. I tried to build 
http://download.mono-project.com/sources/mono/mono-4.6.1.5.tar.bz2
with modified mini-arm.c as described above but still have this problem.

==

No fast tls on device. Using fallbacks. Current implementation :
0xee1d0f70 0xe12fff1e 0xe320f000 0xe320f000 0xe59f3018 0xe3a01000 0xe59f2014 0xe08f3003 0xe7932002 0xe3520000 0x15922000 0xeaf73eec 0xb19f8 0x4c8 0xe92d4008 0xe8bd8008

==

Mono JIT compiler version 4.6.1 (Stable 4.6.1.5/ef43c15 Wed Nov  2 13:00:16 MSK 2016)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
        TLS:           __thread
        SIGSEGV:       normal
        Notifications: epoll
        Architecture:  armel,vfp+hard
        Disabled:      none
        Misc:          softdebug
        LLVM:          supported, not enabled.
        GC:            sgen

==

Linux ts-imx6-s 3.10.17 #97a49b7 SMP 2016-10-03 17:01:04+03:00 armv7l GNU/Linux
Comment 6 Vlad Brezae 2016-11-02 11:05:33 UTC
@wince It's not clear from your message if you get the `lmf_addr_tls_offset != -1` assertion or not. The no fast tls warning is not problematic.
Comment 7 wince 2016-11-02 11:22:37 UTC
No, I do not have this assert. Only "No fast tls on device" message each time when mono application finished.
Comment 8 Sylvain 2016-11-02 14:10:40 UTC
Hello Vlad,
Thanks a lot.
Short answer: your fix does the trick: with it it works without warning nor error!
Please push it to main trunk as soon as you can.
Thanks a lot!

Longer answer:

1) I built mono from sources, from mono-4.6.1.5.tar.bz2, and *applied you commit* (i.e. I just added "&& !defined(__PIC__)" at line 34 of mono/mini/mini-arm.c)
When I execute mono in the same condition as I always do, I do not get neither the warning about TLS, nor the assert (nor any other unexpected message). 
As far as I can tell everything is now clean and fine and running well.

So: your fix indeed completely fix the issue, thanks a lot!

2) I built mono from sources, from mono-4.6.1.5.tar.bz2 and did not touch anything (to have reference): I get both warning and assert and program termination:
Here is the output:
No fast tls on device. Using fallbacks. Current implementation :
0xee1d0f70 0xe12fff1e 0xe320f000 0xe320f000 0xe59f3018 0xe3a01000 0xe59f2014 0xe08f3003 0xe7932002 0xe3520000 0x15922000 0xeaf81aa8 0xb6904 0x734 0xe1a02001 0xe1a01000
* Assertion at ../../../mono-src/mono/mini/mini-arm.c:434, condition `lmf_addr_tls_offset != -1' not met

Stacktrace:

  at <unknown> <0xffffffff>
  at System.Exception..cctor () <0x00013>
  at (wrapper runtime-invoke) object.runtime_invoke_void (object,intptr,intptr,intptr) <0x0006f>
  at <unknown> <0xffffffff>
  at System.SystemException..ctor (string) <0x0001b>
  at System.OutOfMemoryException..ctor (string) <0x0001b>
  at (wrapper runtime-invoke) <Module>.runtime_invoke_void__this___object (object,intptr,intptr,intptr) <0x000d7>

Native stacktrace:


Debug info from gdb:

warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available.
warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available.
0x36e5ab28 in waitpid () from /lib/arm-linux-gnueabihf/libpthread.so.0
  Id   Target Id         Frame
* 1    LWP 897 "Main"    0x36e5ab28 in waitpid () from /lib/arm-linux-gnueabihf/libpthread.so.0

Thread 1 (LWP 897):
#0  0x36e5ab28 in waitpid () from /lib/arm-linux-gnueabihf/libpthread.so.0
#1  0x000a90b0 in mono_handle_native_sigsegv (signal=<optimized out>, ctx=<optimized out>, info=<optimized out>) at ../../../mono-src/mono/mini/mini-exceptions.c:2427
#2  <signal handler called>
#3  0x36d3a3c4 in raise () from /lib/arm-linux-gnueabihf/libc.so.6
#4  0x36d3df58 in abort () from /lib/arm-linux-gnueabihf/libc.so.6
#5  0x0020fc24 in monoeg_log_default_handler (log_domain=<optimized out>, log_level=920944812, message=<optimized out>, unused_data=<optimized out>) at ../../../mono-src/eglib/src/goutput.c:233
#6  0x0020fdc4 in monoeg_g_logv (log_domain=log_domain@entry=0x0, log_level=log_level@entry=G_LOG_LEVEL_ERROR, format=format@entry=0x0, args=..., args@entry=...) at ../../../mono-src/eglib/src/goutput.c:113
#7  0x0020fe28 in monoeg_assertion_message (format=0x218c0b "* Assertion at %s:%d, condition `%s' not met\n") at ../../../mono-src/eglib/src/goutput.c:133
#8  0x000d926c in mono_arch_emit_prolog (cfg=cfg@entry=0x343518) at ../../../mono-src/mono/mini/mini-arm.c:6249
#9  0x000e4674 in mono_codegen (cfg=cfg@entry=0x343518) at ../../../mono-src/mono/mini/mini.c:2302
#10 0x000e6c2c in mini_method_compile (method=method@entry=0x33f7f8, opts=opts@entry=370224127, domain=domain@entry=0x30c5b8, flags=flags@entry=JIT_FLAG_RUN_CCTORS, parts=parts@entry=0, aot_method_index=aot_method_index@entry=-1) at ../../../mono-src/mono/mini/mini.c:3894
#11 0x000e74c0 in mono_jit_compile_method_inner (method=method@entry=0x33f7f8, target_domain=target_domain@entry=0x30c5b8, opt=opt@entry=370224127, error=error@entry=0x3ee8eda4) at ../../../mono-src/mono/mini/mini.c:4197
#12 0x00034c78 in mono_jit_compile_method_with_opt (method=method@entry=0x33f7f8, opt=370224127, error=0x3ee8eda4, error@entry=0xac0f4 <mono_magic_trampoline+88>) at ../../../mono-src/mono/mini/mini-runtime.c:1910
#13 0x0003542c in mono_jit_compile_method (method=method@entry=0x33f7f8, error=error@entry=0xac0f4 <mono_magic_trampoline+88>) at ../../../mono-src/mono/mini/mini-runtime.c:1954
#14 0x000abc30 in common_call_trampoline (regs=regs@entry=0x3ee8ee90, code=code@entry=0x36cbbfec "", m=m@entry=0x33f7f8, vt=vt@entry=0x0, vtable_slot=<optimized out>, vtable_slot@entry=0x0, error=error@entry=0x3ee8eda4) at ../../../mono-src/mono/mini/mini-trampolines.c:702
#15 0x000ac0f4 in mono_magic_trampoline (regs=0x3ee8ee90, code=0x36cbbfec "", arg=0x33f7f8, tramp=<optimized out>) at ../../../mono-src/mono/mini/mini-trampolines.c:828
#16 0x36cfe074 in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)

=================================================================
Got a SIGABRT while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries
used by your application.
=================================================================

Aborted
Comment 9 solabc16 2016-11-03 00:42:01 UTC
Hello Vlad

Thanks for the patch, we'll get this tested over the next few days.

Thanks Sylvain for your update above.

Best
- James
Comment 10 Barry G 2016-11-07 19:09:07 UTC
Just another datapoint; I have the patch (https://github.com/BrzVlad/mono/commit/831e66655e7465023109333fca31d036c7b9a514) in my build and I am still getting the warning but not the assert:
root@host:~# mono -V
Mono JIT compiler version 4.6.1 (Stable 4.6.1.5/ef43c15 Mon Nov  7 10:37:55 PST 2016)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
        TLS:           __thread
        SIGSEGV:       normal
        Notifications: epoll
        Architecture:  armel,vfp
        Disabled:      none
        Misc:          softdebug 
        LLVM:          supported, not enabled.
        GC:            sgen

root@host:~# mono hello.exe 
No fast tls on device. Using fallbacks. Current implementation : 
0xee1d0f70 0xe12fff1e 0xe320f000 0xe320f000 0xe59f3018 0xe3a01000 0xe59f2014 0xe08f3003 0xe7932002 0xe3520000 0x15922000 0xeaf7467d 0xb992c 0x4c8 0xe92d4008 0xe8bd8008 
Hello, World!

root@host:~# cat /proc/cpuinfo 
processor       : 0
model name      : ARMv7 Processor rev 0 (v7l)
BogoMIPS        : 200.00
Features        : half thumb fastmult vfp edsp thumbee neon vfpv3 tls vfpd32 
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x3
CPU part        : 0xc09
CPU revision    : 0

processor       : 1
model name      : ARMv7 Processor rev 0 (v7l)
BogoMIPS        : 200.00
Features        : half thumb fastmult vfp edsp thumbee neon vfpv3 tls vfpd32 
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x3
CPU part        : 0xc09
CPU revision    : 0

Thanks!

Barry
Comment 11 wince 2016-11-07 20:24:49 UTC
I also see this warning (without assert) in my build mono 4.6.2.6 + patch above.
Comment 12 Vlad Brezae 2016-11-22 15:22:09 UTC
Sorry for delay. This patch should be present on the beta channel. You can reinstall mono using the instructions from [1]. Let me know if it works ok and we will move it soon to stable.

[1] http://www.mono-project.com/docs/getting-started/install/linux/#beta-update-channel
Comment 13 Sylvain 2016-11-22 16:40:02 UTC
Hi Vlad,

I need to build from sources in order to try to reproduce the issue in original conditions (cross build to ARM).

I did check your patch (see comment 8) and found it working.
Comment 14 Brandon White 2016-11-28 17:08:32 UTC
This is not yet in the alpha channel for 4.8.
Comment 15 solabc16 2017-01-06 08:45:03 UTC
Hello All

FYI, I've been testing up to and including the 4.6.2.7 release on the following ARM machines, with the above patch included.

I can confirm that this has resolved the issue identified on these machines and we've now released 4.6.2.7 for these platforms to our stable channel.

    "6281"
    "armadaxp"
    "armada370"
    "armada375"
    "armada38x"
    "monaco"
    "comcerto2k"
    "qoriq"
    "alpine"
    "alpine4k"

I see that 4.6.2.16 does not have the patch included, so will continually to apply manually.

Best
- James
Comment 16 solabc16 2017-01-06 08:46:41 UTC
Correction, the machine list should be:-

    "6281"
    "armadaxp"
    "armada370"
    "armada375"
    "armada38x"
    "monaco"
    "comcerto2k"
    "alpine"
    "alpine4k"

Best
- James
Comment 17 Vlad Brezae 2017-01-09 22:10:20 UTC
This is fixed on 4.8. No additional changes are planned for 4.6
Comment 18 solabc16 2017-01-09 22:46:15 UTC
Thanks for the update Vlad, do you have a view as to when we can expect 4.8 to be released?

- James
Comment 19 Vlad Brezae 2017-01-09 22:57:05 UTC
Hey James. You can already access the fix from the alpha builds. An official stable release is probably a couple of weeks away.
Comment 20 Rikard Johansson 2017-04-03 05:58:17 UTC
Additional information to comment 10: the warning disappears if mono is compiled with hard float support (adding CFLAGS=-DARM_FPU_VFP_HARD=1).


This version produces the warning:
$ mono --version
Mono JIT compiler version 4.6.2 (Stable 4.6.2.16/ac9e222 Thu Mar 30 12:52:31 CEST 2017)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
        TLS:           __thread
        SIGSEGV:       normal
        Notifications: epoll
        Architecture:  armel,vfp
        Disabled:      profiler,logging,attach,full_messages,reflection_emit_save,simd
        Misc:          smallconfig softdebug
        LLVM:          supported, not enabled.
        GC:            sgen


While this one doesn't:
$ mono --version
Mono JIT compiler version 4.6.2 (Stable 4.6.2.16/ac9e222 Thu Jan 26 14:16:16 CET 2017)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
	TLS:           __thread
	SIGSEGV:       normal
	Notifications: epoll
	Architecture:  armel,vfp+hard
	Disabled:      profiler,logging,attach,full_messages,reflection_emit_save,simd
	Misc:          smallconfig softdebug
	LLVM:          supported, not enabled.
	GC:            sgen

Note You need to log in before you can comment on or make changes to this bug.