Public bug reported:

Hello,
starting from a very simple C program that uses the fork and exec functions, I 
found a memory leak using valgrind and, after several trials, I discovered that 
there is a bug in coreutils written in rust.

You can find the code here
https://drive.proton.me/urls/S0PVKTVYM4#AMt0PsPTWku3

gcc -g3 -Wall -Wextra code.c -o binary
valgrind --tool=memcheck --leak-check=full --trace-children=yes ./binary

Tests. Ubuntu 26.04 problem. No problems with gcc or valgrind.
ubuntu 22.04.5 gcc 13.2.0-16.0.1, valgrind 3.18, kernel 6.8 ok
ubuntu 24.04.5 gcc 13.2.0-15.2.0, valgrind 3.22, kernel 7.0 ok
ubuntu 26.04.1 gcc 15.2.0-16.0.1, valgrind 3.26 (3.28 compiled from source), 
kernel 7.0 memory leak
fedora 46 gcc 16.2.0, valgrind 3.28, kernel 7.2 ok
debian 13.7 gcc 14.2.0, valgrind 3.24, kernel 6.12 ok
mint LMDE 7 gcc 14.2.0, valgrind 3.24, kernel 6.12 ok

Further testing. Problem with ubuntu 26.04 confirmed. It is not related to 
glibc.
ubuntu 24.04.5 ldd (Ubuntu GLIBC 2.39-0ubuntu8.9) 2.39
ubuntu 26.04.1 ldd (Ubuntu GLIBC 2.43-2ubuntu2.4) 2.43
debian 13.7 ldd (Debian GLIBC 2.41-12+deb13u4) 2.41
fedora 46 ldd (GNU libc) 2.44

Valgrind output
==18788== LEAK SUMMARY:
==18788== definitely lost: 8 bytes in 1 blocks
==18788== indirectly lost: 43,665 bytes in 68 blocks
==18788== possibly lost: 4,886 bytes in 7 blocks
==18788== still reachable: 195,435 bytes in 2,152 blocks
==18788== suppressed: 0 bytes in 0 blocks
==18788== Reachable blocks (those to which a pointer was found) are not shown.
==18788== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==18788==
==18788== For lists of detected and suppressed errors, rerun with: -s
==18788== ERROR SUMMARY: 8 errors from 8 contexts (suppressed: 0 from 0)

Valgrind output (snippet)
==78521== 64 bytes in 1 blocks are possibly lost in loss record 10 of 47
==78521== at 0x53965BB: realloc (vg_replace_malloc.c:1741)
==78521== by 0x40F6098: ??? (in /usr/lib/cargo/bin/coreutils/ls)
==78521== by 0x41F2192: ??? (in /usr/lib/cargo/bin/coreutils/ls)
==78521== by 0x42433AA: ??? (in /usr/lib/cargo/bin/coreutils/ls)
==78521== by 0x4243266: ??? (in /usr/lib/cargo/bin/coreutils/ls)
==78521== by 0x424794D: ??? (in /usr/lib/cargo/bin/coreutils/ls)
==78521== by 0x4248B09: ??? (in /usr/lib/cargo/bin/coreutils/ls)
==78521== by 0x422EFDE: ??? (in /usr/lib/cargo/bin/coreutils/ls)
==78521== by 0x422D9D3: ??? (in /usr/lib/cargo/bin/coreutils/ls)
==78521== by 0x422CBDC: ??? (in /usr/lib/cargo/bin/coreutils/ls)
==78521== by 0x422EC95: ??? (in /usr/lib/cargo/bin/coreutils/ls)
==78521== by 0x422E821: ??? (in /usr/lib/cargo/bin/coreutils/ls)

I can confirm 100% that this is a bug in rust coreutils. In fact, reinstalling 
GNU coreutils with the command "sudo apt remove coreutils-from-uutils 
--allow-remove-essential" resolves the memory leak.
Thank you

** Affects: rust-coreutils (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2175059

Title:
  Memory leak in the coreutils implementation

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/rust-coreutils/+bug/2175059/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to