Red Hat Bugzilla – Bug 1483543
quotacheck tool leaks memory when scanning ext file system directly
Last modified: 2018-04-10 04:43:09 EDT
Since quota-4.01-15.el7.x86_64, quotacheck tool uses direct scanning for ext4 file system. There are some memory leaks in the direct scanning feature: # dd if=/dev/zero of=disk.img bs=1M count=40 # mkfs.ext4 -F disk.img # mount -o loop,jqfmt=vfsv1,usrjquota=aquota.user disk.img /mnt/1 # valgrind --leak-check=yes quotacheck -f /mnt/1/ ==8864== Memcheck, a memory error detector ==8864== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al. ==8864== Using Valgrind-3.12.0 and LibVEX; rerun with -h for copyright info ==8864== Command: quotacheck -f /mnt/1/ ==8864== ==8864== ==8864== HEAP SUMMARY: ==8864== in use at exit: 25,099 bytes in 30 blocks ==8864== total heap usage: 227 allocs, 197 frees, 72,131 bytes allocated ==8864== ==8864== 1,392 (88 direct, 1,304 indirect) bytes in 1 blocks are definitely lost in loss record 19 of 23 ==8864== at 0x4C29BE3: malloc (vg_replace_malloc.c:299) ==8864== by 0x4E5288B: ext2fs_make_generic_bitmap (in /usr/lib64/libext2fs.so.2.4) ==8864== by 0x4E47ED5: ext2fs_allocate_inode_bitmap (in /usr/lib64/libext2fs.so.2.4) ==8864== by 0x10DC36: ??? (in /usr/sbin/quotacheck) ==8864== by 0x10B095: ??? (in /usr/sbin/quotacheck) ==8864== by 0x52A0C04: (below main) (in /usr/lib64/libc-2.17.so) ==8864== ==8864== 8,464 (144 direct, 8,320 indirect) bytes in 1 blocks are definitely lost in loss record 22 of 23 ==8864== at 0x4C29BE3: malloc (vg_replace_malloc.c:299) ==8864== by 0x4E5749D: ext2fs_open_inode_scan (in /usr/lib64/libext2fs.so.2.4) ==8864== by 0x10DC5F: ??? (in /usr/sbin/quotacheck) ==8864== by 0x10B095: ??? (in /usr/sbin/quotacheck) ==8864== by 0x52A0C04: (below main) (in /usr/lib64/libc-2.17.so) ==8864== ==8864== 15,243 (88 direct, 15,155 indirect) bytes in 1 blocks are definitely lost in loss record 23 of 23 ==8864== at 0x4C29BE3: malloc (vg_replace_malloc.c:299) ==8864== by 0x4E5288B: ext2fs_make_generic_bitmap (in /usr/lib64/libext2fs.so.2.4) ==8864== by 0x4E47ED5: ext2fs_allocate_inode_bitmap (in /usr/lib64/libext2fs.so.2.4) ==8864== by 0x10DC08: ??? (in /usr/sbin/quotacheck) ==8864== by 0x10B095: ??? (in /usr/sbin/quotacheck) ==8864== by 0x52A0C04: (below main) (in /usr/lib64/libc-2.17.so) ==8864== ==8864== LEAK SUMMARY: ==8864== definitely lost: 320 bytes in 3 blocks ==8864== indirectly lost: 24,779 bytes in 27 blocks ==8864== possibly lost: 0 bytes in 0 blocks ==8864== still reachable: 0 bytes in 0 blocks ==8864== suppressed: 0 bytes in 0 blocks ==8864== ==8864== For counts of detected and suppressed errors, rerun with: -v ==8864== ERROR SUMMARY: 3 errors from 3 contexts (suppressed: 0 from 0) The same applies to ext2 and ext3 file systems. This is not a new bug, it just became more prominent as former quota packages did not use direct scanning on ext4.
Created attachment 1316222 [details] Proposed fix
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHEA-2018:0667