git: c9b5dd2eb820 - stable/15 - kern/kern_proc.c: do not throw out read data in get_ps_strings()

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Sun, 16 Aug 2026 02:46:27 UTC
The branch stable/15 has been updated by kib:

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

commit c9b5dd2eb8200eb9be6795fd2b0774991d85e1ef
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2026-08-14 05:23:22 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2026-08-16 02:41:18 +0000

    kern/kern_proc.c: do not throw out read data in get_ps_strings()
    
    PR:     297512
    
    (cherry picked from commit f6000e9dd934db9fefc31eaa07a7d8fa9277484e)
---
 sys/kern/kern_proc.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/sys/kern/kern_proc.c b/sys/kern/kern_proc.c
index 8cf828c7360d..add8cbcde1d5 100644
--- a/sys/kern/kern_proc.c
+++ b/sys/kern/kern_proc.c
@@ -2066,8 +2066,11 @@ get_ps_strings(struct thread *td, struct proc *p, struct sbuf *sb,
 		for (sptr = proc_vector[i]; ; sptr += GET_PS_STRINGS_CHUNK_SZ) {
 			error = proc_read_string(td, vm, sptr, pss_string,
 			    sizeof(pss_string));
-			if (error != 0)
+			if (error != 0) {
+				if (done != 0)
+					error = 0;
 				goto done;
+			}
 			len = strnlen(pss_string, GET_PS_STRINGS_CHUNK_SZ);
 			if (done + len >= nchr)
 				len = nchr - done - 1;