<feed xmlns='http://www.w3.org/2005/Atom'>
<title>src/tests/sys/kqueue, branch main</title>
<subtitle>FreeBSD source tree</subtitle>
<id>http://cgit.freebsd.org/src/atom?h=main</id>
<link rel='self' href='http://cgit.freebsd.org/src/atom?h=main'/>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/'/>
<updated>2026-07-29T17:45:02Z</updated>
<entry>
<title>kqueue: Avoid enqueuing an already-enqueued knote</title>
<updated>2026-07-29T17:45:02Z</updated>
<author>
<name>Mark Johnston</name>
<email>markj@FreeBSD.org</email>
</author>
<published>2026-07-27T15:28:50Z</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=d8bdcb08d0ebe8cdc7f589cf05283882bff94d3a'/>
<id>urn:sha1:d8bdcb08d0ebe8cdc7f589cf05283882bff94d3a</id>
<content type='text'>
knotes with a non-trivial f_copy implementation may be activated before
kqueue_fork_copy_knote() is finished.  In particular, it may be enqueued
at the time that kqueue_fork_copy_knote() calls knote_enqueue().  Guard
against this.

Add a test case which triggers the race.

Fix several other problems with the replication of knote state:
- Make sure only the KN_ACTIVE and KN_DISABLED status flags are
  inherited, the rest should not be copied.
- Ignore marker knotes.
- Ignore knotes for kqueues.  They cannot be safely copied into the
  child without more work, as kqueues are inherently local to a process;
  on fork, we need to ensure that such knotes are patched to reference
  the new kqueue, not the original.
- Try to keep knote state stable by holding the kqueue and knlist locks
  while copying.

Approved by:	so
Security:	FreeBSD-SA-26:50.kqueue
Security:	CVE-2026-58083
Reviewed by:	kib
Reported by:	Hazley Samsudin of GovTech CSG
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D58223
</content>
</entry>
<entry>
<title>tests: kqueue: improve diagnostics for our CPONFORK test</title>
<updated>2026-04-17T03:57:06Z</updated>
<author>
<name>Kyle Evans</name>
<email>kevans@FreeBSD.org</email>
</author>
<published>2026-04-17T03:57:06Z</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=51d2c38010824b90d7462711896a88165db9d015'/>
<id>urn:sha1:51d2c38010824b90d7462711896a88165db9d015</id>
<content type='text'>
Notably, confirm in the child that our close-on-fork fd is actually
closed, and break RECV_ALL out into a table and check each bit
individually to provide a better message when the test fails.

While we're here, just switch to waitid() rather than trying to identify
the point where we have to make the switch.  This reduces maintenance
slightly, as keeping our assertion static would require still adding to
a _RECV_ALL mask *just* for that purpose.

Reviewed by:	kib, markj (both slightly earlier version)
Differential Revision:	https://reviews.freebsd.org/D56372
</content>
</entry>
<entry>
<title>tests: kqueue: add a basic test for CPONFORK</title>
<updated>2026-04-09T02:37:11Z</updated>
<author>
<name>Kyle Evans</name>
<email>kevans@FreeBSD.org</email>
</author>
<published>2026-04-09T02:37:00Z</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=0c9cec8b66e7033f50059329704515d5222b9ff4'/>
<id>urn:sha1:0c9cec8b66e7033f50059329704515d5222b9ff4</id>
<content type='text'>
Just copy over a timer and a write-filter, be sure that we can observe
both in the child.  Maybe the timer should check for a minimum time
passed, but I don't know that we'd be likely to get that wrong.

This also adds a negative test with a kqueue that is *not* set for
CPONFORK being added to the first one, made readable, and confirming
that we don't see a knote for it in the child.

Some other improvements to the test noted in the review are planned in
the short term, but they're not particularly worth blocking adding this
as a basic sanity check.

Reviewed by:	kib, markj
Differential Revision:	https://reviews.freebsd.org/D56223
</content>
</entry>
<entry>
<title>tests/kqueue: repair flaky test</title>
<updated>2025-06-24T22:29:03Z</updated>
<author>
<name>Gleb Smirnoff</name>
<email>glebius@FreeBSD.org</email>
</author>
<published>2025-06-24T22:28:07Z</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=994bec47ee7f38bd20366b812313b2ea0714ef19'/>
<id>urn:sha1:994bec47ee7f38bd20366b812313b2ea0714ef19</id>
<content type='text'>
The test arms timer for 500 msec and then sleeps 1 second and expects that
the timer would always fire exactly 2 times.  However, it has a chance to
legitimately fire only once.  This makes the test flaky.  Fix the test
reducing sleep time down to 495 msec.

