On 06/11/2025 19:47, Bruno Haible wrote:
[CCing bug-gnulib]
Pádraig Brady wrote:
Solaris 11.4, SPARC-M8, 1 coreutils fail  (cfarm216)
...
Putting truss in the test shows the failure after vfork:

vforkx(0)                                       = 26169
lwp_sigmask(SIG_SETMASK, 0x00000000, 0x00000000, 0x00000000, 0x00000000) = 
0xFFBFFEFF [0xFFFFFFFF]
      Incurred fault #5, FLTACCESS  %pc = 0x100022468
        siginfo: SIGBUS BUS_ADRALN addr=0xFFFF2F682F68772C
      Received signal #10, SIGBUS [default]
        siginfo: SIGBUS BUS_ADRALN addr=0xFFFF2F682F68772C

Trouble with vfork on SPARC: not surprising. The "sliding register window"
of the SPARC architecture is a beast to get correctly implemented in
the kernel and in setjmp/longjmp. After vfork, the parent and the child
are supposed to
   - share the memory,
   - but have distinct register sets.
In other architectures this works reasonably, because the child process
does only minimal changes to the memory contents before it exec()s.
But on SPARC, due to the register window that can cause memory writes
simply at subroutine invocation or return, this is very hairy.

   * If I force ifdef out the VFORK call in gnulib's spawni it's OK
   * If I force the use of the system posix_spawnp it's Ok. Tested with:
     ./configure gl_cv_func_posix_spawnp_secure_exec=yes --quiet && gmake -j8
     gmake TESTS=tests/install/basic-1.sh SUBDIRS=. check

I don't immediately see what, in the spawni.c code, could violate the
unwritten rules for use of vfork().

But I've tested other SPARC platforms:
   - Linux (Debian 9)/SPARC
   - FreeBSD 12/SPARC
   - NetBSD 10/SPARC
   - OpenBSD 7.2/SPARC
and other Solaris platforms:
   - Solaris 10, 11 / x86_64
and the _only_ platforms that have a crash in the tests/install/basic-1.sh
test are Solaris 10, 11 / SPARC.

So, I'm just disabling the use of vfork() there. No further investigation
is planned, since the SPARC architecture is rarely used nowadays.

I was able to repro on cfarm202, which is Debian on UltraSparc T5.
So I think removing the "sun" is required.
Also I was more defensive with specifying __sparc64__
as I saw that elsewhere in gnulib, and UltraSparc T5 is 64 bit.
Though saying that gcc doesn't set it, but perhaps other toolchains do:

  $ gcc -E -dM - < /dev/null | grep -Fi sparc
  #define sparc 1
  #define __sparc__ 1
  #define __sparc 1
  #define __sparc_v9__ 1

cheers,
Padraig

Reply via email to