Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 14 May 2024 23:56:44 +0200
From:      seafork <seafork@disroot.org>
To:        freebsd-emulation@freebsd.org
Subject:   Glibc getaddrinfo(3) Breakage
Message-ID:  <84c6505826ea9fc5986d273444ecc326@disroot.org>

next in thread | raw e-mail | index | archive | help
Hi all, I hope this finds you well.

In commit b977dd1ea5fbc2df3f1279330be4d089322eb2cf [1], the check

> if (hdr->nlmsg_len < sizeof(struct nlmsghdr) + sizeof(struct 
> ifaddrmsg))
>    return (EBADMSG);

in `sys/compat/linux/linux_netlink.c:97` was added and caused glibc's 
getaddrinfo(3) to break. This, as one might think, causes quite a few 
programs in the linuxulator to stop work. After looking into it, glibc 
is indeed not sending what we're expecting. Not only are they not 
including the space of the header, but they're also using the seemingly 
depreciated (i.e no documentation [i could find] speaking of it) 
`rtgenmsg` format. [2] While indeed we also have this in our codebase 
`sys/netlink/route/route.h:363`, it's used nowhere except in 
`crypto/heimdal/lib/roken/getifaddrs.c:275`; however, even in that code, 
they make sure to include the space of the header with the 
`NLMSG_LENGTH` macro. Obliviously, please take this with a large grain 
of salt as I'm quite inexperienced. That being said, I believe our best 
bet would be to contact upstream, and in the meantime, implement this 
functionality. On the latter half, I would be more than happy to do said 
implementing, all I would need are some pointers to relevant 
documentation.

Cheers!

[1] 
https://cgit.freebsd.org/src/commit?id=b977dd1ea5fbc2df3f1279330be4d089322eb2cf
[2] 
https://elixir.bootlin.com/glibc/latest/source/sysdeps/unix/sysv/linux/check_pf.c#L92



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