Thread View: muc.lists.freebsd.bugs
2 messages
2 total messages
Started by bugzilla-noreply
Thu, 29 Oct 2026 08:45
[Bug 300234] Dup does not use the lowest available descriptor
Author: bugzilla-noreply
Date: Thu, 29 Oct 2026 08:45
Date: Thu, 29 Oct 2026 08:45
58 lines
3993 bytes
3993 bytes
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=300234
Bug ID: 300234
Summary: Dup does not use the lowest available descriptor
Product: Base System
Version: CURRENT
Hardware: Any
OS: Any
Status: New
Severity: Affects Only Me
Priority: ---
Component: kern
Assignee: bugs@FreeBSD.org
Reporter: ml@netfence.it
Created attachment 276671
--> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=276671&action=edit
Fix fdcopy
Man page dup(2) clearly states:
The new descriptor returned by the call is the lowest numbered descriptor
currently not in use by the process.
On 15 (and I believe also in main) this is not always true.
For the curious, I found this out because one of the pratical effect is that
Cyrus IMAP fails to start automatically at boot in a jail. See:
https://mail-archive.freebsd.org/cgi/getmsg.cgi?fetch=124562+0+archive/2026/freebsd-ports/20261026.freebsd-ports
The problem seems to arise in function fdcopy.
This was changed in 14 -> 15 in order to skip duplication in some more cases;
alas, when that happens, it produces an incoherent filedesc structure.
All other functions assume such a structure is correct and never check, so
there is no recovery from this situation. The skipped number is forever lost.
I'm attaching a patch that seeems to solve.
In a test VM now Cyrus starts properly again.
However I'm no kernel expert, so I don't dare put it in production unless
someone with more knowledge than me reviews it.
While at it, I came to this conclusion by adding some KASSERTs around that
tested the content of filedesc structures: these are not in the patch (mainly
because I'm quite sure the way I added them was not orthodox). Would it be
worth to add them?
--
You are receiving this mail because:
You are the assignee for the bug.
--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-admin@muc.de
[Bug 300234] Dup does not use the lowest available descriptor
Author: bugzilla-noreply
Date: Fri, 30 Oct 2026 15:44
Date: Fri, 30 Oct 2026 15:44
24 lines
2958 bytes
2958 bytes
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=300234
Dag-Erling Smørgrav <des@FreeBSD.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Assignee|bugs@FreeBSD.org |kib@FreeBSD.org
CC| |des@FreeBSD.org
Status|New |Open
--- Comment #1 from Dag-Erling Smørgrav <des@FreeBSD.org> ---
This sounds like something Konstantin should look into. The bug appears to be
present in 15.1 but not 15.0 or 14.x, probably related to kqueue inheritance.
--
You are receiving this mail because:
You are the assignee for the bug.
--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-admin@muc.de
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads