From owner-freebsd-bugs Mon Jun 29 17:42:13 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id RAA15083 for freebsd-bugs-outgoing; Mon, 29 Jun 1998 17:42:13 -0700 (PDT) (envelope-from owner-freebsd-bugs@FreeBSD.ORG) Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id RAA14948 for ; Mon, 29 Jun 1998 17:41:09 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.8.8/8.8.5) id RAA29253; Mon, 29 Jun 1998 17:40:02 -0700 (PDT) Received: (from nobody@localhost) by hub.freebsd.org (8.8.8/8.8.8) id RAA14233; Mon, 29 Jun 1998 17:37:56 -0700 (PDT) (envelope-from nobody) Message-Id: <199806300037.RAA14233@hub.freebsd.org> Date: Mon, 29 Jun 1998 17:37:56 -0700 (PDT) From: castor@geocast.com To: freebsd-gnats-submit@FreeBSD.ORG X-Send-Pr-Version: www-1.0 Subject: kern/7122: m_copypacket will fail with external mbuf clusters Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >Number: 7122 >Category: kern >Synopsis: m_copypacket will fail with external mbuf clusters >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Mon Jun 29 17:40:02 PDT 1998 >Last-Modified: >Originator: Castor Fu >Organization: Geocast Network Systems >Release: 2.2.6-STABLE >Environment: FreeBSD host1.geocast.net 2.2.6-STABLE FreeBSD 2.2.6-S i386 i386 >Description: sys/mbuf.h provides a mechanism which is seldom (if ever) used for freeing externally managed mbuf clusters. The 4.4 BSD book mentions that there were problems with the original implementation because there was no mechanism for keeping track of external references generated for the mbuf cluster. FreeBSD attempts to fix this by providing an ext_ref() mechanism, and the code in m_copym() looks reasonable, though there are no routines in the FreeBSD source tree which use this facility. However, these changes where not propagated through to m_copypacket(). m_copypacket() also appears to be unused. >How-To-Repeat: Write something which uses an externally managed memory pool. Wriet something which uses m_copypacket(). Spend time looking for memory leaks. >Fix: (clf1025) diff /usr/src/sys/kern/uipc_mbuf.c /tmp/uipc_mbuf.c 426,430c426 < if(!m->m_ext.ext_ref) < mclrefcnt[mtocl(m->m_ext.ext_buf)]++; < else < (*(m->m_ext.ext_ref))(m->m_ext.ext_buf, < m->m_ext.ext_size); --- > mclrefcnt[mtocl(m->m_ext.ext_buf)]++; 449,453c445 < if(!m->m_ext.ext_ref) < mclrefcnt[mtocl(m->m_ext.ext_buf)]++; < else < (*(m->m_ext.ext_ref))(m->m_ext.ext_buf, < m->m_ext.ext_size); --- > mclrefcnt[mtocl(m->m_ext.ext_buf)]++; >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message