From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 96B66274FDC; Mon, 6 Apr 2026 15:55:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775490901; cv=none; b=NTsV+5pPBo1gcLpsG13VKPvp8KY8Jlv596efo1HnprculrXn15djyqrV5Xji8z70Ukbcwc+XmLLycKZKehDPTIkBBvopS0Gm2yfjXMYmchf6EzYNerCfwez/zx6OePbndXf+sQRtyFKqhPBJJm7ZJlfaJlBR00nt6unVYa9tej8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775490901; c=relaxed/simple; bh=yhQVx5lGxrNjOz+qJC4x+VCwzUXhDOiL1OJSFE+OS3A=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=peW1TlyquDYG7BLBbpuhK//QfSC80/DnQ49T0I8PWaGULEhI3PWIqqdYh8Y0wnTnBcxHFx0E8aiUHX/tsNOlv6E2drIQTejmXTflqbCkjwjpOuKgaBka20vovP2NjiOPWHDy1GmarhlxUH4aA6gyKb0YnicdAsE/KYQzHLBPtts= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=seNtVtwi; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="seNtVtwi" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B4116C19421; Mon, 6 Apr 2026 15:55:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1775490901; bh=yhQVx5lGxrNjOz+qJC4x+VCwzUXhDOiL1OJSFE+OS3A=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=seNtVtwircGY/V5AcTAx61qjZW2NQAWjSt4CMJrThWS3vX8fmSaNuxc+ReJnITYqB 1YrMgxaKgb0CbXEOxZs1XSOMC7CgT5yHmnyqV6KchRnln/p7CFjHo1VRv/lRCyim9G 4btoE4KqiJX+1y+K4BkpoYwuARdOO8kJfjNWFOy4zJbtg3pU1MluQ92TxT1IwZHlED 9rk/NhvcgBdjviVgtheV4dYNXbgrxrHRecOdQ0z78WzMG7ZPLEuXSvwyOlrFyul4N9 /14OMAt7DBfI3mf1qQk6BKaMcxFjyH4fBIMjPWnT7z0Nr4uPc2mDOCL9flYynvrmJq CLJcGrcvTHBXg== Date: Mon, 6 Apr 2026 08:54:49 -0700 From: Jakub Kicinski To: Greg Kroah-Hartman Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Steffen Klassert , Herbert Xu , "David S. Miller" , Eric Dumazet , Paolo Abeni , Simon Horman Subject: Re: [PATCH net] xfrm_user: fix info leak in build_mapping() Message-ID: <20260406085449.266466ae@kernel.org> In-Reply-To: <2026040602-shack-tamale-d8c3@gregkh> References: <2026040602-shack-tamale-d8c3@gregkh> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Mon, 6 Apr 2026 17:33:03 +0200 Greg Kroah-Hartman wrote: > struct xfrm_usersa_id has a one-byte padding hole after the proto > field, which ends up never getting set to zero before copying out to > userspace. Fix that up by zeroing out the whole structure before > setting individual variables. > > Fixes: 3a2dfbe8acb1 ("xfrm: Notify changes in UDP encapsulation via netlink") > Cc: Steffen Klassert > Cc: Herbert Xu > Cc: "David S. Miller" > Cc: Eric Dumazet > Cc: Jakub Kicinski > Cc: Paolo Abeni > Cc: Simon Horman > Assisted-by: gregkh_clanker_t1000 > Signed-off-by: Greg Kroah-Hartman > --- > Note, I think this is correct, as I don't think a new skb has it's > fields pre-zeroed out, or am I totally wrong here? You're right, skb owner is responsible for clearing after put. Tho, Netlink is not as perf critical as real networking, I wish we at least had a helper which reserves the space and clears it :/ This is not the first or the second time we hit this sort of a bug. > diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c > index 8a854fa9567d..1bb8d05561df 100644 > --- a/net/xfrm/xfrm_user.c > +++ b/net/xfrm/xfrm_user.c > @@ -4165,6 +4165,7 @@ static int build_mapping(struct sk_buff *skb, struct xfrm_state *x, > > um = nlmsg_data(nlh); > > + memset(&um->id, 0, sizeof(um->id)); > memcpy(&um->id.daddr, &x->id.daddr, sizeof(um->id.daddr)); > um->id.spi = x->id.spi; > um->id.family = x->props.family;