Uploaded image for project: 'RHEL'
  1. RHEL
  2. RHEL-92512

libffi: Testsuite failure (libffi.closure/huge_struct.c) in POWER10

Linking RHIVOS CVEs to...Migration: Automation ...SWIFT: POC ConversionSync from "Extern...XMLWordPrintable

    • No
    • Low
    • TestOnly
    • 1
    • rhel-pt-c-libs
    • ssg_platform_tools
    • 1
    • False
    • False
    • Hide

      None

      Show
      None
    • No
    • PT Libraries 2025 S09
    • None
    • None
    • Unspecified Release Note Type - Unknown
    • Unspecified
    • Unspecified
    • Unspecified
    • ppc64le
    • None

      libffi.closure/huge_struct.c testcase segfaults when being run in POWER10 systems. This does not reproduce on POWER9 or older systems.
      I was able to reproduce it out of the testsuite and retrieve a backtrace.

      To reproduce:

      rpmbuild -rc --nocheck libffi-3.4.4-10.el10.src.rpm
      cd /root/rpmbuild/BUILD/libffi-3.4.4/powerpc64le-unknown-linux-gnu/testsuite
      gcc -g  ../../testsuite/libffi.closures/huge_struct.c   -W -Wall -Wno-psabi -O2 -mlong-double-128 -I/root/rpmbuild/BUILD/libffi-3.4.4/powerpc64le-unknown-linux-gnu/testsuite/../include -I../../testsuite/../include  -I../include/.. -L../.libs  -lffi -lm  -o ./huge_struct.exe
      ./huge_struct.exe
      Segmentation fault (core dumped)
      

      Backtrace from gdb:

      (gdb) run
      Starting program: /root/rpmbuild/BUILD/libffi-3.4.4/powerpc64le-redhat-linux-gnu/testsuite/huge_struct.exe
      [Thread debugging using libthread_db enabled]
      Using host libthread_db library "/lib64/libthread_db.so.1".
      
      Program received signal SIGSEGV, Segmentation fault.
      0x00007ffff7f27504 in ffi_prep_args64 (ecif=0x7fffffffdd10, stack=<optimized out>) at ../src/powerpc/ffi_linux64.c:768
      768               gprvalue = **p_argv.us;
      Missing separate debuginfos, use: dnf debuginfo-install glibc-2.39-37.el10.ppc64le
      (gdb) bt
      #0  0x00007ffff7f27504 in ffi_prep_args64 (ecif=0x7fffffffdd10, stack=<optimized out>) at ../src/powerpc/ffi_linux64.c:768
      #1  0x00007ffff7f27ec8 in ffi_call_LINUX64 () at ../src/powerpc/linux64.S:99
      #2  0x00007ffff7f23f2c in ffi_call_int (cif=cif@entry=0x7fffffffe600, fn=<optimized out>, fn@entry=0x10001530 <test_large_fn>,
          rvalue=<optimized out>, rvalue@entry=0x7fffffffe4c0, avalue=avalue@entry=0x7fffffffe180, closure=<optimized out>,
          closure@entry=0x0) at ../src/powerpc/ffi.c:105
      #3  0x00007ffff7f26d00 in ffi_call (cif=cif@entry=0x7fffffffe600, fn=fn@entry=0x10001530 <test_large_fn>,
          rvalue=rvalue@entry=0x7fffffffe4c0, avalue=avalue@entry=0x7fffffffe180) at ../src/powerpc/ffi.c:138
      #4  0x0000000010000ec8 in main (argc=<optimized out>, argv=<optimized out>) at ../../testsuite/libffi.closures/huge_struct.c:298
      

      This was found while testing libffi-3.4.4-10.el10 but it can be reproduced in older libffi-3.4.4-8.el10 as well.

      If the test is built without -O2, the segfault does not occur:

      # gcc -g  ../../testsuite/libffi.closures/huge_struct.c   -W -Wall -Wno-psabi -mlong-double-128 -I/root/rpmbuild/BUILD/libffi-3.4.4/powerpc64le-unknown-linux-gnu/testsuite/../include -I../../testsuite/../include  -I../include/.. -L../.libs  -lffi -lm  -o ./huge_struct.exe
      # ./huge_struct.exe
      1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2: 2 3 4 5 6 7 8 9 10 11 12 0x12345679 3 4 5 6 7 8 9 10 11 12 13 0x1234567a 4 5 6 7 8 9 10 11 12 13 14 0x1234567b 5 6 7 8 9 10 11 12 13 14 15 0x1234567c 6 7
      res: 2 3 4 5 6 7 8 9 10 11 12 0x12345679 3 4 5 6 7 8 9 10 11 12 13 0x1234567a 4 5 6 7 8 9 10 11 12 13 14 0x1234567b 5 6 7 8 9 10 11 12 13 14 15 0x1234567c 6 7
      1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2: 2 3 4 5 6 7 8 9 10 11 12 0x12345679 3 4 5 6 7 8 9 10 11 12 13 0x1234567a 4 5 6 7 8 9 10 11 12 13 14 0x1234567b 5 6 7 8 9 10 11 12 13 14 15 0x1234567c 6 7
      res: 2 3 4 5 6 7 8 9 10 11 12 0x12345679 3 4 5 6 7 8 9 10 11 12 13 0x1234567a 4 5 6 7 8 9 10 11 12 13 14 0x1234567b 5 6 7 8 9 10 11 12 13 14 15 0x1234567c 6 7
      

              skolosov@redhat.com Sergey Kolosov
              rhn-support-jchecahi Jesus Checa Hidalgo
              DJ Delorie DJ Delorie
              Sergey Kolosov Sergey Kolosov
              Votes:
              0 Vote for this issue
              Watchers:
              10 Start watching this issue

                Created:
                Updated:
                Resolved: