Page MenuHomeFreeBSD

D57067.id181917.diff
No OneTemporary

D57067.id181917.diff

diff --git a/lib/libsys/getrlimit.2 b/lib/libsys/getrlimit.2
--- a/lib/libsys/getrlimit.2
+++ b/lib/libsys/getrlimit.2
@@ -25,7 +25,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd July 25, 2024
+.Dd July 10, 2026
.Dt GETRLIMIT 2
.Os
.Sh NAME
@@ -128,6 +128,8 @@
.It Dv RLIMIT_VMEM
An alias for
.Dv RLIMIT_AS .
+.It Dv RLIMIT_VMM
+The limit of the number of VMM instances per user id.
.El
.Pp
A resource limit is specified as a soft limit and a hard limit.
diff --git a/lib/libutil/login_class.c b/lib/libutil/login_class.c
--- a/lib/libutil/login_class.c
+++ b/lib/libutil/login_class.c
@@ -66,7 +66,7 @@
{ "kqueues", login_getcapnum, RLIMIT_KQUEUES },
{ "umtxp", login_getcapnum, RLIMIT_UMTXP },
{ "pipebuf", login_getcapsize, RLIMIT_PIPEBUF },
- { "vms", login_getcapnum, RLIMIT_VMM },
+ { "vmm", login_getcapnum, RLIMIT_VMM },
{ NULL, 0, 0 }
};
diff --git a/sys/dev/vmm/vmm_dev.c b/sys/dev/vmm/vmm_dev.c
--- a/sys/dev/vmm/vmm_dev.c
+++ b/sys/dev/vmm/vmm_dev.c
@@ -105,10 +105,6 @@
SYSCTL_UINT(_hw_vmm, OID_AUTO, maxcpu, CTLFLAG_RDTUN | CTLFLAG_NOFETCH,
&vm_maxcpu, 0, "Maximum number of vCPUs");
-u_int vm_maxvmms;
-SYSCTL_UINT(_hw_vmm, OID_AUTO, maxvmms, CTLFLAG_RWTUN,
- &vm_maxvmms, 0, "Maximum number of VMM instances per user");
-
static void devmem_destroy(void *arg);
static int devmem_create_cdev(struct vmmdev_softc *sc, int id, char *devmem);
static void vmmdev_destroy(struct vmmdev_softc *sc);
@@ -1022,9 +1018,9 @@
"VMs cannot be created in the current jail"));
}
- if (!chgvmmcnt(cred->cr_ruidinfo, 1, vm_maxvmms)) {
+ if (!chgvmmcnt(cred->cr_ruidinfo, 1, lim_cur(curthread, RLIMIT_VMM))) {
sx_xunlock(&vmmdev_mtx);
- return (ENOMEM);
+ return (EXTERROR(ENOMEM, "RLIMIT_VMM limit exceeded"));
}
error = vm_create(name, &vm);
@@ -1258,7 +1254,6 @@
}
if (vm_maxcpu == 0)
vm_maxcpu = 1;
- vm_maxvmms = 4 * mp_ncpus;
error = vmm_modinit();
if (error == 0)
vmm_initialized = true;
diff --git a/sys/sys/resource.h b/sys/sys/resource.h
--- a/sys/sys/resource.h
+++ b/sys/sys/resource.h
@@ -145,7 +145,7 @@
"kqueues",
"umtx",
"pipebuf",
- "vms",
+ "vmm",
};
#endif
diff --git a/usr.bin/limits/limits.c b/usr.bin/limits/limits.c
--- a/usr.bin/limits/limits.c
+++ b/usr.bin/limits/limits.c
@@ -92,7 +92,7 @@
{ " kqueues%-4s %8s", "\n", 1 },
{ " umtxp%-4s %8s", "\n", 1 },
{ " pipebuf%-4s %8s", " kB\n", 1024 },
- { " vms%-4s %8s", "\n", 1 },
+ { " vmm%-4s %8s", "\n", 1 },
}
},
{ "sh", "unlimited", "", " -H", " -S", "",
@@ -247,7 +247,7 @@
{ "kqueues", login_getcapnum },
{ "umtxp", login_getcapnum },
{ "pipebuf", login_getcapsize },
- { "vms", login_getcapnum },
+ { "vmm", login_getcapnum },
};
_Static_assert(nitems(resources) == RLIM_NLIMITS,
diff --git a/usr.bin/login/login.conf b/usr.bin/login/login.conf
--- a/usr.bin/login/login.conf
+++ b/usr.bin/login/login.conf
@@ -44,6 +44,7 @@
:kqueues=unlimited:\
:umtxp=unlimited:\
:pipebuf=unlimited:\
+ :vmm=unlimited:\
:priority=0:\
:umask=022:\
:charset=UTF-8:\

File Metadata

Mime Type
text/plain
Expires
Sun, Sep 13, 12:36 PM (8 h, 43 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
38855814
Default Alt Text
D57067.id181917.diff (3 KB)

Event Timeline