From nobody Wed Apr 15 19:27:43 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 4fwrl84hjrz6ZLHS for ; Wed, 15 Apr 2026 19:27:48 +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 "R12" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4fwrl82tzgz3Tbf for ; Wed, 15 Apr 2026 19:27:48 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1776281268; 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=R1auKZa0UmlnVaZc7EmGAllIs8Q0NIOKkqeGHZBznzI=; b=Eodsx0kTQMawsGdSKqaW7uEhbS2KtfHgpEm+keZ4gfF5cltOFbZEqztpH9czRyuLaPkL1q p91n8MyyMGrIrBWLlmEQMVQG2Ic6JXMAV48dYY8rorgBxQ1T/4xsJTqUZgkkqhFj3sOV3j i6MIVJdAzzk4uX8zxiawhAkMp/kNgYbxi8yw3SSWYfFpQup/YeHW57FHZ4H2Fs+/iiB42f 7imDtflGt4uTDzQtCpKh2jK53P4brJ5YgZGEEmfjLZlOIF6cT4xu+uwEfCdyya2Psa+8XT brqE98r/wzWeLuxfOpDfitS0iYb0Jk9ot5ddkaQ+lcE+0mI+neRDKAKBhvFdtA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1776281268; a=rsa-sha256; cv=none; b=Z+0RNtNzKSCSkxaRNhPJw+vmXlNm/V4Hk5zz2P/Lyg4k7DXtJmYAA7tYRB5v4DPy7v9euY 120s9GMVS46P62a3eLy52ujXcPFncfqEJqVNih25APUp+A0emomnIjZsmQqOcWjKngG+kv /GdLKz6KydlsxgLqQq1JO21q6XdHg6ErVB7zXycpRsa+3St92RgNOQKsJKOPuZTAe/uiYN hZsFz94zCneRa1r9X8+rMBwlb396dCuAksskmr1vNzUnUaku7rwAG0+5GAwoGJUtXP5+Gs SgJqQLkvbg81RbJhEe9Qvq4g9wCNIOrplKZtDFLfjHDm7NoDNL+SDY6i3Ka/FQ== 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=1776281268; 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=R1auKZa0UmlnVaZc7EmGAllIs8Q0NIOKkqeGHZBznzI=; b=WXEjNrbgWOrJa5zcX2z4kmTY163O5CrFOb8+XCxivdF9P9vL/4A5ymqxZtBKog9RoUBubS VwC/bVk/ysepIKTH91OKI9dsKJUb+v18NX7r6j0zbCXUDqb/WCvPnD53KMr3rvN1kMq0XD +06Z0F0llXGOxmoeJUxVjbvSq5j3EY7hHNh5MdcGEqwn1r+P8bMfecP7+QJrkKm8EC4qpF F8hK6BPu31GpyzoSwB2WffB4LVbBHS+U3U6ljhFDIL3fS8U6YNVp3N2ihnJbXXcvBNjV+x rqdGk8yv0Ufr7O8kPRHZGqd8wY3K3IjsnAeimvCbSeJYhuc0dPJTw8vVykp5EQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4fwrl82S3bzZsX for ; Wed, 15 Apr 2026 19:27:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 18613 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 15 Apr 2026 19:27:43 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Michael Tuexen Subject: git: 04b994d19eec - main - bpf: fix handling the read timeout on ppc64 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: 8bit X-Git-Committer: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 04b994d19eec68a6b5d27ff4b0fa223a05f00e1f Auto-Submitted: auto-generated Date: Wed, 15 Apr 2026 19:27:43 +0000 Message-Id: <69dfe6af.18613.27aafdc1@gitrepo.freebsd.org> The branch main has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=04b994d19eec68a6b5d27ff4b0fa223a05f00e1f commit 04b994d19eec68a6b5d27ff4b0fa223a05f00e1f Author: Michael Tuexen AuthorDate: 2026-04-15 19:24:05 +0000 Commit: Michael Tuexen CommitDate: 2026-04-15 19:24:05 +0000 bpf: fix handling the read timeout on ppc64 On platforms other than amd64, BIOCSRTIMEOUT is equal to BIOCSRTIMEOUT32. Therefore, running the COMPAT_FREEBSD32 code basically clears tv_usec on big endian platforms. When tcpdump is used, the timeout requested is 100ms, which gets cleared to 0 on ppc64 platforms. This results in tcpdump showing the packets only when the read buffer is full. Thanks to kib for guiding me to the correct fix. Reported by: ivy Reviewed by: adrian, kib MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D56399 --- sys/net/bpf.c | 42 ++++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/sys/net/bpf.c b/sys/net/bpf.c index 05877f6410a4..9d0b76753560 100644 --- a/sys/net/bpf.c +++ b/sys/net/bpf.c @@ -1201,7 +1201,7 @@ bpfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags, case BIOCGDLTLIST32: case BIOCGRTIMEOUT32: case BIOCSRTIMEOUT32: - if (SV_PROC_FLAG(td->td_proc, SV_ILP32)) { + if (SV_CURPROC_FLAG(SV_ILP32)) { BPFD_LOCK(d); d->bd_compat32 = 1; BPFD_UNLOCK(d); @@ -1209,6 +1209,19 @@ bpfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags, } #endif +#if defined(COMPAT_FREEBSD32) + if (SV_CURPROC_FLAG(SV_ILP32)) { + /* + * On platforms other than amd64, BIOC[GS]RTIMEOUT32 is equal to + * BIOC[GS]RTIMEOUT. Since this is difficult to handle in the + * switch command, map them. + */ + if (cmd == BIOCSRTIMEOUT32) + cmd = BIOCSRTIMEOUT; + if (cmd == BIOCGRTIMEOUT32) + cmd = BIOCGRTIMEOUT; + } +#endif CURVNET_SET(TD_TO_VNET(td)); switch (cmd) { default: @@ -1419,23 +1432,19 @@ bpfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags, * Set read timeout. */ case BIOCSRTIMEOUT: -#if defined(COMPAT_FREEBSD32) && defined(__amd64__) - case BIOCSRTIMEOUT32: -#endif { struct timeval *tv = (struct timeval *)addr; -#if defined(COMPAT_FREEBSD32) +#ifdef COMPAT_FREEBSD32 struct timeval32 *tv32; struct timeval tv64; - if (cmd == BIOCSRTIMEOUT32) { + if (SV_CURPROC_FLAG(SV_ILP32)) { tv32 = (struct timeval32 *)addr; tv = &tv64; tv->tv_sec = tv32->tv_sec; tv->tv_usec = tv32->tv_usec; - } else + } #endif - tv = (struct timeval *)addr; /* * Subtract 1 tick from tvtohz() since this isn't @@ -1450,31 +1459,24 @@ bpfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags, * Get read timeout. */ case BIOCGRTIMEOUT: -#if defined(COMPAT_FREEBSD32) && defined(__amd64__) - case BIOCGRTIMEOUT32: -#endif { - struct timeval *tv; -#if defined(COMPAT_FREEBSD32) && defined(__amd64__) + struct timeval *tv = (struct timeval *)addr; +#ifdef COMPAT_FREEBSD32 struct timeval32 *tv32; struct timeval tv64; - if (cmd == BIOCGRTIMEOUT32) + if (SV_CURPROC_FLAG(SV_ILP32)) tv = &tv64; - else #endif - tv = (struct timeval *)addr; - tv->tv_sec = d->bd_rtout / hz; tv->tv_usec = (d->bd_rtout % hz) * tick; -#if defined(COMPAT_FREEBSD32) && defined(__amd64__) - if (cmd == BIOCGRTIMEOUT32) { +#ifdef COMPAT_FREEBSD32 + if (SV_CURPROC_FLAG(SV_ILP32)) { tv32 = (struct timeval32 *)addr; tv32->tv_sec = tv->tv_sec; tv32->tv_usec = tv->tv_usec; } #endif - break; }