Page MenuHomeFreeBSD

vmm: Fully adopt the getrlimit(2) machinery for limiting the number of VMM instances
Needs ReviewPublic

Authored by bnovkov on May 18 2026, 3:33 PM.
Tags
None
Referenced Files
F171661882: D57067.id181917.diff
Sat, Sep 12, 12:36 PM
Unknown Object (File)
Fri, Sep 11, 4:25 AM
Unknown Object (File)
Fri, Sep 11, 3:42 AM
Unknown Object (File)
Thu, Sep 10, 8:42 PM
Unknown Object (File)
Thu, Sep 10, 7:40 PM
Unknown Object (File)
Wed, Sep 9, 12:09 AM
Unknown Object (File)
Mon, Sep 7, 9:21 PM
Unknown Object (File)
Mon, Sep 7, 2:26 PM

Details

Reviewers
markj
des
olce
Group Reviewers
bhyve
Summary

The vmm module currently combines parts of the kernelspace
getrlimit(2) machinery and a sysctl value to limit the number
of VMM instances per-UID. The original rationale for this
approach was to sidestep the convoluted way in which per-UID
getrlimit(2) limit values are currently propagated.

However, this approach deviates from the expected workflow when dealing
getrlimit(2) limits.

Fix this by teaching login(1) about RLIMIT_VMM and changing
vmmdev_create to use lim_cur. While we're here, document the limit
in the getrlimit(2) manpage.

Fixes: 1092ec8b3375 ("kern: Introduce RLIMIT_VMM")

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 74774
Build 71657: arc lint + arc unit

Event Timeline

This revision is now accepted and ready to land.Jul 10 2026, 4:10 PM
usr.bin/login/login.conf
47
usr.bin/login/login.conf
47

So we're changing the existing limit to unlimited, I guess because there's no way to express a constant like 4 * mp_ncpus here?

usr.bin/login/login.conf
47

It's still named vms elsewhere, I think we should standardize on vmm to reflect RLIMIT_VMM.

usr.bin/login/login.conf
47

Yes, I'm not aware of way to dynamically populate login.conf with a machine-specific value.

markj added inline comments.
sys/dev/vmm/vmm_dev.c
1021

Do you mind adding an EXTERROR() here? Could be done in a separate patch.

sys/dev/vmm/vmm_dev.c
1021

Sure, I see quite a few other places where dev/vmm doesn't use EXTERROR so I'll plug those as well

usr.bin/login/login.conf
47

Agreed, I'll update the patch to include the rename.

This revision now requires review to proceed.Jul 13 2026, 5:11 PM