From owner-freebsd-net@FreeBSD.ORG Sat Jan 10 15:51:55 2004 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4F67F16A4D1 for ; Sat, 10 Jan 2004 15:51:55 -0800 (PST) Received: from mailtoaster1.pipeline.ch (mailtoaster1.pipeline.ch [62.48.0.70]) by mx1.FreeBSD.org (Postfix) with ESMTP id C44A443D98 for ; Sat, 10 Jan 2004 15:50:46 -0800 (PST) (envelope-from andre@freebsd.org) Received: (qmail 49634 invoked from network); 10 Jan 2004 23:50:37 -0000 Received: from unknown (HELO freebsd.org) ([62.48.0.54]) (envelope-sender ) by mailtoaster1.pipeline.ch (qmail-ldap-1.03) with SMTP for ; 10 Jan 2004 23:50:37 -0000 Message-ID: <40008FCD.90525A33@freebsd.org> Date: Sun, 11 Jan 2004 00:50:37 +0100 From: Andre Oppermann X-Mailer: Mozilla 4.76 [en] (Windows NT 5.0; U) X-Accept-Language: en MIME-Version: 1.0 To: David Gilbert , freebsd-net@freebsd.org, freebsd-current@freebsd.org References: <16384.14322.83258.940369@canoe.dclg.ca> <40008783.330FAFF4@freebsd.org> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Subject: Re: off-by-one error in ip_fragment, recently. X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Jan 2004 23:51:55 -0000 Andre Oppermann wrote: > > David Gilbert wrote: > > > > I just updated a machine that uses GRE to -CURRENT. Upon rebooting, > > the debugger stopped at the following: > > > > "panic: m_copym, offset > size of mbuf chain" > > There are two possible ways this can happen: The function m_copym > was called with off == 0, or off == m->m_len. Neither is supposed > to happen (obviously) so the bug must be in ip_fragment. Lets have > a look at that next... There seems to be a bug in m_copym() anyway, but it's not the one you trip over because we are getting into the while loop again. However if off == m_len it would not break and trash *m for a panic a few lines later. -- Andre Index: uipc_mbuf.c =================================================================== RCS file: /home/ncvs/src/sys/kern/uipc_mbuf.c,v retrieving revision 1.124 diff -u -p -r1.124 uipc_mbuf.c --- uipc_mbuf.c 25 Dec 2003 01:17:27 -0000 1.124 +++ uipc_mbuf.c 10 Jan 2004 23:47:36 -0000 @@ -199,7 +199,7 @@ m_copym(struct mbuf *m, int off0, int le copyhdr = 1; while (off > 0) { KASSERT(m != NULL, ("m_copym, offset > size of mbuf chain")); - if (off < m->m_len) + if (off <= m->m_len) break; off -= m->m_len; m = m->m_next;