From nobody Fri Apr 17 09:58:09 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 4fxr135d8Tz6ZScf; Fri, 17 Apr 2026 09:58:15 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (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 "smtp.freebsd.org", Issuer "R13" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4fxr134xJRz3w2R; Fri, 17 Apr 2026 09:58:15 +0000 (UTC) (envelope-from kp@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1776419895; 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=uxUt3vISo6Co4LBDZY89eBgz/lpzgksdJltr0Y9yjZo=; b=khux1+JO9j6P/e1e3iuYk7Qk1/nn0N8tAFXCgYhUZs8jLZNGDIhp2HMn3O0gg5CGzlvbLj DpW48lD17lsxbTkme3gt6zPzdixXaREByYbpfF6U4Tzj9BK0FLJaklwT+7rhvTk4JrG3A9 gBAKnNJutiY9f/7vPuzb4hg0o4j3x7wHXGos9tr19sZmqq4+uuoIHaEhBocLCK/W4CaJ51 H9fOtc2LyV6o2IPO2zvmM6J+pLy8DnJTASeBNf6u2UlNujo0i3CZvsRB2C6qZRa3aLKcdK ehesX3KEo70B+ZFb+n/VMRuCQoLGXFYsjMTgUfFuK4JF2nFq5x6ZkrAc2uhWSA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1776419895; a=rsa-sha256; cv=none; b=RNshTF1BXfN7tRHDcjYfvAqqN7m9I3K0e3QOT5JqWZ5x59JeizUGUuxy9mJTNsFNLtYolT enPGGd2/6gIIgfOPFjdlkgqj+uBVnihi/31VBrGdDuCgZuHiO1gu+VVX+JJMa4ubdfjJD+ ooBFnoJzYEUTGgroQZIDXGuOhGXRWq91WWMm8z9bdGCXTa+5f/xOOe5DrioDN5on4DfuUx OlAOpP7CKsmH9K4nf8nO/bIGbPBPLT3wgmowUzHqVZ3Te8usC4b/gahKzJyd3sZhMXjYDT MO/Kgop9fw/ubC9+7g52W/HjeeBGNFgGZ2iraNU4bXpp9oZBns8e4GrbOyhSWg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1776419895; 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=uxUt3vISo6Co4LBDZY89eBgz/lpzgksdJltr0Y9yjZo=; b=IhayaEkuPTA1VpzjuH9y0vWSYn1Kr2V5MCJYEX1R9gu7vMiCMU+7K/dypwCnq9BAzHQ3br QGAD5r9aF4kALjcIziMTlzSH46gsGjTFm58THrN5cxwRt5LcxU8f46TEQ3gk1eJuOjHUIX 3QS2qTcjALZRmCjHA1ax5y+L88ytr/wrKyCH5dRN8Mbu2Q+gt20jCwhpCUAxrrubnO8Rfv Lnn68vlFD0ZXWPtcvudrFfG/ut9t8dAL40gJ3ach1lrL1KtFPUWWOtmrb7IZIv9+nIRsEo qTd3pRWdcpc2Aai4CRPwcAxxEenA93wSqgTeONLLNZkKPf9vWM0lE86wQe0sOw== Received: from venus.codepro.be (venus.codepro.be [5.9.86.228]) (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 (2048 bits) client-digest SHA256) (Client CN "mx1.codepro.be", Issuer "R12" (not verified)) (Authenticated sender: kp) by smtp.freebsd.org (Postfix) with ESMTPSA id 4fxr133VV4znqm; Fri, 17 Apr 2026 09:58:15 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: by venus.codepro.be (Postfix, authenticated sender kp) id D0EAE1FF98; Fri, 17 Apr 2026 11:58:09 +0200 (CEST) From: Kristof Provost To: Andrew Gallatin Cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: 956acdce0505 - main - loopback: Account for packet drops Date: Fri, 17 Apr 2026 11:58:09 +0200 X-Mailer: MailMate (2.0r6272) Message-ID: In-Reply-To: <69de99dd.422ab.2b84d627@gitrepo.freebsd.org> References: <69de99dd.422ab.2b84d627@gitrepo.freebsd.org> 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 14 Apr 2026, at 21:47, Andrew Gallatin wrote: > The branch main has been updated by gallatin: > > URL: https://cgit.FreeBSD.org/src/commit/?id=3D956acdce0505ca8028d287d3= b44789c623c8f37e > > commit 956acdce0505ca8028d287d3b44789c623c8f37e > Author: Andrew Gallatin > AuthorDate: 2026-04-14 19:43:28 +0000 > Commit: Andrew Gallatin > CommitDate: 2026-04-14 19:43:28 +0000 > > loopback: Account for packet drops > > Make loopback packet drops more obvious by reporting them > in interface stats visable via netstat -ni > Since loopback uses netisr, packets can be dropped if the > netisr queue overflows. These drops are visible via > netisr -Q, but its not an obvious place to look. > > Differential Revision: https://reviews.freebsd.org/D56356 > Reviewed by: glebius, tuexen > Sponsored by: Netflix > --- > sys/net/if_loop.c | 10 +++++++--- > 1 file changed, 7 insertions(+), 3 deletions(-) > > diff --git a/sys/net/if_loop.c b/sys/net/if_loop.c > index 37309260a0d3..2ff265d5d1e7 100644 > --- a/sys/net/if_loop.c > +++ b/sys/net/if_loop.c > @@ -350,9 +350,13 @@ if_simloop(struct ifnet *ifp, struct mbuf *m, int = af, int hlen) > m_freem(m); > return (EAFNOSUPPORT); > } > - if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1); > - if_inc_counter(ifp, IFCOUNTER_IBYTES, m->m_pkthdr.len); > - netisr_queue(isr, m); /* mbuf is free'd on failure. */ > + if (netisr_queue(isr, m) =3D=3D 0) { > + if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1); > + if_inc_counter(ifp, IFCOUNTER_IBYTES, m->m_pkthdr.len); I=E2=80=99m seeing reproducible KASAN use-after-free warnings here (runni= ng the pf tests). Which makes sense, because after the netisr_queue() call we no longer own= the mbuf. I think we need something like this: diff --git a/sys/net/if_loop.c b/sys/net/if_loop.c index 2ff265d5d1e7..33ddd3a8540e 100644 --- a/sys/net/if_loop.c +++ b/sys/net/if_loop.c @@ -276,6 +276,7 @@ int if_simloop(struct ifnet *ifp, struct mbuf *m, int af, int hlen) { int isr; + int32_t len; M_ASSERTPKTHDR(m); m_tag_delete_nonpersistent(m); @@ -350,9 +351,10 @@ if_simloop(struct ifnet *ifp, struct mbuf *m, int a= f, int hlen) m_freem(m); return (EAFNOSUPPORT); } + len =3D m->m_pkthdr.len; if (netisr_queue(isr, m) =3D=3D 0) { if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1); - if_inc_counter(ifp, IFCOUNTER_IBYTES, m->m_pkthdr.len); + if_inc_counter(ifp, IFCOUNTER_IBYTES, len); } else { /* mbuf is free'd on failure. */ if_inc_counter(ifp, IFCOUNTER_IQDROPS, 1); Best regards, Kristof