Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 23 Nov 2014 14:43:49 -0500
From:      Shawn Webb <lattera@gmail.com>
To:        Peter Grehan <grehan@freebsd.org>
Cc:        freebsd-virtualization@freebsd.org
Subject:   Re: bhyve cannot allocate memory
Message-ID:  <20141123144349.84f648dcfc1169bf952c7ee7@gmail.com>
In-Reply-To: <54715B13.9020303@freebsd.org>
References:  <20141122215245.d9380cc4e43cb5e60d479009@gmail.com> <20141122220202.09523b0ae828993174af05d8@gmail.com> <5471513C.6040400@freebsd.org> <CADt0fhxEavv5e6tbmORxUZgPNGQNZiu2O=PtO6aKhW%2B_fkRSZQ@mail.gmail.com> <54715438.3090905@freebsd.org> <CADt0fhxFzqKbw7kndeUVQaVeJ_jj=-yNUgvD6ntn7hM3YGqCLA@mail.gmail.com> <54715822.2010309@freebsd.org> <CADt0fhwTSci31wwq8UoN2JpUGHKgLNiDXymZQyeWYFVd4i7PJA@mail.gmail.com> <54715911.1090100@freebsd.org> <CADt0fhxCv3DneeoVewGEz7%2BQ53gqDNENJKD2-CH6Sxz=PFT3ig@mail.gmail.com> <54715B13.9020303@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, 22 Nov 2014 19:57:07 -0800
Peter Grehan <grehan@freebsd.org> wrote:

> Hi Shawn,
> 
> > Interesting. I'll have to do more digging. Because removing map_at_zero
> > support is the same as keeping it at the default of 0. It's not possible
> > that our ASLR implementation is affecting bhyve, since our ASLR
> > implementation is in sys_mmap and the elf image activator. At this
> > stage, bhyve's vmm.ko is directly accessing vm_map_*, which we haven't
> > touched.
> 
>   One thing you may be able to try is ktrace the bhyveload process and 
> see which syscall is failing.

Oliver fixed the problem. bhyve's vmm.ko uses VM_MIN_ADDRESS, which defaults to NULL in FreeBSD. We modified that to be at 64k to prevent NULL dereferences. Combine that with the removal of map_at_zero, NULL deref is not possible anymore. But since we bumped VM_MIN_ADDRESS up, bhyve's vmm.ko no longer attempts to map at NULL (which it absolutely needs to). The change Oliver made simply uses 0 instead of VM_MIN_ADDRESS. If this is a change FreeBSD wants upstream, we'd love it merged upstream.

Commit for reference: https://github.com/HardenedBSD/hardenedBSD/commit/23bd719ce1e3a8cc42fc8317b1c7c6d9e74dcba0

Thanks,

Shawn



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20141123144349.84f648dcfc1169bf952c7ee7>