Activity log for bug #1690836

Date Who What changed Old value New value Message
2017-05-15 15:11:07 Sylvain Trinquet bug added bug
2017-05-15 15:11:07 Sylvain Trinquet attachment added trigger the memory leak https://bugs.launchpad.net/bugs/1690836/+attachment/4876902/+files/main.cpp
2017-05-15 15:12:34 Sylvain Trinquet description It seems that there is a memory leak in the libnl-genl-3.0 library. The memory-leak can be seen when the function genl_ctrl_resolve() fails. It seems that this function copy a buffer and forget to deallocate it properly: 258 cb = nl_cb_clone(orig); // buffer copied not freed -------------------------------------------------------------------------------------------- The following attached source-code can help you to reproduce this behavior on Ubuntu 14.04. It forces an issue on the genl_ctrl_resolve by asking an unknown netlink-family. To compile program: g++ -std=c++11 main.cpp $(pkg-config --cflags --libs libnl-3.0 libnl-genl-3.0) -o main To detect memory-leak using Valgrind: valgrind --leak-check=full ./main -------------------------------------------------------------------------------------------- Executing it on Debian 8.0 shows "no memory leak": sylvain@debian:~/test$ lsb_release -rd Description: Debian GNU/Linux 8.8 (jessie) Release: 8.8 sylvain@debian:~/test$ g++ -std=c++11 main.cpp $(pkg-config --cflags --libs libnl-3.0 libnl-genl-3.0) -o main sylvain@debian:~/test$ valgrind --leak-check=full ./main ==26390== Memcheck, a memory error detector ==26390== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al. ==26390== Using Valgrind-3.10.0 and LibVEX; rerun with -h for copyright info ==26390== Command: ./main ==26390== start test error: can't retrieve the netlink-family id end test ==26390== ==26390== HEAP SUMMARY: ==26390== in use at exit: 0 bytes in 0 blocks ==26390== total heap usage: 13 allocs, 13 frees, 22,142 bytes allocated ==26390== ==26390== All heap blocks were freed -- no leaks are possible ==26390== ==26390== For counts of detected and suppressed errors, rerun with: -v ==26390== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0) -------------------------------------------------------------------------------------------- Executing it on Ubuntu 14.04 shows a memory leak: ubuntu@ubuntu:~$ lsb_release -rd Description: Ubuntu 14.04.5 LTS Release: 14.04 ubuntu@ubuntu:~$ g++ -std=c++11 main.cpp $(pkg-config --cflags --libs libnl-3.0 libnl-genl-3.0) -o main ubuntu@ubuntu:~$ valgrind --leak-check=full ./main ==37377== Memcheck, a memory error detector ==37377== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al. ==37377== Using Valgrind-3.10.1 and LibVEX; rerun with -h for copyright info ==37377== Command: ./main ==37377== start test error: can't retrieve the netlink-family id end test ==37377== ==37377== HEAP SUMMARY: ==37377== in use at exit: 224 bytes in 1 blocks ==37377== total heap usage: 13 allocs, 12 frees, 22,142 bytes allocated ==37377== ==37377== 224 bytes in 1 blocks are definitely lost in loss record 1 of 1 ==37377== at 0x4C2CC70: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==37377== by 0x5048FAA: nl_cb_alloc (in /lib/x86_64-linux-gnu/libnl-3.so.200.16.1) ==37377== by 0x504CB1E: nl_socket_alloc (in /lib/x86_64-linux-gnu/libnl-3.so.200.16.1) ==37377== by 0x4012E3: A::Init() (in /home/ubuntu/main) ==37377== by 0x401189: main (in /home/ubuntu/main) ==37377== ==37377== LEAK SUMMARY: ==37377== definitely lost: 224 bytes in 1 blocks ==37377== indirectly lost: 0 bytes in 0 blocks ==37377== possibly lost: 0 bytes in 0 blocks ==37377== still reachable: 0 bytes in 0 blocks ==37377== suppressed: 0 bytes in 0 blocks ==37377== ==37377== For counts of detected and suppressed errors, rerun with: -v ==37377== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0) Thanks, Sylvain Trinquet It seems that there is a memory leak in the libnl-genl-3.0 library. The memory-leak can be seen when the function genl_ctrl_resolve() fails. It seems that this function copy a buffer and forget to deallocate it properly:   258 cb = nl_cb_clone(orig); // buffer copied not freed ----------------------------------------------------------------------------- The following attached source-code can help you to reproduce this behavior on Ubuntu 14.04. It forces an issue on the genl_ctrl_resolve by asking an unknown netlink-family. To compile program: g++ -std=c++11 main.cpp $(pkg-config --cflags --libs libnl-3.0 libnl-genl-3.0) -o main To detect memory-leak using Valgrind: valgrind --leak-check=full ./main ----------------------------------------------------------------------------- Executing it on Debian 8.0 shows "no memory leak": sylvain@debian:~/test$ lsb_release -rd Description: Debian GNU/Linux 8.8 (jessie) Release: 8.8 sylvain@debian:~/test$ g++ -std=c++11 main.cpp $(pkg-config --cflags --libs libnl-3.0 libnl-genl-3.0) -o main sylvain@debian:~/test$ valgrind --leak-check=full ./main ==26390== Memcheck, a memory error detector ==26390== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al. ==26390== Using Valgrind-3.10.0 and LibVEX; rerun with -h for copyright info ==26390== Command: ./main ==26390== start test error: can't retrieve the netlink-family id end test ==26390== ==26390== HEAP SUMMARY: ==26390== in use at exit: 0 bytes in 0 blocks ==26390== total heap usage: 13 allocs, 13 frees, 22,142 bytes allocated ==26390== ==26390== All heap blocks were freed -- no leaks are possible ==26390== ==26390== For counts of detected and suppressed errors, rerun with: -v ==26390== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0) ----------------------------------------------------------------------------- Executing it on Ubuntu 14.04 shows a memory leak: ubuntu@ubuntu:~$ lsb_release -rd Description: Ubuntu 14.04.5 LTS Release: 14.04 ubuntu@ubuntu:~$ g++ -std=c++11 main.cpp $(pkg-config --cflags --libs libnl-3.0 libnl-genl-3.0) -o main ubuntu@ubuntu:~$ valgrind --leak-check=full ./main ==37377== Memcheck, a memory error detector ==37377== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al. ==37377== Using Valgrind-3.10.1 and LibVEX; rerun with -h for copyright info ==37377== Command: ./main ==37377== start test error: can't retrieve the netlink-family id end test ==37377== ==37377== HEAP SUMMARY: ==37377== in use at exit: 224 bytes in 1 blocks ==37377== total heap usage: 13 allocs, 12 frees, 22,142 bytes allocated ==37377== ==37377== 224 bytes in 1 blocks are definitely lost in loss record 1 of 1 ==37377== at 0x4C2CC70: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==37377== by 0x5048FAA: nl_cb_alloc (in /lib/x86_64-linux-gnu/libnl-3.so.200.16.1) ==37377== by 0x504CB1E: nl_socket_alloc (in /lib/x86_64-linux-gnu/libnl-3.so.200.16.1) ==37377== by 0x4012E3: A::Init() (in /home/ubuntu/main) ==37377== by 0x401189: main (in /home/ubuntu/main) ==37377== ==37377== LEAK SUMMARY: ==37377== definitely lost: 224 bytes in 1 blocks ==37377== indirectly lost: 0 bytes in 0 blocks ==37377== possibly lost: 0 bytes in 0 blocks ==37377== still reachable: 0 bytes in 0 blocks ==37377== suppressed: 0 bytes in 0 blocks ==37377== ==37377== For counts of detected and suppressed errors, rerun with: -v ==37377== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0) Thanks, Sylvain Trinquet
2017-05-15 15:16:40 Launchpad Janitor libnl3 (Ubuntu): status New Confirmed
2017-05-16 08:11:45 Filofel bug added subscriber Filofel
2017-05-17 21:54:07 Joshua Powers bug added subscriber Joshua Powers
2017-05-17 21:54:15 Joshua Powers bug added subscriber Ubuntu Server Team
2017-05-17 21:55:03 Joshua Powers libnl3 (Ubuntu): importance Undecided Medium
2017-05-17 21:57:08 Joshua Powers tags leak libnl memory bitesize leak libnl memory needs-upstream-report
2017-05-18 15:25:42 Joshua Powers nominated for series Ubuntu Trusty
2017-05-18 15:25:42 Joshua Powers bug task added libnl3 (Ubuntu Trusty)
2017-05-18 15:26:43 Joshua Powers libnl3 (Ubuntu Trusty): status New Triaged
2018-06-27 11:27:13 Christian Ehrhardt  libnl3 (Ubuntu): status Confirmed Fix Released
2018-06-27 11:34:39 Christian Ehrhardt  nominated for series Ubuntu Xenial
2018-06-27 11:34:39 Christian Ehrhardt  bug task added libnl3 (Ubuntu Xenial)
2018-06-27 11:44:59 Christian Ehrhardt  libnl3 (Ubuntu Trusty): status Triaged Confirmed
2018-06-27 11:45:01 Christian Ehrhardt  libnl3 (Ubuntu Xenial): status New Confirmed
2022-02-07 23:29:35 Bryce Harrington libnl3 (Ubuntu Trusty): status Confirmed Won't Fix
2022-02-07 23:29:47 Bryce Harrington libnl3 (Ubuntu Xenial): status Confirmed Won't Fix