Page MenuHomeFreeBSD

libc: properly reference setgroups@FBSD_1.0 in initgroups@FBSD_1.0
ClosedPublic

Authored by kib on Sep 21 2025, 11:29 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Nov 7, 11:27 PM
Unknown Object (File)
Mon, Nov 3, 5:45 AM
Unknown Object (File)
Thu, Oct 30, 11:28 PM
Unknown Object (File)
Thu, Oct 30, 9:06 PM
Unknown Object (File)
Sun, Oct 26, 8:27 PM
Unknown Object (File)
Oct 16 2025, 7:47 PM
Unknown Object (File)
Oct 14 2025, 1:49 PM
Unknown Object (File)
Oct 11 2025, 6:58 AM
Subscribers

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

kib requested review of this revision.Sep 21 2025, 11:29 PM

It does make me wonder about all of the freebsd11_* bits in the same file that we use for pre-ino64 stuff, but my main concern is just fixing initgroups(3) for stable/15... we can always haggle on any other details later, if we need to.

This revision is now accepted and ready to land.Sep 22 2025, 3:52 AM

It does make me wonder about all of the freebsd11_* bits in the same file that we use for pre-ino64 stuff

freebsd11_ ino are different: they call ino64 versions and then translate results into the structures with pre-ino64 layout. In other words, they never called compat syscalls directly or indirectly.

Thanks for tackling this quickly.

From D52641:

Exporting freebsd14_setgroups@FBSDprivate_1.0 in libsys works, but only if I also hack up libsys/Makefile.sys to filter freebsd14_setgroups* out of MIASM to avoid creating conflicting weak refs in the libc build.

I've tried a lot of combinations since then, and frankly I still don't understand exactly why sometimes things work and sometimes not.

It seems that just exporting freebsd14_setgroups@FBSDprivate_1.0 from libsys is not enough because for some reason the freebsd14_setgroups symbol from libc somehow differs. Believe it or not, exporting freebsd14_setgroups in FBSDprivate_1.0 in lib/libc/sys/Symbol.map actually makes it work! This seems non-sensical, as the export from libsys is supposed to be merged into the final version file for libc.

I might have found a better way than what is done here.

In D52672#1203041, @kib wrote:

It does make me wonder about all of the freebsd11_* bits in the same file that we use for pre-ino64 stuff

freebsd11_ ino are different: they call ino64 versions and then translate results into the structures with pre-ino64 layout. In other words, they never called compat syscalls directly or indirectly.

No, some are similar. We have a bunch of direct calls to freebsd11_*() system calls, see, e.g, lib/libc/gen/fts-compat.c with calls to freebsd11_lstat, freebsd11_fstat and freebsd11_statfs. These are most probably all broken for the same reason as my first version of calling freebsd14_setgroups() from libc was.

Please see D52685 as a porposal to simplifying the change here and fixing other compatibility system calls.