The problem started to show up recently, and I attribute that to
626ea75ed2e9.  Before this revision sleep(3) was almost always sleeping
over 1000 msec, now it can sleep exactly 1000 msec.

Reviewed by:		markj
Differential Revision:	https://reviews.freebsd.org/D50996
</content>
</entry>
<entry>
<title>Remove residual blank line at start of Makefile</title>
<updated>2024-07-15T22:43:39Z</updated>
<author>
<name>Warner Losh</name>
<email>imp@FreeBSD.org</email>
</author>
<published>2024-07-15T04:46:32Z</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=e9ac41698b2f322d55ccf9da50a3596edb2c1800'/>
<id>urn:sha1:e9ac41698b2f322d55ccf9da50a3596edb2c1800</id>
<content type='text'>
This is a residual of the $FreeBSD$ removal.

MFC After: 3 days (though I'll just run the command on the branches)
Sponsored by: Netflix
</content>
</entry>
<entry>
<title>kqueue tests: Add a regression test</title>
<updated>2024-01-27T18:51:13Z</updated>
<author>
<name>Mark Johnston</name>
<email>markj@FreeBSD.org</email>
</author>
<published>2023-11-24T15:28:13Z</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=f5463265955b829775bbb32e1fd0bc11dafc36ce'/>
<id>urn:sha1:f5463265955b829775bbb32e1fd0bc11dafc36ce</id>
<content type='text'>
Based on the test case submitted by Andreas Bock for PR 275286.

PR:		275286
MFC after:	2 weeks
</content>
</entry>
<entry>
<title>Remove $FreeBSD$: one-line sh pattern</title>
<updated>2023-08-16T17:55:03Z</updated>
<author>
<name>Warner Losh</name>
<email>imp@FreeBSD.org</email>
</author>
<published>2023-08-16T17:55:03Z</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=d0b2dbfa0ecf2bbc9709efc5e20baf8e4b44bbbf'/>
<id>urn:sha1:d0b2dbfa0ecf2bbc9709efc5e20baf8e4b44bbbf</id>
<content type='text'>
Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/
</content>
</entry>
<entry>
<title>Remove $FreeBSD$: one-line .c comment pattern</title>
<updated>2023-08-16T17:54:29Z</updated>
<author>
<name>Warner Losh</name>
<email>imp@FreeBSD.org</email>
</author>
<published>2023-08-16T17:54:29Z</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=2a63c3be158216222d89a073dcbd6a72ee4aab5a'/>
<id>urn:sha1:2a63c3be158216222d89a073dcbd6a72ee4aab5a</id>
<content type='text'>
Remove /^/[*/]\s*\$FreeBSD\$.*\n/
</content>
</entry>
<entry>
<title>Remove $FreeBSD$: two-line .h pattern</title>
<updated>2023-08-16T17:54:16Z</updated>
<author>
<name>Warner Losh</name>
<email>imp@FreeBSD.org</email>
</author>
<published>2023-08-16T17:54:16Z</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=b3e7694832e81d7a904a10f525f8797b753bf0d3'/>
<id>urn:sha1:b3e7694832e81d7a904a10f525f8797b753bf0d3</id>
<content type='text'>
Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
</content>
</entry>
<entry>
<title>kqueue tests: Simplify the test runner</title>
<updated>2022-05-25T00:17:41Z</updated>
<author>
<name>Mark Johnston</name>
<email>markj@FreeBSD.org</email>
</author>
<published>2022-05-25T00:17:04Z</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=68fe988a40ca5dedec426735f52471d9af7bddbd'/>
<id>urn:sha1:68fe988a40ca5dedec426735f52471d9af7bddbd</id>
<content type='text'>
Just invoke the test program directly instead of trying to convert its
output to TAP format.  The test suite is all or nothing; there's no way
to enumerate individual test cases, so there's no advantage in trying to
massage its output, and doing so throws away information that's useful
when diagnosing test failures.

MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
</content>
</entry>
</feed>
