From nobody Tue May 14 21:56:44 2024 X-Original-To: freebsd-emulation@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Vf9DZ4D3Kz5L5SJ for ; Tue, 14 May 2024 21:56:46 +0000 (UTC) (envelope-from seafork@disroot.org) Received: from layka.disroot.org (layka.disroot.org [178.21.23.139]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4Vf9DZ0R3Qz4VlG for ; Tue, 14 May 2024 21:56:46 +0000 (UTC) (envelope-from seafork@disroot.org) Authentication-Results: mx1.freebsd.org; dkim=pass header.d=disroot.org header.s=mail header.b=EjraS7BF; dmarc=pass (policy=reject) header.from=disroot.org; spf=pass (mx1.freebsd.org: domain of seafork@disroot.org designates 178.21.23.139 as permitted sender) smtp.mailfrom=seafork@disroot.org X-Virus-Scanned: SPAM Filter at disroot.org List-Id: Development of Emulators of other operating systems List-Archive: https://lists.freebsd.org/archives/freebsd-emulation List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-emulation@FreeBSD.org MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=disroot.org; s=mail; t=1715723804; bh=vCr8CJI3LQxdyV+ZZ0CtMcxAfPB6fDN6T9vELnk30dg=; h=Date:From:To:Subject; b=EjraS7BFlDJmJZS7jzPl81seciheq1+TJP9eiLRNLkppZNNyMeEpiNRck/jO9yY7J zsD5OuXb/9HZWMxy+ole0CjA31YHBxamFhQntj9YOUvu7sFnhnPFLJO+Iso0FMKrO/ /hkO9mCLLnkqEUwunpu9b37NjnymIGYtqN6ZlgSBmoByFNrkc0DeEGEJ96AtSRm5Xz yQJuyjEX244CpFUhHRxi25kX391Qgf8f2GviHTrMOzBRNX4gciJMUNwiFo4RtTXhCr 5HimpfXc6CrvIZ/Y1hFDj9/EeF2iZiFOFyR6DEnH/JmiaHpZXCx5uKIH0B+nvH+Ezo yzXP3z94FFLiA== Date: Tue, 14 May 2024 23:56:44 +0200 From: seafork To: freebsd-emulation@freebsd.org Subject: Glibc getaddrinfo(3) Breakage Message-ID: <84c6505826ea9fc5986d273444ecc326@disroot.org> X-Sender: seafork@disroot.org Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit X-Spamd-Bar: --- X-Spamd-Result: default: False [-3.99 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.99)[-0.992]; DMARC_POLICY_ALLOW(-0.50)[disroot.org,reject]; R_DKIM_ALLOW(-0.20)[disroot.org:s=mail]; R_SPF_ALLOW(-0.20)[+a:c]; MIME_GOOD(-0.10)[text/plain]; MISSING_XM_UA(0.00)[]; RCPT_COUNT_ONE(0.00)[1]; ASN(0.00)[asn:50673, ipnet:178.21.23.0/24, country:NL]; MIME_TRACE(0.00)[0:+]; ARC_NA(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; MLMMJ_DEST(0.00)[freebsd-emulation@freebsd.org]; FROM_HAS_DN(0.00)[]; RCVD_COUNT_ZERO(0.00)[0]; FROM_EQ_ENVFROM(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; TO_DN_NONE(0.00)[]; DKIM_TRACE(0.00)[disroot.org:+] X-Rspamd-Queue-Id: 4Vf9DZ0R3Qz4VlG 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