From owner-freebsd-bugs Fri Aug 16 12: 0:16 2002 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9DAF337B400 for ; Fri, 16 Aug 2002 12:00:05 -0700 (PDT) Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id E086343E7B for ; Fri, 16 Aug 2002 12:00:04 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.4/8.12.4) with ESMTP id g7GJ04JU048636 for ; Fri, 16 Aug 2002 12:00:04 -0700 (PDT) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.4/8.12.4/Submit) id g7GJ04ou048635; Fri, 16 Aug 2002 12:00:04 -0700 (PDT) Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5308337B400 for ; Fri, 16 Aug 2002 11:52:27 -0700 (PDT) Received: from www.freebsd.org (www.FreeBSD.org [216.136.204.117]) by mx1.FreeBSD.org (Postfix) with ESMTP id ED43A43E6A for ; Fri, 16 Aug 2002 11:52:26 -0700 (PDT) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.12.4/8.12.4) with ESMTP id g7GIqQOT053008 for ; Fri, 16 Aug 2002 11:52:26 -0700 (PDT) (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.12.4/8.12.4/Submit) id g7GIqQJe053007; Fri, 16 Aug 2002 11:52:26 -0700 (PDT) Message-Id: <200208161852.g7GIqQJe053007@www.freebsd.org> Date: Fri, 16 Aug 2002 11:52:26 -0700 (PDT) From: Harsha Bellur To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-1.0 Subject: misc/41717: Memory Leak in FreeBSD Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >Number: 41717 >Category: misc >Synopsis: Memory Leak in FreeBSD >Confidential: no >Severity: critical >Priority: high >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Fri Aug 16 12:00:04 PDT 2002 >Closed-Date: >Last-Modified: >Originator: Harsha Bellur >Release: ??? Freebsd version used in RTEMS 4.5 >Organization: >Environment: RTEMS 4.5 >Description: | | ---------- ---------- | | | | | ETH | | NODE A | PT-PT LINK | NODE B |----------| 172.16.40.1 | |---------------------- | | | ---------- ---------- | | Node A IP : 172.16.17.124 NODE B IP : 172.16.40.122 NODE A adds NODE B's IP as its default gateway Here's the routing table for NODE B Destination Gateway/Mask/Hw Flags Refs Use Interface default 172.16.40.122 UGSW 1744 289 serial0 127.0.0.1/0 127.0.0.1 UHb 0 0 lo0 172.16.17.124/32 127.0.0.1 UH 0 0 lo0 172.16.40.0/24 172.16.40.122 UGW 1 7 serial0 172.16.40.122/32 172.16.17.124 UH 1746 0 serial0 TEST EXECUTED: . NODE B is reset every 30-40 seconds. Everytime the PT-PT interface goes down NODE A deletes the default gateway and the routes associated with it and Adds it when the interface is back up and running PROBLEM REPORT: This process of adding and deleting routes is causing memory loss in NODE A I found out the places in the freebsd code where the memory is allocated but not freed. (which may be of some help) Memory leak doesnot happen everytime these lines of code are executed. 1. route.c rtrequest() makeroute: R_Malloc(rt, struct rtentry *, sizeof(*rt)); if (rt == 0) senderr(ENOBUFS); Bzero(rt, sizeof(*rt)); 2. route.c rt_setgate() if (rt->rt_gateway == 0 || glen > ROUNDUP(rt->rt_gateway->sa_len)) { old = (caddr_t)rt_key(rt); R_Malloc(new, caddr_t, dlen + glen); if (new == 0) return ENOBUFS; 3. in.c in_control() case SIOCSIFDSTADDR: if (p && (error = suser(p)) != 0) return error; if (ifp == 0) return (EADDRNOTAVAIL); if (ia == (struct in_ifaddr *)0) { ia = (struct in_ifaddr *) malloc(sizeof *ia, M_IFADDR, M_WAITOK); if (ia == (struct in_ifaddr *)NULL) return (ENOBUFS); >How-To-Repeat: NODE B is reset every 30-40 seconds. Everytime the PT-PT interface goes down NODE A deletes the default gateway and the routes associated with it and Adds it when the interface is back up and running >Fix: >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message