git: 9fbdf07d9ef2 - stable/15 - kqueue: fix the always-empty NT_PROCSTAT_KQUEUES core note
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 31 Oct 2026 18:21:45 UTC
The branch stable/15 has been updated by adrian:
URL: https://cgit.FreeBSD.org/src/commit/?id=9fbdf07d9ef27773aae245505ba47d0c2f83e901
commit 9fbdf07d9ef27773aae245505ba47d0c2f83e901
Author: Abdelkader Boudih <freebsd@seuros.com>
AuthorDate: 2026-08-03 18:11:49 +0000
Commit: Adrian Chadd <adrian@FreeBSD.org>
CommitDate: 2026-10-31 18:20:17 +0000
kqueue: fix the always-empty NT_PROCSTAT_KQUEUES core note
sbuf reserves a byte of its buffer for the terminator, so the sbuf
created with maxlen held one byte less than the sizing pass had
computed. The last record overflowed it, sbuf_bcat() failed, and the
error == 0 guard skipped the copy into the caller's sbuf, so the note
has been emitted at full size but zero filled since 5e7c43ff02dc.
Fixes: 5e7c43ff02dc
Reviewed by: adrian, markj
Differential Revision: https://reviews.freebsd.org/D58583
MFC after: 1 week
(cherry picked from commit 5078280bb42c00eecffeabf93706c145e87b4b2b)
---
sys/kern/kern_event.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sys/kern/kern_event.c b/sys/kern/kern_event.c
index 058dbca25a72..6a256cdbf606 100644
--- a/sys/kern/kern_event.c
+++ b/sys/kern/kern_event.c
@@ -3375,7 +3375,7 @@ kern_proc_kqueues_out(struct proc *p, struct sbuf *sb, size_t maxlen,
sb_len = 128;
else
sb_len = maxlen;
- s = sbuf_new(&sm, NULL, sb_len, SBUF_FIXEDLEN);
+ s = sbuf_new(&sm, NULL, sb_len + 1, SBUF_FIXEDLEN);
error = kern_proc_kqueues_out1(curthread, p, s, compat32);
sbuf_finish(s);
if (error == 0)