On 7.2-current/sparc64, `fork-exit` regression test fails with these errors:
==== run-fork1-heap ==== # allocate 400 MB of heap memory ulimit -p 500 -n 1000; ./fork-exit -h 100000 fork-exit: child 73240 signal 11 *** Error 1 in sys/kern/fork-exit (Makefile:60 'run-fork1-heap') FAILED ==== run-fork-heap ==== # allocate 400 MB of heap memory in processes ulimit -p 500 -n 1000; ./fork-exit -p 100 -h 1000 fork-exit: child 872 signal 11 *** Error 1 in sys/kern/fork-exit (Makefile:65 'run-fork-heap') FAILED ==== run-fork1-thread1-heap ==== # allocate 400 MB of heap memory in single child and one thread ulimit -p 500 -n 1000; ./fork-exit -t 1 -h 100000 fork-exit: child 4176 signal 11 *** Error 1 in sys/kern/fork-exit (Makefile:70 'run-fork1-thread1-heap') FAILED ==== run-fork-thread-heap ==== # allocate 400 MB of heap memory in threads ulimit -p 500 -n 1000; ./fork-exit -p 10 -t 100 -h 100 fork-exit: child 85652 signal 11 *** Error 1 in sys/kern/fork-exit (Makefile:75 'run-fork-thread-heap') FAILED ==== run-fork1-stack ==== # allocate 32 MB of stack memory ulimit -p 500 -n 1000; ulimit -s 32768; ./fork-exit -s 8000 fork-exit: child 42969 signal 11 *** Error 1 in sys/kern/fork-exit (Makefile:80 'run-fork1-stack') FAILED ==== run-fork1-thread1-stack ==== # allocate 400 MB of stack memory in single child and one thread ulimit -p 500 -n 1000; ./fork-exit -t 1 -s 100000 fork-exit: select: Operation timed out *** Error 1 in sys/kern/fork-exit (Makefile:90 'run-fork1-thread1-stack') FAILED ==== run-fork-thread-stack ==== # allocate 400 MB of stack memory in threads ulimit -p 500 -n 1000; ./fork-exit -p 10 -t 100 -s 100 fork-exit: child 95537 signal 11 *** Error 1 in sys/kern/fork-exit (Makefile:95 'run-fork-thread-stack') FAILED Here's some observation that I made when experimenting with those tests: 1. From the description and the command, some of the *-stack tests seems to want to allocate 400 MiB of stack space, but on my system I can only bump the stack limit to 32 MiB, even with ulimit/login.conf tweaks. Reducing the -s option in the tests to a lower number seem to make it pass, at least. 2. When the test does hit the stack limit, it seems to spend a lot of time doing something upon exit. I suppose this is why I'm observing timeouts? 3. With -h, the mmap at line 84 (https://github.com/openbsd/src/blob/master/regress/sys/kern/fork-exit/fork-exit.c#L84) seems to be returning a valid address, but then segfaults on the following p[1] statement at line 87. 4. With -t option set, it seems that created threads will race on heap and/or stack counters? I'm unfamiliar with pthread so I'm probably wrong here. 5. With -t option set, it seems to set the per-thread stack limit to something very low that stack tests would often fail regardless of how small the stack allocation is set. Unfortunately, I have no idea on how to properly handle the first four issues, but issue (5) can be worked around by increasing the per-thread stack area, like so: Index: fork-exit.c =================================================================== RCS file: /cvs/src/regress/sys/kern/fork-exit/fork-exit.c,v retrieving revision 1.7 diff -u -p -u -p -r1.7 fork-exit.c --- fork-exit.c 6 Jul 2021 11:50:34 -0000 1.7 +++ fork-exit.c 14 Nov 2022 12:47:44 -0000 @@ -123,7 +123,7 @@ create_threads(void) if (stack) { /* thread start and function call overhead needs a bit more */ error = pthread_attr_setstacksize(&tattr, - (stack + 2) * (4096 + 64)); + (stack + 2) * (8192 + 64)); if (error) errc(1, error, "pthread_attr_setstacksize"); }
