Ticket 23658 - Fix FreeBSD bind() and connect() calls: pass correct sockaddr length
Summary: Fix FreeBSD bind() and connect() calls: pass correct sockaddr length
Status: OPEN
Alias: None
Product: Slurm
Classification: Unclassified
Component: slurmd (show other tickets)
Version: 23.11.7
Hardware: Other Other
: C - Contributions
Assignee: Tim Wickberg
QA Contact:
URL:
Depends on:
Blocks:
 
Reported: 2025-09-06 04:52 MDT by Rikka Göring
Modified: 2025-09-06 07:41 MDT (History)
0 users

See Also:
Site: -Other-
Slinky Site: ---
Alineos Sites: ---
Atos/Eviden Sites: ---
Confidential Site: ---
Coreweave sites: ---
Cray Sites: ---
DS9 clusters: ---
Google sites: ---
HPCnow Sites: ---
HPE Sites: ---
IBM Sites: ---
NOAA SIte: ---
NoveTech Sites: ---
Nvidia HWinf-CS Sites: ---
OCF Sites: ---
Recursion Pharma Sites: ---
SFW Sites: ---
SNIC sites: ---
Tzag Elita Sites: ---
Linux Distro: ---
Machine Name:
CLE Version:
Version Fixed:
Target Release: ---
DevPrio: ---
Emory-Cloud Sites: ---


Attachments
Patch to fix FreeBSD bind()/connect() calls by passing correct sockaddr lengths (uses _bsd_sockaddr_len_fix() and sets sun_len where needed). No functional changes for Linux. (12.69 KB, patch)
2025-09-06 04:52 MDT, Rikka Göring
Details | Diff

Note You need to log in before you can comment on or make changes to this ticket.
Description Rikka Göring 2025-09-06 04:52:57 MDT
Created attachment 43024 [details]
Patch to fix FreeBSD bind()/connect() calls by passing correct sockaddr lengths (uses _bsd_sockaddr_len_fix() and sets sun_len where needed). No functional changes for Linux.

On FreeBSD, bind() and connect() require the correct sockaddr length
to be passed, including the sa_len/sun_len fields, otherwise the call
may fail with EINVAL. This patch ensures the correct length is computed
and applied in all affected places.

The changes are minimal and guarded by #if defined(__FreeBSD__), so
there is no impact on Linux or other platforms.

Original patch prepared for the FreeBSD port of Slurm; refined during
review by Vladimir Druzenko to minimize scope and keep diffs clean.