Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 915985 - dev-lang/mono-6.12.0.182: segfaults during build with sys-devel/gcc-13
Summary: dev-lang/mono-6.12.0.182: segfaults during build with sys-devel/gcc-13
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: No maintainer - Look at https://wiki.gentoo.org/wiki/Project:Proxy_Maintainers if you want to take care of it
URL:
Whiteboard:
Keywords:
: 925507 (view as bug list)
Depends on:
Blocks: gcc-13 915000
  Show dependency tree
 
Reported: 2023-10-19 01:15 UTC by Maciej Mrozowski
Modified: 2024-02-27 23:30 UTC (History)
5 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Contents of var_tmp_portage temp dir (temp.tar.xz,84.00 KB, application/x-xz)
2023-10-19 01:15 UTC, Maciej Mrozowski
Details
emerge --info (emerge--info.txt,21.05 KB, text/plain)
2023-10-19 01:18 UTC, Maciej Mrozowski
Details
mono build logs. Fails due to a SIGABRT. (mono-logs.tar.xz,53.42 KB, application/x-xz)
2023-11-08 04:12 UTC, Manuel
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Maciej Mrozowski gentoo-dev 2023-10-19 01:15:56 UTC
Created attachment 873123 [details]
Contents of var_tmp_portage temp dir

This is Gentoo stable with some selected ~arch packages.

[ebuild     U  ] dev-lang/mono-6.12.0.182::gentoo [6.12.0.122::gentoo] USE="-doc -minimal -nls -pax-kernel (-selinux) -xen" ABI_X86="(64) -32 (-x32)" 0 KiB

Mono fails to build due to sandbox violation, relevant part of build log:

Creating ../../build/deps/linux_net_4_x_Mono.XBuild.Tasks_test.dll.makefrag ...
Creating ../../build/deps/linux_net_4_x_Microsoft.Build.Tasks_test.dll.makefrag ...
Creating ../../build/deps/linux_net_4_x_Microsoft.Build_test.dll.makefrag ...
Creating ../../build/deps/linux_net_4_x_corlib_test.dll.makefrag ...
Creating ../../build/deps/linux_net_4_x_corlib_xtest.dll.makefrag ...
Assembling '../../class/corlib/System.Runtime.CompilerServices/Unsafe.il' , no listing file, to dll --> '../../class/lib/net_4_x-linux/corlib.unsafe.dll.tmp'

../../class/corlib/System.Runtime.CompilerServices/Unsafe.il : Warning -- Reference to undeclared extern assembly 'mscorlib', adding.
* Assertion: should not be reached at icall.c:4157


=================================================================
        Native Crash Reporting
=================================================================
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.
=================================================================

=================================================================
        Native stacktrace:
=================================================================
        0x55f13666e93a - /var/tmp/portage/dev-lang/mono-6.12.0.182/work/mono-6.12.0.182-abi_x86_64.amd64/mono/mini/mono : 
        0x55f13666ed39 - /var/tmp/portage/dev-lang/mono-6.12.0.182/work/mono-6.12.0.182-abi_x86_64.amd64/mono/mini/mono : 
        0x55f136612571 - /var/tmp/portage/dev-lang/mono-6.12.0.182/work/mono-6.12.0.182-abi_x86_64.amd64/mono/mini/mono : 
        0x55f13666dda1 - /var/tmp/portage/dev-lang/mono-6.12.0.182/work/mono-6.12.0.182-abi_x86_64.amd64/mono/mini/mono : 
        0x7f8237585d60 - /usr/lib64/libc.so.6 : 
        0x7f82375d4d5c - /usr/lib64/libc.so.6 : 
        0x7f8237585cb2 - /usr/lib64/libc.so.6 : gsignal
        0x7f823756f22d - /usr/lib64/libc.so.6 : abort
        0x55f1365c46c7 - /var/tmp/portage/dev-lang/mono-6.12.0.182/work/mono-6.12.0.182-abi_x86_64.amd64/mono/mini/mono : 
        0x55f13691a8ce - /var/tmp/portage/dev-lang/mono-6.12.0.182/work/mono-6.12.0.182-abi_x86_64.amd64/mono/mini/mono : 
        0x55f13693dab3 - /var/tmp/portage/dev-lang/mono-6.12.0.182/work/mono-6.12.0.182-abi_x86_64.amd64/mono/mini/mono : monoeg_assertion_message
        0x55f13693db37 - /var/tmp/portage/dev-lang/mono-6.12.0.182/work/mono-6.12.0.182-abi_x86_64.amd64/mono/mini/mono : 
        0x55f1367a60d1 - /var/tmp/portage/dev-lang/mono-6.12.0.182/work/mono-6.12.0.182-abi_x86_64.amd64/mono/mini/mono : 
        0x55f1367b370b - /var/tmp/portage/dev-lang/mono-6.12.0.182/work/mono-6.12.0.182-abi_x86_64.amd64/mono/mini/mono : 
        0x402c8a77 - Unknown

