From owner-freebsd-net@FreeBSD.ORG Tue Aug 28 18:24:26 2007 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A520816A41B for ; Tue, 28 Aug 2007 18:24:26 +0000 (UTC) (envelope-from csjp@sub.vaned.net) Received: from sub.vaned.net (sub.vaned.net [205.200.235.40]) by mx1.freebsd.org (Postfix) with ESMTP id 1388613C491 for ; Tue, 28 Aug 2007 18:24:22 +0000 (UTC) (envelope-from csjp@sub.vaned.net) Received: by sub.vaned.net (Postfix, from userid 1001) id 7D3A717390; Tue, 28 Aug 2007 11:53:33 -0500 (CDT) Date: Tue, 28 Aug 2007 11:53:33 -0500 From: "Christian S.J. Peron" To: freebsd-net@freebsd.org Message-ID: <20070828165333.GA14159@sub.vaned.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.16 (2007-06-09) Subject: [csjp@FreeBSD.org: Re: rtfree: 0xffffff00036fb1e0 has 1 refs] X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Aug 2007 18:24:26 -0000 I am not sure who has their hands in the routing code these days so I figured I would just forward this message off here. Does the following look reasonable? ----- Forwarded message from "Christian S.J. Peron" ----- From: "Christian S.J. Peron" To: Yuri Pankov Cc: freebsd-current@freebsd.org Date: Mon, 27 Aug 2007 18:59:03 -0500 Subject: Re: rtfree: 0xffffff00036fb1e0 has 1 refs Based on some comments in rtfree, we should only be calling rtfree if we are sure we own the last reference to the route. I am not sure this is the case in the stf/gif cases... Please try the attached patch and let me know if there are any ill effects. On Fri, Aug 24, 2007 at 12:17:26PM +0400, Yuri Pankov wrote: > Hi, > > I've recently started using he.net's ipv6 tunnel and getting this message: > rtfree: 0xffffff00036fb1e0 has 1 refs > > I've added kdb_backtrace() in route.c as Gleb Smirnoff suggested before. Here's > backtrace: > rtfree: 0xffffff00036fb1e0 has 1 refs > KDB: stack backtrace: > db_trace_self_wrapper() at db_trace_self_wrapper+0x2a > rtfree() at rtfree+0xba > gif_encapcheck4() at gif_encapcheck4+0x118 > gif_encapcheck() at gif_encapcheck+0xfd > encap4_input() at encap4_input+0xcc > ip_input() at ip_input+0xc0 > tunwrite() at tunwrite+0x1d5 > giant_write() at giant_write+0x51 > devfs_write_f() at devfs_write_f+0x9c > dofilewrite() at dofilewrite+0x85 > kern_writev() at kern_writev+0x4c > write() at write+0x54 > syscall() at syscall+0x1ce > Xfast_syscall() at Xfast_syscall+0xab > --- syscall (4, FreeBSD ELF64, write), rip = 0x80125c35c, rsp = 0x7fffffffda18, > rbp = 0x60 --- > > > ifconfig: > gif0: flags=8051 metric 0 mtu 1280 > tunnel inet 194.186.18.14 --> 64.71.128.83 > inet6 fe80::20f:eaff:fe7d:f320%gif0 prefixlen 64 scopeid 0x5 > inet6 2001:470:1f03:2d5::2 --> 2001:470:1f03:2d5::1 prefixlen 128 > inet6 2001:470:1f01:725::1 prefixlen 64 > tun0: flags=8051 metric 0 mtu 1500 > inet6 fe80::20f:eaff:fe7d:f320%tun0 prefixlen 64 scopeid 0x6 > inet 194.186.18.14 --> 194.186.18.2 netmask 0xffffff00 > Opened by PID 458 > > > Yuri > _______________________________________________ > freebsd-current@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-current > To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org" -- Christian S.J. Peron csjp@FreeBSD.ORG FreeBSD Committer Index: net/if_stf.c =================================================================== RCS file: /usr/ncvs/src/sys/net/if_stf.c,v retrieving revision 1.59 diff -u -r1.59 if_stf.c --- net/if_stf.c 22 Oct 2006 11:52:15 -0000 1.59 +++ net/if_stf.c 27 Aug 2007 23:51:19 -0000 @@ -607,10 +607,10 @@ (u_int32_t)ntohl(sin.sin_addr.s_addr)); #endif if (rt) - rtfree(rt); + RTFREE_LOCKED(rt); return -1; } - rtfree(rt); + RTFREE_LOCKED(rt); } return 0; Index: netinet/in_gif.c =================================================================== RCS file: /usr/ncvs/src/sys/netinet/in_gif.c,v retrieving revision 1.36 diff -u -r1.36 in_gif.c --- netinet/in_gif.c 10 May 2007 15:58:47 -0000 1.36 +++ netinet/in_gif.c 27 Aug 2007 23:48:04 -0000 @@ -374,10 +374,10 @@ (u_int32_t)ntohl(sin.sin_addr.s_addr)); #endif if (rt) - rtfree(rt); + RTFREE_LOCKED(rt); return 0; } - rtfree(rt); + RTFREE_LOCKED(rt); } return 32 * 2; _______________________________________________ freebsd-current@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org" ----- End forwarded message -----