Subject: segmentation fault reading socketpair after fork

From: Jakov Tutavac <[email-masked]>
Date: Sun, 28 Apr 2024 14:19:52 +0200

Dear Sir/Madam,

The 62 lines of code in the attachment result in a segmentation fault when
run.
I hope you can help suggest a fix or a workaround.

user@pcxy:~/$ guile --version
guile (GNU Guile) 3.0.7
Packaged by Debian (3.0.7-deb+3.0.7-1)

user@pcxy:~/$ make
gcc -I/usr/include/guile/3.0 -g -c -o main.o main.c
gcc -o a.out main.o -lguile-3.0 -lgc -lpthread -ldl
user@pcxy:~/$ ./a.out
Parent sv:3
Child sv:4
Segmentation fault (core dumped)

(gdb) r
Starting program: a.out
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[Detaching after fork from child process 100100]

Parent sv:3
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7be68f2 in GC_find_limit_with_bound () from
/lib/x86_64-linux-gnu/libgc.so.1