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 6A44F8F58; Mon, 4 Mar 2024 21:37:04 +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=1709588224; cv=none; b=EDXM116pRA763ivU2edNxK62uQ1stg7tn8U6RkG0/FFftgeHLjnkX1XH7YFMzNYYALSjBw9BKkylNSRvD2mKC1iC2vPPE/QBzLdfLI3uIb1krczyzIf4/aTvJzdRLx8x3AMjRE+qXRZX2VZvyL5wjJCVKuwvFmL98Rd5Q7PS9d4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709588224; c=relaxed/simple; bh=Gu6spSEpQyazEKktTZ8pYkvTWieyE2vuby4eTFWGUXY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Pk9T9Ix2nSgwCWaRHO4LA6j/ZIpgLkHWSgjC2CL/OYyUvcakPCQHkk8Sc3BKBuPU22sSpENYBoEXr+dWemCfjw51Spei9M1mD+cclGfWsp0Iy9W8WFfUeSEs4kGM9+YsstsARwARMWcPSiYCKhkNEZ/159RTHJxWtts09PDK91g= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=ms+B3Zrw; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="ms+B3Zrw" Received: by smtp.kernel.org (Postfix) with ESMTPSA id EFC3BC433C7; Mon, 4 Mar 2024 21:37:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1709588224; bh=Gu6spSEpQyazEKktTZ8pYkvTWieyE2vuby4eTFWGUXY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ms+B3ZrwJAUqlg8N753NDcQQk0LitPOo1D7H636N8+KxeaOWGo8avKxWn47204OkL BMwypZBYmnfA0neQkXUz73q+BySgPgMwkwgYLRuw4KnlfY3jckwH4+VAhgUkyW9i+5 S19SU4iufo4K7ITcRtUJYvbhhrCG5oaXLQIFMmDA= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, syzbot+3f497b07aa3baf2fb4d0@syzkaller.appspotmail.com, xingwei lee , Florian Westphal , Jakub Kicinski , Sasha Levin Subject: [PATCH 6.6 009/143] netlink: add nla be16/32 types to minlen array Date: Mon, 4 Mar 2024 21:22:09 +0000 Message-ID: <20240304211550.209653395@linuxfoundation.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240304211549.876981797@linuxfoundation.org> References: <20240304211549.876981797@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Florian Westphal [ Upstream commit 9a0d18853c280f6a0ee99f91619f2442a17a323a ] BUG: KMSAN: uninit-value in nla_validate_range_unsigned lib/nlattr.c:222 [inline] BUG: KMSAN: uninit-value in nla_validate_int_range lib/nlattr.c:336 [inline] BUG: KMSAN: uninit-value in validate_nla lib/nlattr.c:575 [inline] BUG: KMSAN: uninit-value in __nla_validate_parse+0x2e20/0x45c0 lib/nlattr.c:631 nla_validate_range_unsigned lib/nlattr.c:222 [inline] nla_validate_int_range lib/nlattr.c:336 [inline] validate_nla lib/nlattr.c:575 [inline] ... The message in question matches this policy: [NFTA_TARGET_REV] = NLA_POLICY_MAX(NLA_BE32, 255), but because NLA_BE32 size in minlen array is 0, the validation code will read past the malformed (too small) attribute. Note: Other attributes, e.g. BITFIELD32, SINT, UINT.. are also missing: those likely should be added too. Reported-by: syzbot+3f497b07aa3baf2fb4d0@syzkaller.appspotmail.com Reported-by: xingwei lee Closes: https://lore.kernel.org/all/CABOYnLzFYHSnvTyS6zGa-udNX55+izqkOt2sB9WDqUcEGW6n8w@mail.gmail.com/raw Fixes: ecaf75ffd5f5 ("netlink: introduce bigendian integer types") Signed-off-by: Florian Westphal Link: https://lore.kernel.org/r/20240221172740.5092-1-fw@strlen.de Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- lib/nlattr.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/nlattr.c b/lib/nlattr.c index 7a2b6c38fd597..ba698a097fc81 100644 --- a/lib/nlattr.c +++ b/lib/nlattr.c @@ -30,6 +30,8 @@ static const u8 nla_attr_len[NLA_TYPE_MAX+1] = { [NLA_S16] = sizeof(s16), [NLA_S32] = sizeof(s32), [NLA_S64] = sizeof(s64), + [NLA_BE16] = sizeof(__be16), + [NLA_BE32] = sizeof(__be32), }; static const u8 nla_attr_minlen[NLA_TYPE_MAX+1] = { @@ -43,6 +45,8 @@ static const u8 nla_attr_minlen[NLA_TYPE_MAX+1] = { [NLA_S16] = sizeof(s16), [NLA_S32] = sizeof(s32), [NLA_S64] = sizeof(s64), + [NLA_BE16] = sizeof(__be16), + [NLA_BE32] = sizeof(__be32), }; /* -- 2.43.0