On Sun, Nov 20, 2022 at 10:25:47AM +0100, Sebastien Marie wrote: > On Mon, Nov 14, 2022 at 01:04:45PM +0000, Koakuma wrote: > > 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 > > > [...] > > > 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: > > > I think that these tests are expected to be run as root (in order to not have > unlimited stacksize-max). > > But I don't have sparc64 to check if it is fine.
The same happens when run as root: # make cc -O2 -pipe -Wall -Wpointer-arith -Wuninitialized -Wstrict-prototypes -Wmissing-prototypes -Wunused -Wsign-compare -Wshadow -Wdeclaration-after-statement -MD -MP -c /usr/src/regress/sys/kern/fork-exit/fork-exit.c cc -o fork-exit fork-exit.o -lpthread ==== run-fork1-exit ==== # test forking a single child ulimit -p 500 -n 1000; ./fork-exit ==== run-fork-exit ==== # fork 300 children and kill them simultaneously as process group ulimit -p 500 -n 1000; ./fork-exit -p 300 ==== run-fork-exec-exit ==== # fork 300 children, exec sleep programs, and kill process group ulimit -p 500 -n 1000; ./fork-exit -e -p 300 ==== run-fork1-thread1 ==== # fork a single child and create one thread ulimit -p 500 -n 1000; ./fork-exit -t 1 ==== run-fork1-thread ==== # fork a single child and create 1000 threads ulimit -p 500 -n 1000; ./fork-exit -t 1000 ==== run-fork-thread ==== # fork 30 children each with 30 threads and kill process group ulimit -p 500 -n 1000; ./fork-exit -p 30 -t 30 ==== run-fork1-heap ==== # allocate 400 MB of heap memory ulimit -p 500 -n 1000; ./fork-exit -h 100000 fork-exit: child 3096 signal 11 *** Error 1 in . (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 3658 signal 11 *** Error 1 in . (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 36404 signal 11 *** Error 1 in . (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 60409 signal 11 *** Error 1 in . (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 83153 signal 11 *** Error 1 in . (Makefile:80 'run-fork1-stack') FAILED ==== run-fork-stack ==== # allocate 400 MB of stack memory in processes ulimit -p 500 -n 1000; ulimit -s 32768; ./fork-exit -p 100 -s 1000 ==== 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 . (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: select: Operation timed out *** Error 1 in . (Makefile:95 'run-fork-thread-stack') FAILED ==== cleanup ==== # check that all processes have been terminated and waited for ! pkill -u `id -u` fork-exit *** Error 1 in . (Makefile:100 'cleanup') *** Error 2 in /usr/src/regress/sys/kern/fork-exit (<bsd.regress.mk>:117 'regress': make -C /usr/src/regress/sys/kern/fork-exit cleanup)