Skip to content

libasmrun_shared.so segfaulting on s390x Fedora/RHEL #13693

@dra27

Description

@dra27

Given the same hello.ml:

Printf.printf "Hello, world of %s!\n%!" Config.architecture

and main.c as in #13692:

#include <caml/callback.h>
int main(int argc, char_os **argv)
{
  caml_startup(argv);
  caml_shutdown();
  return 0;
}

but this time compiled with:

$ ocamlopt -output-obj -o ocaml.o -I +compiler-libs ocamlcommon.cmxa hello.ml
$ gcc -c -I $(ocamlopt -where) main.c
$ gcc -Wl,-E -o hello -L $(ocamlopt -where) ocaml.o main.o -lcomprmarsh -lasmrun_shared -lm -lpthread

the resulting executable segfaults:

$ LD_LIBRARY_PATH=/home/opam/ocaml/install/lib/ocaml gdb ./hello
...
Program received signal SIGSEGV, Segmentation fault.
0x000003ffa4f4ab00 in caml_skiplist_insert (sk=0x3ffa4f689e0 <caml_global_roots_old>,
    key=35592256, data=data@entry=0) at runtime/skiplist.c:132
132           if (f == NULL || f->key >= key) break;
(gdb) bt
#0  0x000003ffa4f4ab00 in caml_skiplist_insert (sk=0x3ffa4f689e0 <caml_global_roots_old>,
    key=35592256, data=data@entry=0) at runtime/skiplist.c:132
#1  0x000003ffa4f30fbe in caml_insert_global_root (list=<optimized out>, r=<optimized out>)
    at runtime/globroots.c:63
#2  caml_register_generational_global_root (r=r@entry=0x21f1840) at runtime/globroots.c:122
#3  0x000003ffa4f24eae in caml_register_named_value (vname=<optimized out>,
    val=<optimized out>) at runtime/callback.c:411
#4  <signal handler called>
#5  0x000003ffa4d196b8 in ?? () from /lib64/libc.so.6
Backtrace stopped: frame did not save the PC

There is a similar segfault with 4.14.2 - although in that case the program does manage to display its line of output prior to segfaulting.

Reliably seen on RHEL 8.9 (on the IBM LinuxONE VM provided for Inria's CI) and in Fedora 41 (running in Docker on Ubuntu 24.04.1 on one of the IBM LinuxONE VMs provided for ecosystem cluster). This test works correctly in Ubuntu 24.04.1, however (and the test itself is working on all other architectures and platforms).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions