diff options
| author | Konstantin Belousov <kib@FreeBSD.org> | 2026-08-14 05:23:22 +0000 |
|---|---|---|
| committer | Konstantin Belousov <kib@FreeBSD.org> | 2026-08-14 14:35:38 +0000 |
| commit | f6000e9dd934db9fefc31eaa07a7d8fa9277484e (patch) | |
| tree | 648e1501e9f4f2d5be122c0bea5a745fe1083c2a | |
| parent | 01d4e3c1d3ffa14041d8faa3a7a6e6509e73af84 (diff) | |
kern/kern_proc.c: do not throw out read data in get_ps_strings()
Since vmspace_iop()/proc_readmem() might return -1 on error from
vmspace_rwmem(), account for this and stop reading but return already
accumulated data if any, instead of returning an error.
PR: 297512
Reported and tested by: Stéphane D'Alu <sdalu@sdalu.com>
Reviewed by: markj
Fixes: e1b0d051bbf7 ("proc: Allow to make proc_rwmem() operate on a consistent address space")
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D58838
| -rw-r--r-- | sys/kern/kern_proc.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/sys/kern/kern_proc.c b/sys/kern/kern_proc.c index 41e5b6594981..6489feca99fc 100644 --- a/sys/kern/kern_proc.c +++ b/sys/kern/kern_proc.c @@ -2064,8 +2064,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; |