=================================================================
        Telemetry Dumper:
=================================================================
Pkilling 0x140197205374656x from 0x140197250782720x
Entering thread summarizer pause from 0x140197250782720x
Finished thread summarizer pause from 0x140197250782720x.
Failed to create breadcrumb file (null)/crash_hash_0x1c0e84c85
/var/tmp/portage/dev-lang/mono-6.12.0.182/work/mono-6.12.0.182-abi_x86_64.amd64/runtime/etc/../bin/mono-hang-watchdog: line 3: /var/tmp/portage/dev-lang/mono-6.12.0.182/work/mono-6.12.0.182-abi_x86_64.amd64/tools/mono-hang-watchdog/mono-hang-watchdog: No such file or directory

Waiting for dumping threads to resume

=================================================================
        External Debugger Dump:
=================================================================
 * ACCESS DENIED:  open_wr:            /proc/21583/task/21583/mem
warning: opening /proc/PID/mem file for lwp 21583.21583 failed: Permission denied (13)
[New LWP 21621]
[New LWP 21622]
 * ACCESS DENIED:  open_wr:            /proc/self/mem
warning: opening /proc/self/mem file failed: Permission denied (13)
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib64/libthread_db.so.1".
0x00007f823761d18a in wait4 () from /usr/lib64/libc.so.6
  Id   Target Id                                       Frame 
* 1    Thread 0x7f823754d600 (LWP 21583) "mono"        0x00007f823761d18a in wait4 () from /usr/lib64/libc.so.6
  2    Thread 0x7f8236fff6c0 (LWP 21621) "SGen worker" 0x00007f82375cfb25 in ?? () from /usr/lib64/libc.so.6
  3    Thread 0x7f82349ff6c0 (LWP 21622) "Finalizer"   0x00007f82375cfb25 in ?? () from /usr/lib64/libc.so.6

Thread 3 (Thread 0x7f82349ff6c0 (LWP 21622) "Finalizer"):
#0  0x00007f82375cfb25 in ?? () from /usr/lib64/libc.so.6
#1  0x00007f82375dad98 in ?? () from /usr/lib64/libc.so.6
#2  0x000055f1368a6b74 in mono_os_sem_wait (flags=MONO_SEM_FLAGS_ALERTABLE, sem=0x55f136aa47e0 <finalizer_sem>) at ../../mono/utils/mono-os-semaphore.h:203
#3  mono_coop_sem_wait (flags=MONO_SEM_FLAGS_ALERTABLE, sem=0x55f136aa47e0 <finalizer_sem>) at ../../mono/utils/mono-coop-semaphore.h:41
#4  finalizer_thread (unused=unused@entry=0x0) at gc.c:965
#5  0x000055f13685192a in start_wrapper_internal (stack_ptr=<optimized out>, start_info=0x0) at threads.c:1233
#6  start_wrapper (data=0x55f137e88300) at threads.c:1308
#7  0x00007f82375d3039 in ?? () from /usr/lib64/libc.so.6
#8  0x00007f823764ff4c in ?? () from /usr/lib64/libc.so.6

Thread 2 (Thread 0x7f8236fff6c0 (LWP 21621) "SGen worker"):
#0  0x00007f82375cfb25 in ?? () from /usr/lib64/libc.so.6
#1  0x00007f82375d2352 in pthread_cond_wait () from /usr/lib64/libc.so.6
#2  0x000055f13691124f in mono_os_cond_wait (cond=0x55f136ab39c0 <work_cond>, mutex=0x55f136ab3a00 <lock>) at ../../mono/utils/mono-os-mutex.h:219
#3  get_work (job=<synthetic pointer>, do_idle=<synthetic pointer>, work_context=<synthetic pointer>, worker_index=<optimized out>) at sgen-thread-pool.c:165
#4  thread_func (data=<optimized out>) at sgen-thread-pool.c:196
#5  0x00007f82375d3039 in ?? () from /usr/lib64/libc.so.6
#6  0x00007f823764ff4c in ?? () from /usr/lib64/libc.so.6

