Date: Tue, 26 Dec 2017 14:33:04 +0300 From: "Andrey V. Elsukov" <bu7cher@yandex.ru> To: Harsh Jain <harsh@chelsio.com>, freebsd-net@freebsd.org Subject: Re: [freebsd-current]Who should reset M_PKTHDR flag in m_buf when IP packets are fragmented. m_unshare panic throw when IPSec is enabled Message-ID: <c7513431-202e-55e4-e8be-2e3dffb897e9@yandex.ru> In-Reply-To: <fdb72f54-efdd-c54b-c8f7-c53057d24adf@chelsio.com> References: <73302ead-b2e9-c25b-4d11-475f38dec1a1@chelsio.com> <993c58bb-3bf2-d6a3-9a05-13e1631aec87@yandex.ru> <fdb72f54-efdd-c54b-c8f7-c53057d24adf@chelsio.com>
next in thread | previous in thread | raw e-mail | index | archive | help
This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --WUp1Gkiol6r8GwihO60R2BQFxQ43xhLLL Content-Type: multipart/mixed; boundary="LXau3uXE3xeG2wKXx8OV7wRRdsfm6Kn9U"; protected-headers="v1" From: "Andrey V. Elsukov" <bu7cher@yandex.ru> To: Harsh Jain <harsh@chelsio.com>, freebsd-net@freebsd.org Message-ID: <c7513431-202e-55e4-e8be-2e3dffb897e9@yandex.ru> Subject: Re: [freebsd-current]Who should reset M_PKTHDR flag in m_buf when IP packets are fragmented. m_unshare panic throw when IPSec is enabled References: <73302ead-b2e9-c25b-4d11-475f38dec1a1@chelsio.com> <993c58bb-3bf2-d6a3-9a05-13e1631aec87@yandex.ru> <fdb72f54-efdd-c54b-c8f7-c53057d24adf@chelsio.com> In-Reply-To: <fdb72f54-efdd-c54b-c8f7-c53057d24adf@chelsio.com> --LXau3uXE3xeG2wKXx8OV7wRRdsfm6Kn9U Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable On 26.12.2017 13:22, Harsh Jain wrote: >>> panic: m_unshare: m0 0xfffff80020f82600, m 0xfffff8005d054100 has M_P= KTHDR >>> cpuid =3D 15 >>> time =3D 1495578455 >>> KDB: stack backtrace: >>> db_trace_self_wrapper() at db_trace_self_wrapper+0x2c/frame 0xfffffe0= 44e9bb890 >>> kdb_backtrace() at kdb_backtrace+0x53/frame 0xfffffe044e9bb960 >>> vpanic() at vpanic+0x269/frame 0xfffffe044e9bba30 >>> kassert_panic() at kassert_panic+0xc7/frame 0xfffffe044e9bbac0 >>> m_unshare() at m_unshare+0x578/frame 0xfffffe044e9bbbc0 >>> esp_output() at esp_output+0x44c/frame 0xfffffe044e9bbe40 >>> ipsec4_perform_request() at ipsec4_perform_request+0x5df/frame 0xffff= fe044e9bbff0 >> Hi, >> >> it seems unusual that IP reassembly happens on outbound path. > It can be re-produced with single Ping packet on chelsio(cxgbe) NIC. I = tried with Intel NIC. It seems they re-produce M_WRITEABLE() buffer(follo= ws different path in m_unshare) which is not true for cxgbe. In my view, IP fragmentation should occur in ip_output after IPsec encryption. Something like: 1. rip_output() has mbuf chain where only first mbuf has M_PKTHDR flag 2. ip_output() -> IPSEC_OUTPUT() -> esp_output() -> m_unshare(). We should still have only one mbuf with M_PKTHDR flag here. 3. esp_output_cb() -> ipsec_process_done() -> ip_output() 4. Now IP fragmentation should occur: ip_fragment() creates chain of mbufs to send, where M_PKTHDR flag will be set for each fragment. >> Do you have some packet normalization using firewall? > Default FREEBSD current installation. No explicit firewall. > What you think above patch makes sense. It is not clear to me why it helps. The panic happens on outbound path, where mbuf should be allocated by network stack and should be writeable. ip_reass() usually used on inbound path. I think the patch just hides the problem in another place. Do you mean that cxgbe can produce !WRITEABLE mbuf for received packet and then pass it to the network stack? --=20 WBR, Andrey V. Elsukov --LXau3uXE3xeG2wKXx8OV7wRRdsfm6Kn9U-- --WUp1Gkiol6r8GwihO60R2BQFxQ43xhLLL Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEzBAEBCAAdFiEE5lkeG0HaFRbwybwAAcXqBBDIoXoFAlpCM3EACgkQAcXqBBDI oXoKSQf+LOnwK7M78ZKfmidNEe+2Fzk4fW6KmlNRWNq2nc9n9qGz0wY3sPTx40u/ nj/oOfstoIPjJdQ31iFSLwLFW18beb85ysd9UJlDORlfVNS+DZHV5wCFOmG5u9jj SHEGF5OY2TrA8ek3XaBwRs6pl+eG7h1poupdSgR8FNO1567onqeKXegydstIsNwT n2Q/LpJ2vd49eHigHB+C2qzt+GQGbBNiY8Iw+hdpQsSDR86HthJTlkPY06UPNHyu PrPRa838TI+BSpw1oe76SQ6mhFLPjz0zN9uRSahYtSoUhHnGrSpbKG332CwOHrsX btptPf1wiidsLBpZeXjqEsELw91QaQ== =Inge -----END PGP SIGNATURE----- --WUp1Gkiol6r8GwihO60R2BQFxQ43xhLLL--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?c7513431-202e-55e4-e8be-2e3dffb897e9>