Bug 2587871

Summary: CVE-2026-135111 samba: smbd listener counts a failed fork as a child and exhausts max smbd processes [fedora-rawhide]
Product: [Fedora] Fedora Reporter: TEJ RATHI <trathi>
Component: sambaAssignee: Guenther Deschner <gdeschner>
Status: NEW --- QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: medium    
Version: rawhideCC: abokovoy, anoopcs, asn, gdeschner, pfilipen, sbose, ssorce
Target Milestone: ---Keywords: Security, SecurityTracking
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: {"flaws": ["15abd13c-6135-464a-bcdb-4eb41a0a7624"]}
Fixed In Version: Doc Type: ---
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 2583142    

Description TEJ RATHI 2026-12-01 12:23:56 UTC
Disclaimer: Community trackers are created by Red Hat Product Security team on a best effort basis. Package maintainers are required to ascertain if the flaw indeed affects their package, before starting the update process.

smbd_accept_connection() in source3/smbd/server.c calls add_child_pid() when fork() returns a value other than 0. The failure return is -1, so a failed fork() is recorded as a child.

On failure the function logs the error and continues. It closes the accepted socket, then calls add_child_pid() with that pid. add_child_pid() appends a child record whose pid is -1 and adds one to the parent's child count. In Samba 3.4.0, add_child_pid() returns immediately when max smbd processes is 0, and it records the pid when that parameter is non-zero. In Samba 3.6.23 and in later releases through 4.25.1, add_child_pid() records the pid it is given, including -1. remove_child_pid() runs from smbd_sig_chld_handler() for each pid greater than 0 that waitpid() returns. A failed fork() has no child for waitpid() to report, so the -1 entry and the extra count remain. allowable_number_of_smbd_processes() allows the connection while max smbd processes is 0. When the parameter is non-zero, the function returns false once the child count reaches that value, and smbd_accept_connection() closes the new socket and returns before fork(). messaging_send_to_children() passes each stored pid to messaging_send(). That send connects a datagram socket to a path built from the pid. For pid -1 the connect fails.

A caller who can make fork() fail enough times can fill the configured process limit with entries that have no running worker. The listener then closes new connections. The parent keeps running. The entries remain after the kernel can create processes again, so new clients stay unable to connect until the parent is restarted. Workers that are already running are left in place. messaging_send() fails for pid -1.

The caller needs a TCP connection to the smbd listener. The listener records the pid before SMB session setup. fork() has to return -1 while the counted children are still below the limit. The kernel does that when it cannot create another process, including when a pids cgroup limit is exhausted or memory allocation fails.

The max smbd processes parameter has to be set to a non-zero value before the child count can close new connections. The documented default is 0. While the parameter is 0, allowable_number_of_smbd_processes() allows the connection.

Volker Lendecke added the parent-side child count in commit 0be131725ff on 2006-08-16. Samba 3.4.0, released on 2009-07-03, is the first release that contains it. Stefan Metzmacher's commit e0232934fbf on 2009-01-27 rewrote the accept loop and kept the same non-zero test. That test is still present in Samba 4.25.1. Samba 4.25.2 changes the accept-path test to a positive pid.