Don’t ComputeRandomAllocationAddress on OpenBSD
Categories
(Core :: JavaScript Engine: JIT, defect, P2)
Tracking
()
Tracking | Status | |
---|---|---|
firefox72 | --- | fixed |
People
(Reporter: kurt, Assigned: kurt, NeedInfo)
Details
Attachments
(2 files)
User Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/76.0.3809.100 Chrome/76.0.3809.100 Safari/537.36
Steps to reproduce:
Build and use mozilla projects on OpenBSD/arm64.
Actual results:
Building x11/gnome/gjs failed in configure check of seamonkey.
Expected results:
ComputeRandomAllocationAddress() in js/src/jit/ProcessExecutableMemory.cpp makes broad assumptions about addressable memory. For 64 bit builds it assumes all cpus have 48-bit address space and uses 46-bits for its random calculation. For 32 bit builds it assumes [512MiB, 1.5GiB) is ideal.
On OpenBSD/arm64 the current addressable range is 38 bits. When mmap is provided an address hint greater than the addressable range it fails. Since OpenBSD already has random mmap when NULL is provided as the address hint, it makes sense to allow the kernel to select the random address. It removes incorrect assumptions about the addressable memory range and it allows the kernel to select a random address while attempting to reduce memory fragmentation.
Attached is a patch that makes ComputeRandomAllocationAddress() return nullptr on OpenBSD so that mmap gets NULL as hint address, enabling the kernel to select a random address.
Updated•5 years ago
|
Assignee | ||
Comment 1•5 years ago
|
||
Since submitting this bug report we have been able to release Firefox on OpenBSD/arm64 for our upcoming 6.6. release. This issue was the primary blocker for having firefox work on this architecture.
Comment 2•5 years ago
|
||
OpenBSD already has a random mmap()
Updated•5 years ago
|
Comment 3•5 years ago
|
||
I tried conserving patch ownership with hg commit --author but it seems phabricator hides this information. bah.
Comment 5•5 years ago
|
||
bugherder |
Description
•