Date: Thu, 12 Sep 2024 13:41:09 +0200 From: Kristof Provost <kp@FreeBSD.org> To: John Baldwin <jhb@FreeBSD.org> Cc: Drew Gallatin <gallatin@fastmail.com>, Mark Johnston <markj@freebsd.org>, src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: f08247fd888e - main - Assert that mbufs are writable if we write to them Message-ID: <61045FAC-D1C5-42AE-BE1B-757AC2222554@FreeBSD.org> In-Reply-To: <1f61b6de-0fe2-4343-b4ad-f0866785a4bc@FreeBSD.org> References: <202409111118.48BBIQ2h065089@gitrepo.freebsd.org> <ZuGtGHm-u4QiJGUz@nuc> <ED0A74EE-FB1B-44E6-8DEE-E34D22953825@FreeBSD.org> <a0eeed9d-d2ff-49c2-af3f-328e0c0c28b1@app.fastmail.com> <2b1955e2-fbf1-41cb-b256-a9a257b16a83@FreeBSD.org> <1f61b6de-0fe2-4343-b4ad-f0866785a4bc@FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On 12 Sep 2024, at 11:40, John Baldwin wrote: > On 9/12/24 05:03, John Baldwin wrote: >> I think part of the motivation for marking M_EXTPG as read-only is tha= t you can't "write" >> to m_data via mtod() or the like. That said, M_EXTPG aren't really re= ad-only. It >> depends on the backing store. M_EXTPG were first merged into FreeBSD = prior to KTLS to >> support sendfile, and in that case, they should be M_RDONLY because th= ey alias pages >> from the file's VM object. However, M_EXTPG mbufs allocated via funct= ions like >> m_uiotombuf_nomap should not be M_RDONLY. I think this originated in = the original >> import of KTLS which doesn't push setting M_RDONLY out to the callers = of mb_alloc_extpgs, >> and a few other places that hardcode M_RDONLY with M_EXTPG (_mb_unmapp= ed_to_ext should >> preserve M_RDONLY from the original mbuf instead of forcing M_RDONLY).= >> >> I can take a stab at a patch but won't have time to really test it unt= il after Euro. > > Patch available below. Compile tested but not run-tested: > > https://github.com/freebsd/freebsd-src/compare/main...bsdjhb:freebsd:m_= extpg_rdonly > I=E2=80=99m still seeing a panic (with the extra assertions from https://= reviews.freebsd.org/D46572 in opencrypto) in ktls_test:ktls_receive_aes12= 8_cbc_1_1_sha1_long. It=E2=80=99s unhappy because there=E2=80=99s an mbuf with m_flags =3D 0x2= 001 (so M_EXT | M_PROTO1) that has an ext_cnt of 2. It=E2=80=99s not urgent, I=E2=80=99m mostly interested in these assertion= s to catch bugs like 280036 sooner. I=E2=80=99ll also be at euro, I can g= ive you access to a box that trivially produces this panic then. Best regards, Kristof
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?61045FAC-D1C5-42AE-BE1B-757AC2222554>