Bug 16081 - winbindd_child_msg_filter: talloc_get_type_abort crashes when winbind max domain connections > 1
Summary: winbindd_child_msg_filter: talloc_get_type_abort crashes when winbind max dom...
Status: RESOLVED FIXED
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: Winbind (show other bugs)
Version: 4.22.6
Hardware: All All
: P5 normal (vote)
Target Milestone: ---
Assignee: Samba release manager
QA Contact: Samba QA Contact
URL: https://gitlab.com/samba-team/samba/-...
Keywords:
Depends on:
Blocks:
 
Reported: 2026-05-21 09:35 UTC by parag chaudhari
Modified: 2026-10-12 19:26 UTC (History)
3 users (show)

See Also:


Attachments
Patch for v4-25-test (10.23 KB, text/plain)
2026-08-28 10:57 UTC, Stefan Metzmacher
slow: review+
Details
Patch for v4-24-test (10.23 KB, text/plain)
2026-08-28 10:57 UTC, Stefan Metzmacher
slow: review+
Details
Patch for v4-23-test (10.23 KB, text/plain)
2026-08-28 10:58 UTC, Stefan Metzmacher
slow: review+
Details

Note You need to log in before you can comment on or make changes to this bug.
Description parag chaudhari 2026-05-21 09:35:12 UTC
winbindd crashes with SIGABRT in winbindd_child_msg_filter() when "winbind max domain connections" is set to a value greater than 1.

Backtrace:
Core was generated by `winbindd: domain child [PANQA-ATL]'.
Program terminated with signal SIGABRT, Aborted.

#0  thr_kill () from /lib/libc.so.7
#1  raise () from /lib/libc.so.7
#2  abort () from /lib/libc.so.7
#3  dump_core () at ../../source3/lib/dumpcore.c:361
#4  smb_panic_s3 (why=<optimized out>) at ../../source3/lib/util.c:778
#5  smb_panic (why="Bad talloc magic value - unknown value") at ../../lib/util/fault.c:209
#6  talloc_chunk_from_ptr (ptr=0x11862667baa8) at ../../lib/talloc/talloc.c:534
#7  __talloc_get_name (ptr=0x11862667baa8) at ../../lib/talloc/talloc.c:1566
#8  _talloc_get_type_abort (ptr=0x11862667baa8, name="struct winbindd_child", location="../../source3/winbindd/winbindd_dual.c:931") at ../../lib/talloc/talloc.c:1623
#9  winbindd_child_msg_filter (rec=0x8206f0a60, private_data=0x0) at ../../source3/winbindd/winbindd_dual.c:930
#10 messaging_dispatch_waiters at ../../source3/lib/messages.c:1378
#11 messaging_dispatch_rec at ../../source3/lib/messages.c:1406
#20 fork_domain_child (child=0x11862667baa8) at ../../source3/winbindd/winbindd_dual.c:1898

Root cause:
In source3/winbindd/winbindd_util.c, domain->children is allocated as:

  domain->children = talloc_zero_array(domain, struct winbindd_child,
                                       lp_winbind_max_domain_connections());

talloc_zero_array allocates a single contiguous block with ONE talloc header
for the base pointer only.

In source3/winbindd/winbindd_domain.c, setup_child() is called with
&domain->children[i] for each child, passing these pointers as private_data
to the messaging subsystem.

In source3/winbindd/winbindd_dual.c, winbindd_child_msg_filter() does:

  struct winbindd_child *child = talloc_get_type_abort(private_data,
                                         struct winbindd_child);

For children[0], this works — it's the base pointer with a valid talloc header.
For children[i] where i > 0, these are mid-array pointers with NO talloc header,
causing talloc_get_type_abort to abort the process.

This bug is latent with the default "winbind max domain connections = 1" since
only children[0] is ever used.

Fix:
Replace talloc_get_type_abort with a direct cast:

  struct winbindd_child *child = (struct winbindd_child *)private_data;

Introduced by commit 8e1f2ee5f7c which added talloc_get_type_abort to this
function. Affects all versions since that commit including current master.

Steps to reproduce:
1. Set "winbind max domain connections = 2" (or higher) in smb.conf
2. Join a domain
3. Restart samba
4. winbindd child processes abort with SIGABRT
Comment 1 Samba QA Contact 2026-08-27 17:37:13 UTC
This bug was referenced in samba master:

613563e6d22adb82bdeacf72014478324631fab0
Comment 2 Stefan Metzmacher 2026-08-28 10:57:05 UTC
Created attachment 19185 [details]
Patch for v4-25-test
Comment 3 Stefan Metzmacher 2026-08-28 10:57:26 UTC
Created attachment 19186 [details]
Patch for v4-24-test
Comment 4 Stefan Metzmacher 2026-08-28 10:58:26 UTC
Created attachment 19187 [details]
Patch for v4-23-test
Comment 5 Ralph Böhme 2026-09-22 08:40:45 UTC
Reassigning to release management for inclusion in 4.23, 4.24 and 4.25.
Comment 6 Björn Jacke 2026-09-22 16:39:36 UTC
Pushed to all release branches, but all branches' autobuilds failed due to flaky tests. We really need to improve the autobuild tests.
Comment 7 Ralph Böhme 2026-09-22 16:47:39 UTC
Let's colletct a list somewhere like in the wiki instead of filing individual bugs to reduce the overhead. I'm happy to contribute, I started my own list a few days ago.
Comment 8 Björn Jacke 2026-09-22 16:52:44 UTC
our build system etc. are a bugzilla component and progress can be tracked there, discussion can take place there. A list at some other place reduced the number of bugzilla traffic but it doesn't help to work on them and discuss them.
Comment 9 Samba QA Contact 2026-09-24 21:28:19 UTC
This bug was referenced in samba v4-25-test:

b9f663b2c98922fe1e6a793b9d64bae71fc728e1
Comment 10 Samba QA Contact 2026-09-24 21:58:43 UTC
This bug was referenced in samba v4-25-stable (Release samba-4.25.0):

b9f663b2c98922fe1e6a793b9d64bae71fc728e1
Comment 11 Samba QA Contact 2026-10-01 19:30:20 UTC
This bug was referenced in samba v4-23-test:

c903c7947de9106b1b3471150a01531376cd13af
Comment 12 Samba QA Contact 2026-10-01 19:47:14 UTC
This bug was referenced in samba v4-23-stable (Release samba-4.23.13):

c903c7947de9106b1b3471150a01531376cd13af
Comment 13 Samba QA Contact 2026-10-02 00:38:20 UTC
This bug was referenced in samba v4-24-test:

341f09fcb58a4f3ff7c2360506ab42eb5a7cb03b
Comment 14 Samba QA Contact 2026-10-12 19:26:14 UTC
This bug was referenced in samba v4-24-stable (Release samba-4.24.8):

341f09fcb58a4f3ff7c2360506ab42eb5a7cb03b