Thread 1 (Thread 0x7f823754d600 (LWP 21583) "mono"):
#0  0x00007f823761d18a in wait4 () from /usr/lib64/libc.so.6
#1  0x000055f13666ec00 in dump_native_stacktrace (signal=signal@entry=0x55f13695fdb6 "SIGABRT", mctx=mctx@entry=0x7fff2d2488c0) at mini-posix.c:1113
#2  0x000055f13666ed39 in mono_dump_native_crash_info (signal=signal@entry=0x55f13695fdb6 "SIGABRT", mctx=mctx@entry=0x7fff2d2488c0, info=info@entry=0x7fff2d248bb0) at mini-posix.c:1157
#3  0x000055f136612571 in mono_handle_native_crash (signal=0x55f13695fdb6 "SIGABRT", mctx=mctx@entry=0x7fff2d2488c0, info=info@entry=0x7fff2d248bb0) at mini-exceptions.c:3423
#4  0x000055f13666dda1 in sigabrt_signal_handler (_dummy=<optimized out>, _info=0x7fff2d248bb0, context=0x7fff2d248a80) at mini-posix.c:235
#5  <signal handler called>
#6  0x00007f82375d4d5c in ?? () from /usr/lib64/libc.so.6
#7  0x00007f8237585cb2 in raise () from /usr/lib64/libc.so.6
#8  0x00007f823756f22d in abort () from /usr/lib64/libc.so.6
#9  0x000055f1365c46c7 in monoeg_assert_abort () at goutput.c:57
#10 0x000055f13691a8ce in mono_log_write_logfile (log_domain=<optimized out>, level=<optimized out>, hdr=<optimized out>, message=0x55f13819fff0 "* Assertion: should not be reached at icall.c:4157\n") at mono-log-common.c:136
#11 0x000055f13693dab3 in monoeg_g_logstr (msg=<optimized out>, log_level=G_LOG_LEVEL_ERROR, log_domain=0x0) at goutput.c:151
#12 monoeg_g_logv_nofree (args=0x7fff2d249220, format=0x55f136a16fd0 "* Assertion: should not be reached at %s:%d\n", log_level=G_LOG_LEVEL_ERROR, log_domain=0x0) at goutput.c:166
#13 monoeg_assertion_message (format=format@entry=0x55f136a16fd0 "* Assertion: should not be reached at %s:%d\n") at goutput.c:201
#14 0x000055f13693db37 in mono_assertion_message_unreachable (file=file@entry=0x55f136987d40 "icall.c", line=line@entry=4157) at goutput.c:228
#15 0x000055f1367a60d1 in read_enum_value (type=5, mem=<optimized out>) at icall.c:4157
#16 get_enum_field (error=0x7fff2d2493e0, sorted=<synthetic pointer>, previous_value=<synthetic pointer>, j=<synthetic pointer>, field=0x55f138565550, base_type=5, values=..., names=..., domain=<optimized out>) at icall.c:4447
#17 ves_icall_System_Enum_GetEnumValuesAndNames (type=..., type@entry=..., values=..., values@entry=..., names=names@entry=..., error=error@entry=0x7fff2d2493e0) at icall.c:4494
#18 0x000055f1367b370b in ves_icall_System_Enum_GetEnumValuesAndNames_raw (a0=0x7fff2d2494c0, a1=0x7fff2d2494b0, a2=0x7fff2d2494b8) at ../../mono/metadata/icall-def.h:297
#19 0x00000000402c8a77 in ?? ()
#20 0x000000000000001e in ?? ()
#21 0x0000000000000000 in ?? ()
[Inferior 1 (process 21583) detached]

=================================================================
        Basic Fault Address Reporting
