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
F165436306: D57067.id178018.diff
Sat, Aug 8, 5:04 AM
F165433314: D57067.diff
Sat, Aug 8, 4:39 AM
F165432009: D57067.id.diff
Sat, Aug 8, 4:28 AM
Unknown Object (File)
Fri, Aug 7, 10:53 AM
Unknown Object (File)
Sun, Aug 2, 1:04 AM
Unknown Object (File)
Sat, Aug 1, 10:31 AM
Unknown Object (File)
Sat, Aug 1, 6:08 AM
Unknown Object (File)
Wed, Jul 29, 12:42 AM

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.Fri, Jul 10, 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.Mon, Jul 13, 5:11 PM