Date: Sat, 16 Jan 2021 19:09:41 -0500 From: Shawn Webb <shawn.webb@hardenedbsd.org> To: Mariusz Zaborski <oshogbo@freebsd.org> Cc: Cy Schubert <Cy.Schubert@cschubert.com>, mike@karels.net, Mateusz Guzik <mjguzik@gmail.com>, src-committers <src-committers@freebsd.org>, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org, Mark Johnston <markj@freebsd.org>, Alex Richardson <arichardson@freebsd.org> Subject: Re: git: aefe30c54371 - main - cat: capsicumize it Message-ID: <20210117000941.4nxmpmamdd3out7i@mutt-hbsd> In-Reply-To: <CAGOYWV9XGdb6Ey=GXWYnxXQnizKds0mMPKKMMhZnxhhCPzAhbQ@mail.gmail.com> References: <202101161448.10GEmuI4095908@mail.karels.net> <202101161510.10GF9xON022324@slippy.cwsent.com> <CAGOYWV9XGdb6Ey=GXWYnxXQnizKds0mMPKKMMhZnxhhCPzAhbQ@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
--aopefwxa3yjam5zg Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Also to note: Something about this change causes a kernel panic under heavy load (poudriere running 20 jobs with poudriere configured to use tmpfs for the entire job). Screenshot of kernel panic: https://photos.app.goo.gl/dXBpW7sbn1iWQaJj9 On Sun, Jan 17, 2021 at 01:03:25AM +0100, Mariusz Zaborski wrote: > Thank you for raising your concerns. We discussed that, and for now, > we will disable sandboxing in the cat. We will try to measure where > the bottlenecks are and try to address them. >=20 > We should try to sandbox even as simple tools like cat or tail, but not f= or any > cost. If we have a high cost, we may explore other ways of doing it. >=20 > On Sat, 16 Jan 2021 at 16:10, Cy Schubert <Cy.Schubert@cschubert.com> wro= te: > > > > In message <202101161448.10GEmuI4095908@mail.karels.net>, Mike Karels > > writes: > > > Mateusz wrote: > > > > I have to strongly disagree with this change. > > > > > > > truss -f cat /etc/motd immediately reveals most peculiar overhead > > > > which comes with it. > > > > > > > Some examples: > > > > - pdfork is called 3 times and fork 1 time, spawning 4 processes in= total > > > > - the file is opened twice: > > > > 5548: openat(AT_FDCWD,"/etc/motd",O_RDONLY,00) =3D 5 (0x5) > > > > 5548: cap_rights_limit(5,{ CAP_READ,CAP_FCNTL,CAP_FSTAT }) =3D 0 (= 0x0) > > > > 5548: openat(AT_FDCWD,"/etc/motd",O_RDONLY,00) =3D 7 (0x7) > > > > 5548: cap_rights_limit(7,{ CAP_READ,CAP_FCNTL,CAP_FSTAT }) =3D 0 (= 0x0) > > > > - there is an enormous number of sendto/recvfrom instead of everyth= ing > > > > happening in just one go > > > > > > > Key points: > > > > - the functionality provided by casper definitely induces way more > > > > overhead than it should. > > > > - regardless of the above, I find patching tools like tail and cat = in > > > > this manner to be highly questionable. Ultimately whatever security > > > > may or may not have been gained it always have to be gauged against > > > > actual impact and it does not look it is worth it in this case. > > > > > > > Even if someone was to put cat in capability mode, for something as > > > > trivial a opening one file, cat could just do it without all the ot= her > > > > overhead and then enter the sandbox. > > > > > > > That said, I think this change (and possibly similar changes to oth= er > > > > tooling) should be reverted. Regardless of what happens here, casper > > > > needs a lot of work before it is deemed usable. > > > > > > > My $0,03. > > > > > > I also question this change. Using capsicum makes sense for something > > > like tcpdump, which usually runs as root, uses privileged facilities, > > > > tcpdump can drop its privileges. Various Linux distros and vendors do t= his. > > I have a patch in my tree that will do this. > > > > > and interprets external data that could potentially subvert it in the > > > worst case. It also has a fairly high startup cost that can be amort= ized > > > over its runtime. Cat is nothing like this, so I wonder what the mot= ivation > > > was for the change. It's not obvious to me that there is any signifi= cant > > > value in capsicumizing, and there are obviously significant costs. > > > > Agreed. > > > > > > > > Mike > > > > > > -- > > Cheers, > > Cy Schubert <Cy.Schubert@cschubert.com> > > FreeBSD UNIX: <cy@FreeBSD.org> Web: https://FreeBSD.org > > NTP: <cy@nwtime.org> Web: https://nwtime.org > > > > The need of the many outweighs the greed of the few. > > > > > > > > > > > On 1/15/21, Mariusz Zaborski <oshogbo@freebsd.org> wrote: > > > > > The branch main has been updated by oshogbo: > > > > > > > > > > URL: > > > > > https://cgit.FreeBSD.org/src/commit/?id=3Daefe30c5437159a5399bdbc= 1974d6fbf4 > > > 0f2ba0f > > > > > > > > > > commit aefe30c5437159a5399bdbc1974d6fbf40f2ba0f > > > > > Author: Mariusz Zaborski <oshogbo@FreeBSD.org> > > > > > AuthorDate: 2021-01-15 20:22:29 +0000 > > > > > Commit: Mariusz Zaborski <oshogbo@FreeBSD.org> > > > > > CommitDate: 2021-01-15 20:23:42 +0000 > > > > > > > > > > cat: capsicumize it > > > > > > > > > > Reviewed by: markj, arichardson > > > > > Differential Revision: https://reviews.freebsd.org/D28083 > > > <snip> > > > > > > > > > > > _______________________________________________ > dev-commits-src-all@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all > To unsubscribe, send any mail to "dev-commits-src-all-unsubscribe@freebsd= =2Eorg" --=20 Shawn Webb Cofounder / Security Engineer HardenedBSD GPG Key ID: 0xFF2E67A277F8E1FA GPG Key Fingerprint: D206 BB45 15E0 9C49 0CF9 3633 C85B 0AF8 AB23 0FB2 https://git-01.md.hardenedbsd.org/HardenedBSD/pubkeys/src/branch/master/Sha= wn_Webb/03A4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc --aopefwxa3yjam5zg Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEA6TL67gupaZ9nzhT/y5nonf44foFAmADgEIACgkQ/y5nonf4 4forAg//bIpolvsqbbVoQCUbyqvXTh/bGScbu6K3fcDOWNoGjwefBvZmBFYpSjiX 98LWV+zjSv+fnKVN7qvxYiYBmTO4XwJssCBQqu7TB4bKdsXSYyqhR3pEViK40sLF IYXWfmHZ8ZbBctW87r+gOWDIrI8b5ZfBYWbFh7b0MVOQhiTsZePbdr7rgAjSaOgv 4tPhKtsf3yXVNuvRaaBYOoWxooOahGQSXM+9M3ibFDq/Yhe62rVTAINgS6QrByKu EYflHXpZEV4W41KhOXI8S8to2brD31Cp80MxhInft54Otv2aEh82nLnhaG1gF8l/ CKgMBl7lUAxLWknW7of82AUAI+4NxzAWyk0QHGDejd8BhLxnPwFeaTU2xrRrQsLT 19+IyjP/A84WiDj29oDfxw0Q5VO4HYzHCbvJl1gIiWeTbosdfWDdbRwWLQSH/2uu svZW9vXeHZwvuK/amCPEGh/gsgjK8vF0PcHguRFQPItjRj82Pp4TmDAterP2UDZM dmwsqcI0pGetryeUgMpHXv8xSgPFRnFy/WkxNEmIPGuH42VIbrcOv3FMJRNCPPYB OwN8JAMDXU3RCNVgGZrllKd8hwB+0/4MLjaQX3BoSaowEZPa61HdnWv2cSMc3BXp hB7npq+vj6rchszAiYVq7apbtusj09tRx6G9pF1Rw5hzCQxLWYs= =0roA -----END PGP SIGNATURE----- --aopefwxa3yjam5zg--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20210117000941.4nxmpmamdd3out7i>