git: 5078280bb42c - main - kqueue: fix the always-empty NT_PROCSTAT_KQUEUES core note
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 03 Aug 2026 18:15:41 UTC
The branch main has been updated by adrian:
URL: https://cgit.FreeBSD.org/src/commit/?id=5078280bb42c00eecffeabf93706c145e87b4b2b
commit 5078280bb42c00eecffeabf93706c145e87b4b2b
Author: Abdelkader Boudih <freebsd@seuros.com>
AuthorDate: 2026-08-03 18:11:49 +0000
Commit: Adrian Chadd <adrian@FreeBSD.org>
CommitDate: 2026-08-03 18:11:56 +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
---
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 e8395707a29d..31dab74bd7bd 100644
--- a/sys/kern/kern_event.c
+++ b/sys/kern/kern_event.c
@@ -3366,7 +3366,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)