Date: Sun, 16 Jan 2022 22:15:30 +0000 From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 240573] sysctl() does not return ENOMEM but silently truncate returned data Message-ID: <bug-240573-227-pGS0bHAEag@https.bugs.freebsd.org/bugzilla/> In-Reply-To: <bug-240573-227@https.bugs.freebsd.org/bugzilla/>
index | next in thread | previous in thread | raw e-mail
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=240573 Mark Johnston <markj@FreeBSD.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|New |Open --- Comment #2 from Mark Johnston <markj@FreeBSD.org> --- For kern_proc_vmmap_out(), we have: /* Halt filling and truncate rather than exceeding maxlen */ if (maxlen != -1 && maxlen < kve->kve_structsize) { error = 0; vm_map_lock_read(map); break; } else if (maxlen != -1) maxlen -= kve->kve_structsize; if (sbuf_bcat(sb, kve, kve->kve_structsize) != 0) error = ENOMEM; Note that when filling out info for the KERN_PROC_VMMAP sysctl, we have maxlen == -1. So we just end up calling sbuf_bcat(), which will indeed return an error if the output buffer is too small. I think there is no bug there. I think you are right about sysctl_posix_shm_list(), we should return an error if req->oldptr is non-NULL and the buffer is truncated. I believe it would be sufficient to just remove the referenced check, sbuf_bcat() will signal an error. -- You are receiving this mail because: You are the assignee for the bug.home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-240573-227-pGS0bHAEag>
