Date: Sun, 11 Nov 2018 17:36:16 +0000 From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 231515] Potential out-of-bounds access in function pmap_bootstrap (sys/riscv/riscv/pmap.c) Message-ID: <bug-231515-227-u6EKGKKJok@https.bugs.freebsd.org/bugzilla/> In-Reply-To: <bug-231515-227@https.bugs.freebsd.org/bugzilla/> References: <bug-231515-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=231515 Mark Johnston <markj@FreeBSD.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|New |In Progress Assignee|bugs@FreeBSD.org |markj@FreeBSD.org --- Comment #2 from Mark Johnston <markj@FreeBSD.org> --- Created attachment 199144 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=199144&action=edit proposed patch I don't understand the need for the first hunk of the patch. In the for-loop, avail_slot is only used to index phys_avail[], which has size PHYSMAP_SIZE+2. In the second hunk, we should test avail_slot < PHYS_AVAIL_SIZE - 2 before using avail_slot as an index. However, I don't quite understand the code in the second hunk. It's checking whether the loop exited because it found a physmem range containing KERNBASE - kern_delta, so why is it using avail_slot as the index? I think the test is just wrong. The attached patch changes that code according to my understand of what it's supposed to be doing. -- 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-231515-227-u6EKGKKJok>