=================================================================
Memory around native instruction pointer (0x7f82375d4d5c):0x7f82375d4d4c  04 00 44 89 ea 89 c7 89 de b8 ea 00 00 00 0f 05  ..D.............
0x7f82375d4d5c  89 c3 f7 db 3d 00 f0 ff ff b8 00 00 00 00 0f 47  ....=..........G
0x7f82375d4d6c  c3 e9 78 ff ff ff 66 66 2e 0f 1f 84 00 00 00 00  ..x...ff........
0x7f82375d4d7c  00 0f 1f 00 4c 89 e7 e8 e8 af ff ff e9 44 ff ff  ....L........D..

=================================================================
        Managed Stacktrace:
=================================================================
          at <unknown> <0xffffffff>
          at System.Enum:GetEnumValuesAndNames <0x000a6>
          at System.Enum:GetCachedValuesAndNames <0x000af>
          at System.Enum:InternalGetValues <0x00026>
          at System.RuntimeType:GetEnumName <0x00065>
          at System.Enum:GetName <0x00047>
          at System.Enum:InternalFormat <0x0004e>
          at System.Enum:ToString <0x00064>
          at Mono.ILASM.GenericParamRef:Resolve <0x000ac>
          at Mono.ILASM.ParamDef:Define <0x00063>
          at Mono.ILASM.MethodDef:Resolve <0x00077>
          at Mono.ILASM.MethodDef:Define <0x00077>
          at Mono.ILASM.TypeDef:DefineContents <0x00403>
          at Mono.ILASM.CodeGen:Write <0x00997>
          at DriverMain:Run <0x0048b>
          at Mono.ILASM.Driver:Main <0x000af>
          at <Module>:runtime_invoke_int_object <0x00091>
=================================================================
make[8]: *** [il/il.make:4: ../../class/lib/net_4_x-linux/corlib.unsafe.dll.tmp] Aborted (core dumped)
make[8]: *** Deleting file '../../class/lib/net_4_x-linux/corlib.unsafe.dll.tmp'
make[7]: *** [../../build/rules.make:220: do-all] Error 2
make[6]: *** [../build/rules.make:241: all-recursive] Error 1
make[5]: *** [build/rules.make:241: all-recursive] Error 1
make[4]: *** [Makefile:58: profile-do--net_4_x--all] Error 2
make[3]: *** [Makefile:54: profiles-do--all] Error 2
make[2]: *** [Makefile:709: all-mcs] Error 2
make[2]: Leaving directory '/var/tmp/portage/dev-lang/mono-6.12.0.182/work/mono-6.12.0.182-abi_x86_64.amd64/runtime'
make[1]: *** [Makefile:602: all-recursive] Error 1
make[1]: Leaving directory '/var/tmp/portage/dev-lang/mono-6.12.0.182/work/mono-6.12.0.182-abi_x86_64.amd64'
make: *** [Makefile:530: all] Error 2
 * ERROR: dev-lang/mono-6.12.0.182::gentoo failed (compile phase):
 *   emake failed
 * 
 * If you need support, post the output of `emerge --info '=dev-lang/mono-6.12.0.182::gentoo'`,
 * the complete build log and the output of `emerge -pqv '=dev-lang/mono-6.12.0.182::gentoo'`.
 * The complete build log is located at '/var/tmp/portage/dev-lang/mono-6.12.0.182/temp/build.log'.
 * The ebuild environment file is located at '/var/tmp/portage/dev-lang/mono-6.12.0.182/temp/environment'.
 * Working directory: '/var/tmp/portage/dev-lang/mono-6.12.0.182/work/mono-6.12.0.182-abi_x86_64.amd64'
 * S: '/var/tmp/portage/dev-lang/mono-6.12.0.182/work/mono-6.12.0.182'
 * ----------------------- SANDBOX ACCESS VIOLATION SUMMARY -----------------------
 * LOG FILE: "/var/tmp/portage/dev-lang/mono-6.12.0.182/temp/sandbox.log"
 * 
VERSION 1.0
FORMAT: F - Function called
FORMAT: S - Access Status
FORMAT: P - Path as passed to function
FORMAT: A - Absolute Path (not canonical)
FORMAT: R - Canonical Path
FORMAT: C - Command Line

F: open_wr
S: deny
P: /proc/12521/task/12521/mem
A: /proc/12521/task/12521/mem
R: /proc/12521/task/12521/mem
C: /usr/bin/gdb -batch -x /tmp/mono-gdb-commands.12521 -nx 

