From nobody Fri Aug 06 15:53:34 2021 X-Original-To: jail@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 734791347A0C for ; Fri, 6 Aug 2021 15:53:58 +0000 (UTC) (envelope-from freebsd@grem.de) Received: from mail.evolve.de (mail.evolve.de [213.239.217.29]) (using TLSv1.3 with cipher TLS_CHACHA20_POLY1305_SHA256 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA512 client-signature ECDSA (P-384) client-digest SHA384) (Client CN "mail.evolve.de", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gh9510jxgz4nMf; Fri, 6 Aug 2021 15:53:56 +0000 (UTC) (envelope-from freebsd@grem.de) Received: by mail.evolve.de (OpenSMTPD) with ESMTP id 7825ba30; Fri, 6 Aug 2021 15:53:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=grem.de; h=date:from:to:cc :subject:message-id:in-reply-to:references:mime-version :content-type:content-transfer-encoding; s=20180501; bh=lFRwa7d7 cCbioBUQo/c2wQ+Kpcg=; b=isnMXD07fUJsFUxOJiBtE3l4YxzjdVUZWq5o2iVM rJ2UYM6GQX2lNfF8w3Mp7fcQTnxJn343M1nKw5zJAuGxKuic1glYqL7ngtlMnYE6 ruQ4mDIxQJDF5h5Zwu/k/X0lVOYd6FUfcPVSmvK3FrytAZ14O6fSRZKH9jwJa1XI MS7ECbxSyP1GMJUn0FN6/wJ9Ff52N3XBK7TiENEXOjnN5+Jksl4mf73n6AW9e52p W/3c6Cl4Zfc5bDFzNJTOXJKtrZ5Q53ZqCS/YHAoVct65HDeBmtJU0j1XN1mgGDga 2dgEylS1eGQdLPNIk1+Cw5rkoosGMZddH2ktrw6mLhmcoA== DomainKey-Signature: a=rsa-sha1; c=nofws; d=grem.de; h=date:from:to:cc :subject:message-id:in-reply-to:references:mime-version :content-type:content-transfer-encoding; q=dns; s=20180501; b=nS 7OcPGnHHYjxy/zkGh6Ar8ZoiMwwj+eg9H5w8qAsd0dE8i9n6vA1SYV9YEEhJQ7An umv+eiNbWGD6rY2zfGKDPiTY6Jddfgd7P+ZZiLK8pr6rvdK84YoLn2ibq1Kdw4ol GOYysGhXxthC6+ExcZsS8MdGjAwMvyGJiECFHNUwGFRIpWuXyp4vkTVTvI4TDBGP uoGnb1wZqWCBiykHKU3veKTHlmx6oOeGDAfIjizB/3prMk0QXgW+782glVpZB+4Y rnYUbAepzUBtcERILlmX0LD83a+87pFVQnyVeXXr6KqUhs4BuURNhosHlbFpB3hR lB9Phmug0ZMNbAN5amJw== Received: by mail.evolve.de (OpenSMTPD) with ESMTPSA id b9997e4b (TLSv1.3:AEAD-CHACHA20-POLY1305-SHA256:256:NO); Fri, 6 Aug 2021 15:53:46 +0000 (UTC) Date: Fri, 6 Aug 2021 17:53:34 +0200 From: Michael Gmelin To: Mark Johnston Cc: Konstantin Belousov , jail@freebsd.org Subject: Re: POSIX shared memory, jails, and (lack of) limits Message-ID: <20210806175334.12d5d943@bsd64.grem.de> In-Reply-To: <26D98CA9-B4ED-4BCB-935D-1EB8EBDA8F5D@grem.de> References: <26D98CA9-B4ED-4BCB-935D-1EB8EBDA8F5D@grem.de> X-Face: $wrgCtfdVw_H9WAY?S&9+/F"!41z'L$uo*WzT8miX?kZ~W~Lr5W7v?j0Sde\mwB&/ypo^}> +a'4xMc^^KroE~+v^&^#[B">soBo1y6(TW6#UZiC]o>C6`ej+i Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAJFBMVEWJBwe5BQDl LASZU0/LTEWEfHbyj0Txi32+sKrp1Mv944X8/fm1rS+cAAAACXBIWXMAAAsTAAAL EwEAmpwYAAAAB3RJTUUH3wESCxwC7OBhbgAAACFpVFh0Q29tbWVudAAAAAAAQ3Jl YXRlZCB3aXRoIFRoZSBHSU1QbbCXAAAAAghJREFUOMu11DFvEzEUAGCfEhBVFzuq AKkLd0O6VrIQsLXVSZXoWE5N1K3DobBBA9fQpRWc8OkWouaIjedWKiyREOKs+3PY fvalCNjgLVHeF7/3bMtBzV8C/VsQ8tecEgCcDgrzjekwKZ7TwsJZd/ywEKwwP+ZM 8P3drTsAwWn2mpWuDDuYiK1bFs6De0KUUFw0tWxm+D4AIhuuvZqtyWYeO7jQ4Aea 7jUqI+ixhQoHex4WshEvSXdood7stlv4oSuFOC4tqGcr0NjEqXgV4mMJO38nld4+ xKNxRDon7khyKVqY7YR4d+Cg0OMrkWXZOM7YDkEfKiilCn1qYv4mighZiynuHHOA Wq9QJq+BIES7lMFUtcikMnkDGHUoncA+uHgrP0ctIEqfwLHzeSo+eUA66AqzwN6n 2ZHJhw6Qh/PoyC/QENyEyC/AyNjq74Bs+3UH0xYwzDUC4B97HgLocg1QLYgDDO1v f3UX9Y307Ew4AHh67YAFFsxEpkXwpXY3eIgMhAAE3R19L919nNnuD2wlPcDE3UeT L2ytEICQib9BXgS2fU8PrD82ToYO1OEmMSnYTjSqSv9wdC0tPYC+rQRQD9ESnldF CyqfmiYW+tlALt8gH2xrMdC/youbjzPXEun+/ReXsMCDyve3dZc09fn2Oas8oXGc Jj6/fOeK5UmSMPmf/jL+GD8BEj0k/Fn6IO4AAAAASUVORK5CYII= List-Id: Discussion about FreeBSD jail(8) List-Archive: https://lists.freebsd.org/archives/freebsd-jail List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-jail@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: 4Gh9510jxgz4nMf X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=grem.de header.s=20180501 header.b=isnMXD07; dmarc=none; spf=pass (mx1.freebsd.org: domain of freebsd@grem.de designates 213.239.217.29 as permitted sender) smtp.mailfrom=freebsd@grem.de X-Spamd-Result: default: False [-3.31 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[grem.de:s=20180501]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:213.239.217.29/32]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[grem.de]; NEURAL_HAM_LONG(-1.00)[-1.000]; RCVD_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; MID_RHS_MATCH_FROMTLD(0.00)[]; DKIM_TRACE(0.00)[grem.de:+]; NEURAL_HAM_SHORT(-0.81)[-0.811]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:24940, ipnet:213.239.192.0/18, country:DE]; RCVD_TLS_ALL(0.00)[]; FREEMAIL_CC(0.00)[gmail.com,freebsd.org] X-ThisMailContainsUnwantedMimeParts: N On Mon, 2 Aug 2021 22:38:54 +0200 Michael Gmelin wrote: > > On 2. Aug 2021, at 21:40, Mark Johnston wrote: > > ... > > racct/rctl provides the "swapuse" resource which should account for > > this. It does not apply to largepage objects, though. =20 >=20 > I tried to limit swapuse for a jail and it doesn=E2=80=99t limit posix sh= ared > memory created within the jail (I can still create shared memory > segments within the jail until the machine runs out of virtual > memory). >=20 > Should I share the test case to make sure I didn=E2=80=99t mess up? See a stripped down example below (originally I did this in a proper jail). Cheers Michael (resent, originally off-list) cat >/tmp/shmtest.c< #include #include #include #include #include #include #define SEG_LEN 1024*1024*10 int main(int argc, char** argv) { int fd =3D shm_open(argv[1], O_CREAT | O_RDWR, S_IRUSR | S_IWUSR); ftruncate(fd, SEG_LEN); char* ptr =3D mmap(NULL, SEG_LEN,=20 PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); memset(ptr, 0xff, SEG_LEN); } EOF cc -o /tmp/shmtest /tmp/shmtest.c rctl -a jail:test:vmemoryuse:deny=3D500M rctl -a jail:test:memoryuse:deny=3D400M rctl -a jail:test:swapuse:deny=3D200M jail -c path=3D/ name=3Dtest \ command=3Dsh -c 'for name in $(jot 1000); do /tmp/shmtest /$name; done' --=20 Michael Gmelin