Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 13 Jun 2025 09:35:59 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 287499] [unix/stream socket] SO_SNDLOWAT value is ignored on select(2)
Message-ID:  <bug-287499-227@https.bugs.freebsd.org/bugzilla/>

index | next in thread | raw e-mail

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=287499

            Bug ID: 287499
           Summary: [unix/stream socket] SO_SNDLOWAT value is ignored on
                    select(2)
           Product: Base System
           Version: 15.0-CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: kern
          Assignee: bugs@FreeBSD.org
          Reporter: takahiro.kurosawa@gmail.com

Created attachment 261231
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=261231&action=edit
tesst program to reproduce the problesm

The setsockopt(2) manual page states:

     SO_SNDLOWAT is an option to set the minimum count for output operations.
     Most output operations process all of the data supplied by the call,
     delivering data to the protocol for transmission and blocking as
     necessary for flow control.  Nonblocking output operations will process
     as much data as permitted subject to flow control without blocking, but
     will process no data if flow control does not allow the smaller of the
     low water mark value or the entire request to be processed.  A select(2)
     operation testing the ability to write to a socket will return true only
     if the low water mark amount could be processed.

On 15-CURRENT, select() returns >0 even if the buffer space for sending data
is less than the SO_SNDLOWAT value. 14-STABLE does not have this problem.
A test program is attached. The test succeeds on 14-STABLE but fails on
15-CURRENT.

It seems that libcap_fileargs relies on this feature for sending control
messages.
I have run into this problem while building packages in a 14-STABLE jail on a
15-CURRENT host.  elftoolchain on 14-STABLE uses libcap_fileargs.

Probably the problem is caused because the sb_lowat of the peer's receive
buffer
is used for checking availability of the send buffer space instead of sb_lowat
of the local send buffer:
https://cgit.freebsd.org/src/tree/sys/kern/uipc_usrreq.c?id=1beab149d0b9768ad6d07501326a2060d7b0ba58#n1705

-- 
You are receiving this mail because:
You are the assignee for the bug.

home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-287499-227>