fix(macos): allow reading kern.hv_vmm_present sysctl#312
Open
lucasfais wants to merge 1 commit into
Open
Conversation
Chromium-based browsers PCHECK sysctlbyname("kern.hv_vmm_present") in
base::IsVirtualMachine() during startup (base/mac/mac_util.mm). When the
seatbelt profile denies this sysctl, the browser aborts with a FATAL at
mac_util.mm before launching, which breaks allowBrowserProcess support
for any modern Chrome/Chromium.
Add kern.hv_vmm_present to the sysctl-read allowlist so browsers can
start under the sandbox. It is a read-only, single-bit value (VM/host)
and is strictly less sensitive than entries already allowed (e.g.
kern.bootargs, kern.hostname).
Add a regression test asserting the sysctl is readable under the profile.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I'm running a rails project with cabybara specs, using Selenium and chromedriver. Chrome/Chromium were not able to run without these changes. To be honest, I don't know much about the subject, but the agent help me fixed it. Let me know if that makes sense to the project.
Agent's description below.
Scenario
Running a Rails app's Capybara feature specs (Selenium + headless Chrome via chromedriver) with the bash command wrapped by the seatbelt sandbox (allowBrowserProcess: true). Chrome launched but every test died at visit with session not created: Chrome instance exited / tab crashed.
Root cause
Modern Chromium-based browsers PCHECK sysctlbyname("kern.hv_vmm_present") inside base::IsVirtualMachine() during startup (base/mac/mac_util.mm). The seatbelt profile didn't allow that sysctl, so the check failed and Chrome aborted with a FATAL before the renderer ever came up:
This effectively breaks allowBrowserProcess for any current Chrome/Chromium on macOS.
Fix
Add kern.hv_vmm_present to the sysctl-read allowlist. It's a read-only, single-bit value (running under a VM or not) and is strictly less sensitive than entries already permitted (kern.bootargs, kern.hostname, etc.), so there's no meaningful security trade-off.
Testing