On 10/26/26 19:28, Andrea Venturoli wrote:

In any case it would still not address the root cause.

I think the problem is in fdcopy.
This was changed from 14.x to 15.1 and, if this is it, I think it's still broken in main.

This patch should solve:
diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c
index 80735e0b4c0c..77424384303e 100644
--- a/sys/kern/kern_descrip.c
+++ b/sys/kern/kern_descrip.c
@@ -2644,8 +2644,11 @@ fdcopy(struct filedesc *fdp, struct proc *p1)
                if ((ops->fo_flags & DFLAG_FORK) != 0 &&
                    (ofde->fde_flags & UF_FOCLOSE) == 0) {
                        if (ops->fo_fork(newfdp, ofde->fde_file, &fp, p1,
-                           curthread) != 0)
+                            curthread) != 0) {
+                                if (newfdp->fd_freefile == fdp->fd_freefile)
+                                       newfdp->fd_freefile = i;
                                continue;
+                        }
                        fork_pass = true;
                } else if ((ops->fo_flags & DFLAG_PASSABLE) == 0 ||
                    (ofde->fde_flags & UF_FOCLOSE) != 0 ||


However, I'm no kernel expert, so if someone could give it a look...
It works in a test VM, but I don't dare put it in production otherwise.

 bye & Thanks
        av.

Reply via email to