Project

General

Profile

Bug #5518

Memory leaks in libzfs import implementation

Added by Marcel Telka almost 5 years ago. Updated almost 5 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
zfs - Zettabyte File System
Start date:
2015-01-09
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:
needs-triage

Description

There are various memory leaks in libzfs import implementation. Steps to reproduce:

# mkfile 100M /export/test1
# zpool create test1 /export/test1 
# zpool export test1
# mkfile 100M /export/test2
# zpool create test2 /export/test2
# zpool export test2
# export LD_PRELOAD=libumem.so.1
# export UMEM_DEBUG=default
# mdb /usr/sbin/zpool
> ::sysbp _exit
> ::run import -d /export test2
mdb: stop on entry to _exit
mdb: target stopped at:
0xfee623f8:     nop    
mdb: You've got symbols!
Loading modules: [ ld.so.1 libumem.so.1 libc.so.1 libtopo.so.1 libavl.so.1 libnvpair.so.1 libuutil.so.1 ]
> ::findleaks -d
BYTES             LEAKED VMEM_SEG CALLER
4096                   2 fe7be000 MMAP
4096                   1 fea7e000 MMAP
------------------------------------------------------------------------
           Total       2 oversized leaks, 8192 bytes

CACHE     LEAKED   BUFCTL CALLER
0807fa10       1 080a75f0 libc_hwcap1.so.1`strdup+0x2e
08082210       1 080bde28 libzfs.so.1`zfs_alloc+0x1e
0808a610       1 080ebc60 libzfs.so.1`zfs_alloc+0x1e
0808ac10       1 080ebbe8 libzfs.so.1`zfs_alloc+0x1e
------------------------------------------------------------------------
   Total       4 buffers, 24640 bytes

mmap(2) leak: [fe7be000, fe7bf000), 4096 bytes
mmap(2) leak: [fea7e000, fea7f000), 4096 bytes
umem_alloc_16 leak: 1 buffer, 16 bytes
            ADDR          BUFADDR        TIMESTAMP           THREAD
                            CACHE          LASTLOG         CONTENTS
         80a75f0          80a2f60     177e0d09f582                1
                          807fa10                0                0
                 libumem.so.1`umem_cache_alloc_debug+0x1fe
                 libumem.so.1`umem_cache_alloc+0x18f
                 libumem.so.1`umem_alloc+0x50
                 libumem.so.1`umem_malloc+0x36
                 libc_hwcap1.so.1`strdup+0x2e
                 libzfs.so.1`zfs_strdup+0x1c
                 libzfs.so.1`zpool_find_import_impl+0x22f
                 libzfs.so.1`zpool_search_import+0x9f
                 zpool_do_import+0x5d8
                 main+0x131
                 _start+0x83

umem_alloc_48 leak: 1 buffer, 48 bytes
            ADDR          BUFADDR        TIMESTAMP           THREAD
                            CACHE          LASTLOG         CONTENTS                                      
         80bde28          80baf40     177e0d09f3f9                1
                          8082210                0                0
                 libumem.so.1`umem_cache_alloc_debug+0x1fe
                 libumem.so.1`umem_cache_alloc+0x99
                 libumem.so.1`umem_alloc+0x50
                 libumem.so.1`umem_malloc+0x36
                 libumem.so.1`calloc+0x50
                 libzfs.so.1`zfs_alloc+0x1e
                 libzfs.so.1`zpool_find_import_impl+0x221
                 libzfs.so.1`zpool_search_import+0x9f
                 zpool_do_import+0x5d8
                 main+0x131
                 _start+0x83          

umem_alloc_8192 leak: 1 buffer, 8192 bytes
            ADDR          BUFADDR        TIMESTAMP           THREAD
                            CACHE          LASTLOG         CONTENTS                                      
         80ebc60          80ed000     177e0e9681bd                1
                          808a610                0                0
                 libumem.so.1`umem_cache_alloc_debug+0x1fe
                 libumem.so.1`umem_cache_alloc+0x99
                 libumem.so.1`umem_alloc+0x50
                 libumem.so.1`umem_malloc+0x36
                 libumem.so.1`calloc+0x50
                 libzfs.so.1`zfs_alloc+0x1e
                 libzfs.so.1`zcmd_write_nvlist_com+0x5a
                 libzfs.so.1`zcmd_write_conf_nvlist+0x21
                 libzfs.so.1`zpool_import_props+0x236
                 do_import+0x274      
                 zpool_do_import+0x98f
                 main+0x131           
                 _start+0x83          

umem_alloc_16384 leak: 1 buffer, 16384 bytes
            ADDR          BUFADDR        TIMESTAMP           THREAD
                            CACHE          LASTLOG         CONTENTS                                      
         80ebbe8          80f0000     177e0e96bfa3                1
                          808ac10                0                0
                 libumem.so.1`umem_cache_alloc_debug+0x1fe
                 libumem.so.1`umem_cache_alloc+0x18f
                 libumem.so.1`umem_alloc+0x50
                 libumem.so.1`umem_malloc+0x36
                 libumem.so.1`calloc+0x50
                 libzfs.so.1`zfs_alloc+0x1e
                 libzfs.so.1`zcmd_alloc_dst_nvlist+0x3b
                 libzfs.so.1`zpool_import_props+0x270
                 do_import+0x274      
                 zpool_do_import+0x98f
                 main+0x131           
                 _start+0x83          

>

History

#1

Updated by Marcel Telka almost 5 years ago

  • Status changed from In Progress to Pending RTI
#2

Updated by Electric Monk almost 5 years ago

  • Status changed from Pending RTI to Closed
  • % Done changed from 0 to 100

git commit 078266a5aafa880521ea55488ef3d676f35e908e

commit  078266a5aafa880521ea55488ef3d676f35e908e
Author: Marcel Telka <marcel.telka@nexenta.com>
Date:   2015-01-14T15:33:21.000Z

    5518 Memory leaks in libzfs import implementation
    Reviewed by: Dan Fields <dan.fields@nexenta.com>
    Reviewed by: Matthew Ahrens <mahrens@delphix.com>
    Reviewed by: Serghei Samsi <sscdvp@gmail.com>
    Approved by: Dan McDonald <danmcd@omniti.com>

Also available in: Atom PDF