From owner-freebsd-net Fri May 31 13: 0:27 2002 Delivered-To: freebsd-net@freebsd.org Received: from rwcrmhc51.attbi.com (rwcrmhc51.attbi.com [204.127.198.38]) by hub.freebsd.org (Postfix) with ESMTP id 3300037B406 for ; Fri, 31 May 2002 13:00:15 -0700 (PDT) Received: from InterJet.elischer.org ([12.232.206.8]) by rwcrmhc51.attbi.com (InterMail vM.4.01.03.27 201-229-121-127-20010626) with ESMTP id <20020531200014.QZKY11426.rwcrmhc51.attbi.com@InterJet.elischer.org>; Fri, 31 May 2002 20:00:14 +0000 Received: from localhost (localhost.elischer.org [127.0.0.1]) by InterJet.elischer.org (8.9.1a/8.9.1) with ESMTP id MAA29651; Fri, 31 May 2002 12:42:25 -0700 (PDT) Date: Fri, 31 May 2002 12:42:24 -0700 (PDT) From: Julian Elischer To: Archie Cobbs Cc: freebsd-net@freebsd.org Subject: Re: m_split() considered harmful In-Reply-To: <200205311829.g4VITKM01684@arch20m.dellroad.org> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-net@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org When I added these fields in freebsd1.x (They may have gone through some metamorphesis since) it was to support some stuff we were doing at TFS. They were variants of similar fields in BSD4.3 RENO. The problem that can occur is that the code that splits the data can end up having two references to the same external object when the data split point lies within an external object. In this case (if the reference count is > 1) the M_TRAILINGSPACE and M_LEADINGSPACE(m) must take into account that they cannot return the leading and trailing space as free as they may be used by onother mbuf. M_LEADINGSPACE(m) already has: M_WRITABLE(m) ? (m)->m_data - (m)->m_ext.ext_buf : 0 but M_TRAILINGSPACE(m) does not. so we cannot use the room in front of and after the data unless the reference count == 1. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-net" in the body of the message