From nobody Tue Jul 05 11:44:36 2022 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 58DCD1CFCEDC; Tue, 5 Jul 2022 11:44:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (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-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Lcgnc212Sz4rmC; Tue, 5 Jul 2022 11:44:36 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1657021476; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=snb+jjlLbCrxnki1Z9rtSwpvuzW4S4pdUUsZ49Schbc=; b=q/kNGXdtyfJyNnHD1t5pDZHcmu+zyJqoDxeSy7t0/2Rit3CcuVZxvTIdXZ7VxA8bcw9Xm9 0sIelyKm/8fB/xdSFZXhc9qUunXZKM6DQ2DiUIO7+cLRrcHcxaHiR+DglpxcYot0GZpz3Q quKp9A0YOHh94zanGQTx0JhlcO+AhGlzKFaRylJq01HnsIsuzZoGruGlVT8NV4/7MXisWw Tpc4kKu+rGq/kv0L6yBVRHlTh02RjUdwOigGx9Vz+JSSzL8J4SHbvlkQGsWd5L/WUiMGJG qxU4Ib+fFmLE7HZ2JGltvkUZffp50PU0VRCBECMxGH+ivKaTRmeX443WNgqjcw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2092C24BB7; Tue, 5 Jul 2022 11:44:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 265BiacP098523; Tue, 5 Jul 2022 11:44:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 265BiatP098522; Tue, 5 Jul 2022 11:44:36 GMT (envelope-from git) Date: Tue, 5 Jul 2022 11:44:36 GMT Message-Id: <202207051144.265BiatP098522@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: 0ed72537857b - main - netinet6: perform out-of-bounds check for loX multicast statistics List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: melifaro X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0ed72537857bfb6ac6d19b0852a52288db79b8b0 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1657021476; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=snb+jjlLbCrxnki1Z9rtSwpvuzW4S4pdUUsZ49Schbc=; b=fZDbXVpYQOXbq8o5cHi8EYbCNTXkEMVqw35AjFH3scBdkJkw+XPDPNHeGtdREX7hH88mCl HxU6sxBIqZeZziktLek1ekBlipT43vpJ53Hr8hIknwNMEKZij5vjh/Kb3MDt043gAL1gTv 0bVoULBe1Lqb1GA889gZvwNijlIxDq8BptwlulX02ESqfVY4ST6hVIKL6gyi6FvDCjuONP GrjOuKI9CQ8jbP1hOadrCss907dQyyfWXs+PCjNgtgSiU58TOSNXj5qIIqJzPB8I9qd7oF ggyd7NjlJZUDw7u0NEqpHBCQwwEkx08N8H9fnMZKa+rz0ogcvPxUxm2tapFnvQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1657021476; a=rsa-sha256; cv=none; b=XvY4b1PHy7LuFzI9o6yebtMFZmokBl3Ebm/P/u35eeM9ZQ3v3zjnUN7l+AvqM6PAILwXbw w0Xy6IbJPr83WhAVOAeTpz/4YtdEmsbgOeN9WSh5SdCsf6YVoOcXcuD/xsbfaLct+8YkUe gif53uPstTmIRw4EgLBT8BE9NB75oOfUJzztipyjZExl1BzHtiwYaaUEywyZ3oH0ev+mVT sXW515gMBi6vgPz+tV1sft4tzr08CpZhZdEWLGfQZnEL9ymmwy6qZXD3PBZGtY2QSExECX cgVnTVE3NPzOULzhgcK0u5ssgFIxMhctbZbKQ5YuOvQYb0wokDeUBixXm8wcqg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=0ed72537857bfb6ac6d19b0852a52288db79b8b0 commit 0ed72537857bfb6ac6d19b0852a52288db79b8b0 Author: Alexander V. Chernikov AuthorDate: 2022-07-04 20:03:06 +0000 Commit: Alexander V. Chernikov CommitDate: 2022-07-05 11:44:30 +0000 netinet6: perform out-of-bounds check for loX multicast statistics Currently, some per-mbuf multicast statistics is stored in the per-interface ip6stat.ip6s_m2m[] array of size 32 (IP6S_M2MMAX). Check that loopback ifindex falls within 0.. IP6S_M2MMAX-1 range to avoid silent data corruption. The latter cat happen with large number of VNETs. Reviewed by: glebius Differential Revision: https://reviews.freebsd.org/D35715 MFC after: 2 weeks --- sys/netinet6/ip6_input.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/sys/netinet6/ip6_input.c b/sys/netinet6/ip6_input.c index a9bc05f0c19c..6394475d7df8 100644 --- a/sys/netinet6/ip6_input.c +++ b/sys/netinet6/ip6_input.c @@ -588,12 +588,11 @@ ip6_input(struct mbuf *m) IP6STAT_INC(ip6s_mext1); } else { if (m->m_next) { - if (m->m_flags & M_LOOP) { - IP6STAT_INC(ip6s_m2m[V_loif->if_index]); - } else if (rcvif->if_index < IP6S_M2MMAX) - IP6STAT_INC(ip6s_m2m[rcvif->if_index]); - else - IP6STAT_INC(ip6s_m2m[0]); + struct ifnet *ifp = (m->m_flags & M_LOOP) ? V_loif : rcvif; + int ifindex = ifp->if_index; + if (ifindex >= IP6S_M2MMAX) + ifindex = 0; + IP6STAT_INC(ip6s_m2m[ifindex]); } else IP6STAT_INC(ip6s_m1); }