storaged-project / libblockdev

A library for manipulating block devices.
GNU Lesser General Public License v2.1
104 stars 54 forks source link

libmount memory leak #441

Closed tbzatek closed 5 years ago

tbzatek commented 5 years ago

(opening for myself: dig deep inside libmount)

==4848==    at 0x483880B: malloc (vg_replace_malloc.c:309)
==4848==    by 0x48ED4E2: unmangle (mangle.c:124)
==4848==    by 0x48D500B: mnt_parse_table_line (tab_parse.c:130)
==4848==    by 0x48D500B: mnt_table_parse_next (tab_parse.c:593)
==4848==    by 0x48D500B: mnt_table_parse_stream (tab_parse.c:733)
==4848==    by 0x48D630B: mnt_table_parse_file (tab_parse.c:797)
==4848==    by 0x48D68B2: mnt_table_parse_fstab (tab_parse.c:1088)
==4848==    by 0x48DF315: mnt_context_get_fstab (context.c:1073)
==4848==    by 0x48E09B3: mnt_context_apply_fstab (context.c:2244)
==4848==    by 0x48E3BE6: mnt_context_prepare_mount (context_mount.c:981)
==4848==    by 0x48E3BE6: mnt_context_prepare_mount (context_mount.c:958)
==4848==    by 0x48E51B7: mnt_context_mount (context_mount.c:1204)
==4848==    by 0x7A38B59: do_mount (mount.c:418)
==4848==    by 0x7A396A4: bd_fs_mount (mount.c:721)
==4848==    by 0x48808B2: bd_fs_mount (fs.c:501)
==4848==    by 0x43187A: handle_mount (udiskslinuxfilesystem.c:1458)
==4848==    by 0x53A8B27: ffi_call_unix64 (unix64.S:76)
==4848==    by 0x53A8338: ffi_call (ffi64.c:525)
==4848==    by 0x4C6523B: g_cclosure_marshal_generic (gclosure.c:1500)
==4848==    by 0x4C64741: g_closure_invoke (gclosure.c:810)
==4848==    by 0x4C77D53: signal_emit_unlocked_R (gsignal.c:3673)
==4848==    by 0x4C803F9: g_signal_emitv (gsignal.c:3129)
==4848==    by 0x4A3A4B2: _udisks_filesystem_skeleton_handle_method_call (udisks-generated.c:24458)

The do_mount() function looks sane and simple, must be something inside of libmount.

Reproducer: test_80_filesystem.Ext3TestCase.test_mount_fstab

vojtechtrefny commented 5 years ago

This should be fixed in libmount 2.34, see https://github.com/karelzak/util-linux/issues/821