Bug 289299 - sys/netpfil/pf/rules_counter:keepcounters testcase fails on amd64 in CI
Summary: sys/netpfil/pf/rules_counter:keepcounters testcase fails on amd64 in CI
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: tests (show other bugs)
Version: CURRENT
Hardware: amd64 Any
: --- Affects Only Me
Assignee: Kristof Provost
URL:
Keywords: regression
Depends on:
Blocks:
 
Reported: 2025-09-04 14:48 UTC by Siva Mahadevan
Modified: 2025-10-12 03:42 UTC (History)
2 users (show)

See Also:


Attachments
kyua test report (3.64 KB, text/plain)
2025-09-04 14:48 UTC, Siva Mahadevan
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Siva Mahadevan freebsd_committer freebsd_triage 2025-09-04 14:48:17 UTC
Created attachment 263487 [details]
kyua test report

The 'sys/netpfil/pf/rules_counter:keepcounters' testcase fails on amd64 with the following message:


Standard output: 
Executing command [ jexec alcatraz pfctl -s r -v ] 
Executing command [ ping -c 3 192.0.2.2 ] 
Executing command [ jexec alcatraz pfctl -s r -v ] 
Executing command [ jexec alcatraz pfctl -s r -v ] 
Executing command [ ping -c 3 192.0.2.2 ] 
Executing command [ jexec alcatraz pfctl -s r -v ] 
 
Standard error: 
pf enabled 
Ethernet rules cleared 
rules cleared 
nat cleared 
0 tables deleted. 
rules cleared 
0 states cleared 
source tracking entries cleared 
pf: statistics cleared 
pf: interface flags reset 
Fail: regexp Evaluations: [1-9][0-9]*[[:space:]]*Packets: [1-9][0-9]*[[:space:]]*Bytes: [1-9][0-9]*[[:space:]]* not in stdout 
pass all flags S/SA keep state 
  [ Evaluations: 0         Packets: 0         Bytes: 0           States: 0     ] 
  [ Source Nodes: 0      Limit: 0      NAT/RDR: 0      Route: 0      ] 
  [ Inserted: uid 0 pid 0 State Creations: 0     ]


I reproduced this error using Bricoler:

$ bricoler run freebsd-src-regression-suite --param freebsd-src:url=/usr/src --param freebsd-src:branch= --param freebsd-src-regression-suite:hypervisor=bhyve --param freebsd-src-regression-suite:memory=4096 --param freebsd-src-regression-suite:ncpus=2 --param freebsd-src-regression-suite:parallelism=1 --param freebsd-src-regression-suite:tests='sys/netpfil/pf/rules_counter:keepcounters'

@kp I bisected the failure to this commit: https://cgit.freebsd.org/src/commit/?id=275ff85b254c1f160f965dd9dbb5801f66022eab (pf: fix struct pf_krule_global leak). Note that the 'sys/netpfil/pf/rules_counter:4G' testcase is also failing in the same testsuite, they may be related. Please triage as necessary.
Comment 1 commit-hook freebsd_committer freebsd_triage 2025-09-17 14:16:34 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=e63534edbcd050215bc109cd89a31ba30c5ea850

commit e63534edbcd050215bc109cd89a31ba30c5ea850
Author:     Kristof Provost <kp@FreeBSD.org>
AuthorDate: 2025-09-17 08:12:11 +0000
Commit:     Kristof Provost <kp@FreeBSD.org>
CommitDate: 2025-09-17 14:15:16 +0000

    pf: fix rules_counter:keepcounters test

    The previous pf_krule_global leak fix was a bit too aggressive and cleaned up
    the inactive tree pointer before we needed it to preserve counters. Only clean
    up anchors that are entirely unused. Clean up pf_main_ruleset on pf shutdown.

    PR:             289299
    MFC after:      1 week
    Fixes:          275ff85b25 ("pf: fix struct pf_krule_global leak")
    Sponsored by:   Rubicon Communications, LLC ("Netgate")

 sys/netpfil/pf/pf_ioctl.c   |  5 +++++
 sys/netpfil/pf/pf_ruleset.c | 12 ++++++------
 2 files changed, 11 insertions(+), 6 deletions(-)
Comment 2 commit-hook freebsd_committer freebsd_triage 2025-09-24 13:41:33 UTC
A commit in branch stable/15 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=e70a2bcdc4f7a3492cfe7064c2fe7398a628da52

commit e70a2bcdc4f7a3492cfe7064c2fe7398a628da52
Author:     Kristof Provost <kp@FreeBSD.org>
AuthorDate: 2025-09-17 08:12:11 +0000
Commit:     Kristof Provost <kp@FreeBSD.org>
CommitDate: 2025-09-24 13:32:11 +0000

    pf: fix rules_counter:keepcounters test

    The previous pf_krule_global leak fix was a bit too aggressive and cleaned up
    the inactive tree pointer before we needed it to preserve counters. Only clean
    up anchors that are entirely unused. Clean up pf_main_ruleset on pf shutdown.

    PR:             289299
    MFC after:      1 week
    Fixes:          275ff85b25 ("pf: fix struct pf_krule_global leak")
    Sponsored by:   Rubicon Communications, LLC ("Netgate")

    (cherry picked from commit e63534edbcd050215bc109cd89a31ba30c5ea850)

 sys/netpfil/pf/pf_ioctl.c   |  5 +++++
 sys/netpfil/pf/pf_ruleset.c | 12 ++++++------
 2 files changed, 11 insertions(+), 6 deletions(-)