From nobody Sat Nov 14 20:26:21 2026 X-Original-To: dev-commits-src-all@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 4jRlyT454pz70YmT; Sat, 14 Nov 2026 20:26:25 +0000 (UTC) (envelope-from glebius@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 4jRlyT3Rplz3Pjw; Sat, 14 Nov 2026 20:26:25 +0000 (UTC) (envelope-from glebius@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1794687985; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=F7Z8Glx7T2AXnvksUD9gAJw8yRTwxsrc3h0qjKM1AiI=; b=iCFVzsXFVYajYB4tNP1UMtV8fVv/3sWZHE33WK0cJMmUizhiCu0VSVPOPQ7QaZgbo21ozz Pqi/Zjlcn7kHaFUgOAFv1jcAYZ9jZrm6GlsmTCiPB9lmxaO4EoF3Nh/R/vMuj37D84cqHR 4KXulhwkow3lKaBdqUmUidljr0w93LY5ZydWBlGmssQ/wgJpzqGGFU8Yg12a9z3YplWdYI GJiELiyzGNjGI91jzdRB6LkyEVeuYNanh77KppKwZJ14t+Qj/Po2FcrtlKxwuD2gn95LP6 X5yMheiru7jQLVDI0hwCfAKUUVkDcaX87ZARS4UW/OvlFdBWedSWxvX/q6fXWA== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1794687985; b=Ft2Y62993DL6dd2y1Ci8qbFyWKdAkb9JfVJRkIOsSZshR+qg1JwnfVj0w3kdWyHffoWvoq 1MEQMRMnU38fxjQ7qWmfH4vxI3BmE2VoCE2Z4m2GRuJ5+BXkhKnnXy6EdQHoIeWWsfztk4 iAyIfFmIoYzcuRpx//1pCOxlV/CQy/PGY1a6Os2JrxLjjCmdf3OPzaM3nrE2wPdr5979Gs ITPuxt1TCKvhHqu2hxybCQu0iAAJxqz1L65dsxOVtPVZuUtEXEMNR/U25w/Dftex8X52x/ JIKMOOUFezHBisUwcUSvOpRPf+TN22/CG28coSH9ENdNhu/u5EuJrZ/66BcTnw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1794687985; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=F7Z8Glx7T2AXnvksUD9gAJw8yRTwxsrc3h0qjKM1AiI=; b=rnKzf3USK/rDG5uPVM1O5YOT9bU8uUY+9mlwVW58EZARIVLyFr8cEu6BLuA1pUjZ9lNrXh XWLoKiEDpAY9M8OykAVDL2g4uRpm3U1GvmzLh5iE1829QFlpJaXSD0mBMVIGA1Y9s+6jQl PVdMgNhhAVwBk68deK25Lv/qSRPCf6n7lS+WQkrE8PKUUDvLeEjLp7gscB3Ov9Ns+gFG/X dVUWam9/aRGjTetZG45x9Uy+Vb1OzfIMb3BJ/CfRpsU4xN1uTqI31VxdRA2/QJ/kjBXGpy egaVKI9SRnmatBMzUtuMa2trArdAOf8oGMYbK75clBccRq/ncIqSdr8s4dZkIQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from cell.glebi.us (glebi.us [162.251.186.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) (Authenticated sender: glebius) by smtp.freebsd.org (Postfix) with ESMTPSA id 4jRlyS1qXLzv3J; Sat, 14 Nov 2026 20:26:24 +0000 (UTC) (envelope-from glebius@freebsd.org) Date: Sat, 14 Nov 2026 12:26:21 -0800 From: Gleb Smirnoff To: Dag-Erling =?iso-8859-1?Q?Sm=F8rgrav?= , bjk@freebsd.org, markj@freebsd.org, kevans@freebsd.org, brooks@freebsd.org Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 838ff5548b4f - main - xdr: Limit xdr_wrapstring Message-ID: References: <6aefae3a.43cd1.35697757@gitrepo.freebsd.org> List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all X-BeenThere: dev-commits-src-all@freebsd.org List-Id: Commit messages for all branches of the src repository List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <6aefae3a.43cd1.35697757@gitrepo.freebsd.org> Dag-Erling and reviewers, On Sat, Nov 07, 2026 at 11:03:22PM +0000, Dag-Erling Smørgrav wrote: D> The branch main has been updated by des: D> D> URL: https://cgit.FreeBSD.org/src/commit/?id=838ff5548b4f83707f34cfd28769e35393da3f05 D> D> commit 838ff5548b4f83707f34cfd28769e35393da3f05 D> Author: Dag-Erling Smørgrav D> AuthorDate: 2026-11-07 23:02:44 +0000 D> Commit: Dag-Erling Smørgrav D> CommitDate: 2026-11-07 23:03:14 +0000 D> D> xdr: Limit xdr_wrapstring D> D> The previous commit (re)introduced the possibility that a malicious or D> corrupt message can cause the receiver to allocate a very large amount D> of memory before realizing that the message is much shorter than D> claimed. Revert the change to xdr_wrapstring() to avoid this. D> D> Fixes: d2018cedb414 ("xdr: Fix xdr_string") D> Reported by: bjk@ D> Reviewed by: markj D> Differential Revision: https://reviews.freebsd.org/D60898 D> lib/libc/xdr/xdr.c | 4 +++- D> sys/xdr/xdr.c | 4 +++- D> 2 files changed, 6 insertions(+), 2 deletions(-) D> D> diff --git a/lib/libc/xdr/xdr.c b/lib/libc/xdr/xdr.c D> index f8cc5267d350..82f69882a30d 100644 D> --- a/lib/libc/xdr/xdr.c D> +++ b/lib/libc/xdr/xdr.c D> @@ -47,6 +47,8 @@ D> #include D> #include D> D> +#include D> +#include This function is literally documented as: int xdr_wrapstring(XDR *xdrs, char **sp) A primitive that calls xdr_string(xdrs, sp, MAXUN.UNSIGNED); where MAXUN.UNSIGNED is the maximum value of an unsigned integer. The xdr_wrapstring() function is handy because the RPC package passes a maximum of two XDR routines as arguments, and xdr_string(), one of the most frequently used primitives, requires three. Returns one if it succeeds, zero otherwise. Limiting it directly opposed the documented purpose. IMHO, the d2018cedb414 was a good change in general. It made XDR less RPC specific. It removed a header include from dependant library code into consumer library. IMHO, the right thing to do would be to provide rpc_wrapstring() in RPC library that can be casted to xdrproc_t. In the kernel we have only one consumer NLM that can be fixed easily. In the userland we have few small consumers and KRB5 :( We can contant Kerberos people to check if they agree on using a different function that would be documented as limited to RPC size. -- Gleb Smirnoff