Re: Possible incompatible change with initgroups(3)?

From: Kyle Evans <kevans_at_FreeBSD.org>
Date: Fri, 19 Sep 2025 23:35:29 UTC
On 9/19/25 18:13, Darrin Smith wrote:
> On Sat, 20 Sep 2025 08:02:48 +0900 (JST)
> Yasuhiro Kimura <yasu@FreeBSD.org> wrote:
> 
>> Today I updated my 16.0-CURRENT amd64 system from
>> main-n280279-b0e7b55a0e90 to main-n280498-b3468202994f and noticed
>> Postfix emits such error messages as below.
>>
>> ----------------------------------------------------------------------
>> Sep 20 03:00:11 rolling-vm-freebsd1 postfix/qmgr[2634]: fatal:
>> initgroups: Socket operation on non-socket Sep 20 03:00:11
>> rolling-vm-freebsd1 postfix/pickup[2635]: fatal: initgroups: Socket
>> operation on non-socket Sep 20 03:01:00 rolling-vm-freebsd1
>> postfix/showq[66274]: fatal: initgroups: Socket operation on
>> non-socket
>> ----------------------------------------------------------------------
>>
>> So I rebuilt, reinstalled and restared Postfix. Then error message
>> disappeared.
>>
>> I checked commit log between b0e7b55a0e90 and b3468202994f, and found
>> following one.
>>
>> ----------------------------------------------------------------------
>> commit 0b018cfd81d8
>> Author:     Olivier Certner <olce@FreeBSD.org>
>> AuthorDate: Tue Sep 16 17:52:20 2025 +0200
>> Commit:     Olivier Certner <olce@FreeBSD.org>
>> CommitDate: Wed Sep 17 14:16:06 2025 +0200
>>
>>      initgroups(3): Fix return value on allocation failure
>>      
>>      We must not return ENOMEM, but rather -1 with 'errno' set to
>> ENOMEM, as described in the manual page and as other implementations
>> are doing. A malloc() failure actually already sets ENOMEM for us.
>> Add comments indicating which function set 'errno' each time we
>> return.
>>      While here, improve style and remove useless headers.
>>      
>>      Reviewed by:    kib, emaste
>>      Fixes:          54404cfb13d4 ("In preparation for raising NGROUPS
>> and NGROUPS_MAX, ...") MFC after:      5 days
>>      Sponsored by:   The FreeBSD Foundation
>>      Differential Revision:  https://reviews.freebsd.org/D52580
>> ----------------------------------------------------------------------
>>
>> According to commit message, it is likely that the commit introduces
>> some incompatibility with initgroups(3) and that it causes error
>> messages of Postfix. And if it is correct, then __FreeBSD_version
>> should be bumped to force packages that use initgroups(3) to be
>> rebuilt.
>>
>> ---
>> Yasuhiro Kimura
>>
> 
> I can confirm this issue. I've had to recompile audio/musicpd
> and sysutils/bareos23-client to resolve it. (Also getting
> the same Socket operation on non-socket in each case).
> 

Are you folks using GENERIC, or a custom kernel config?  The more interesting
commit here is 9dc1ac8691966480ff8bd9c37dd405b981b41dd5, which would surface a
problem fixed by a rebuild if you're using a custom kernel that does not have
COMPAT_FREEBSD14 enabled.  I don't think I'd quite expect that failure mode,
though, so maybe not.