Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 23 May 2023 10:07:02 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 271579] Incorrect vmemoryuse per user rctl limits for jails calculation
Message-ID:  <bug-271579-227@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D271579

            Bug ID: 271579
           Summary: Incorrect vmemoryuse per user rctl limits for jails
                    calculation
           Product: Base System
           Version: 13.2-STABLE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: kern
          Assignee: bugs@FreeBSD.org
          Reporter: KOT@MATPOCKuH.Ru

I want to limit a per user memory usage for every running jail.
I'm tried to set a limits like this:
jail:pg198:vmemoryuse:deny=3D17179869184/user
jail:pg199:vmemoryuse:deny=3D17179869184/user

I have users with same uid in there jails, resulting a memory allocation for
user in jail pg198, makes impossible to use this limit for same user in jail
pg199.

To check I used this simple code:
#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
#include <errno.h>
#include <stdio.h>
#include <string.h>

int
main(int argc, char *argv[]) {
        long size =3D atol(argv[1]);
        void *buf =3D malloc(size);

        if (buf =3D=3D NULL) {
                fprintf(stderr, "malloc(%li) failed: %s\n", size,
strerror(errno));
                return 1;
        }

        fgets(buf, size < 1024 ? size : 1024, stdin);
        return 0;
}

And when a user in one jail is running a command:
./alloc $((10*1024*1024*1024))
User in a different jail can't allocate memory:
malloc(10737418240) failed: Cannot allocate memory

A limits like jail:jailname:vmemoryuse:deny=3Dlimit/user should limit a all=
ocated
memory per user for each jail, but not for user in all jails.

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-271579-227>