F: open_wr
S: deny
P: /proc/self/mem
A: /proc/self/mem
R: /proc/13412/mem
C: /usr/bin/gdb -batch -x /tmp/mono-gdb-commands.12521 -nx 

F: open_wr
S: deny
P: /proc/21583/task/21583/mem
A: /proc/21583/task/21583/mem
R: /proc/21583/task/21583/mem
C: /usr/bin/gdb -batch -x /tmp/mono-gdb-commands.21583 -nx 

F: open_wr
S: deny
P: /proc/self/mem
A: /proc/self/mem
R: /proc/21628/mem
C: /usr/bin/gdb -batch -x /tmp/mono-gdb-commands.21583 -nx 
 * --------------------------------------------------------------------------------
Comment 1 Maciej Mrozowski gentoo-dev 2023-10-19 01:18:22 UTC
Created attachment 873124 [details]
emerge --info
Comment 2 Maciej Mrozowski gentoo-dev 2023-10-19 01:25:43 UTC
As it also happens to my currently merged mono-6.12.0.122, something must have happened to my build env instead.
Comment 3 Brian G. Olson 2023-10-20 16:22:13 UTC
I had the same problem. I switched to gcc v12 (from v13) and got Mono to compile and install fine. I guess Mono doesn't like gcc 13.
Comment 4 Benjamin Block 2023-10-22 12:12:57 UTC
(In reply to Brian G. Olson from comment #3)
> I had the same problem. I switched to gcc v12 (from v13) and got Mono to
> compile and install fine. I guess Mono doesn't like gcc 13.

Same here.

Compiled `dev-lang/mono-6.12.0.182` with `sys-devel/gcc-13.2.1_p20231014`, it fails with the same error/assertion as in https://bugs.gentoo.org/915985#c0.

Compiled `dev-lang/mono-6.12.0.182` with `sys-devel/gcc-12.3.1_p20230825`, it is successful.

Nothing else changed in the system between the compiler change.
Comment 5 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-11-08 03:00:10 UTC
The sandbox failure isn't fatal - it crashes before that, and then tries to invoke gdb to make the log more helpful, and that's where the sandbox violation comes in.
Comment 6 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-11-08 03:03:44 UTC
https://github.com/mono/mono/compare/mono-6.12.0.182...mono-6.12.0.199

Please try 6.12.0.199.
Comment 7 Manuel 2023-11-08 03:52:59 UTC
mono-6.12.0.199 also fails due to a SIGABRT.

These are my logs:
https://zxe.io/tmp/Gentoo/mono-6.12.0.199.log
https://zxe.io/tmp/Gentoo/mono-6.12.0.182.log
https://zxe.io/tmp/Gentoo/emerge-info.txt
Comment 8 Manuel 2023-11-08 04:12:58 UTC
Created attachment 874303 [details]
mono build logs. Fails due to a SIGABRT.

Same logs as in my previous comment. Attached in .tar.xz
Comment 9 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-11-09 03:30:15 UTC
Can you try with -O2? Mono is a very crusty codebase and probably riddled with UB.
Comment 10 Brian G. Olson 2023-11-29 18:11:16 UTC
(In reply to Sam James from comment #9)
> Can you try with -O2? Mono is a very crusty codebase and probably riddled
> with UB.

It works when I use -O2 instead of -O3. Tested with:

dev-lang/mono-6.12.0.182
sys-devel/gcc-13.2.1_p20230826
Comment 11 Larry the Git Cow gentoo-dev 2023-12-04 08:33:12 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=619727ef09e9464f656c4d95d4fd9f6fb966fc38

commit 619727ef09e9464f656c4d95d4fd9f6fb966fc38
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2023-12-04 08:11:09 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2023-12-04 08:33:00 +0000

    dev-lang/mono: filter LTO unconditionally, force -O2, no strict aliasing
    
    It's somewhat of a miracle mono works at all nowadays, especially given
    all the scary warnings, so force a conservative build.
    
    Bug: https://bugs.gentoo.org/915985
    Signed-off-by: Sam James <sam@gentoo.org>

 dev-lang/mono/mono-6.12.0.199-r1.ebuild | 129 ++++++++++++++++++++++++++++++++
 1 file changed, 129 insertions(+)
Comment 12 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-02-27 23:30:17 UTC
*** Bug 925507 has been marked as a duplicate of this bug. ***