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/> References: <bug-240573-227@https.bugs.freebsd.org/bugzilla/>
next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D240573 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 !=3D -1 && maxlen < kve->kve_structsize) { error =3D 0; vm_map_lock_read(map); break; } else if (maxlen !=3D -1) maxlen -=3D kve->kve_structsize; if (sbuf_bcat(sb, kve, kve->kve_structsize) !=3D 0) error =3D ENOMEM; Note that when filling out info for the KERN_PROC_VMMAP sysctl, we have max= len =3D=3D -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 er= ror 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. --=20 You are receiving this mail because: You are the assignee for the bug.=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-240573-227-pGS0bHAEag>