Arch Linux

Please read this before reporting a bug:
https://wiki.archlinux.org/title/Bug_reporting_guidelines

Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.

REPEAT: Do NOT report bugs for outdated packages!
Tasklist

FS#79810 - [glibc] Potential memory leak in ahostsv4/ahostsv6

Attached to Project: Arch Linux
Opened by Frantisek Sumsal (mrc0mmand) - Thursday, 28 September 2023, 19:56 GMT
Last edited by Toolybird (Toolybird) - Friday, 29 September 2023, 07:07 GMT
Task Type Bug Report
Category Packages: Core
Status Closed
Assigned To freswa (frederik)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:
Hey! During a regular image update in our upstream systemd CI, the ASan+UBSan job started complaining about a possible memory leak when running `getent ahostsv4 -s mymachines ...`. After some digging I can reproduce it even without systemd involvement:

# LD_PRELOAD=/usr/lib64/libasan.so.8 getent ahostsv4 localhost
127.0.0.1 STREAM localhost
127.0.0.1 DGRAM
127.0.0.1 RAW

=================================================================
==179818==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 10 byte(s) in 1 object(s) allocated from:
#0 0x7f15ebee1359 in __interceptor_malloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:69
#1 0x7f15ebcc13de in __strdup (/usr/lib/libc.so.6+0xa33de) (BuildId: 023ea16fd6c04ef9cf094507024e6ecdb35e02ca)
#2 0x7f15eabf0073 (<unknown module>)

SUMMARY: AddressSanitizer: 10 byte(s) leaked in 1 allocation(s).

This is reproducible only with glibc 2.38-4. With glibc 2.38-3 everything seems to work as expected:

# LD_PRELOAD=/usr/lib64/libasan.so.8 getent ahostsv4 localhost
127.0.0.1 STREAM localhost
127.0.0.1 DGRAM
127.0.0.1 RAW

Since the stack trace is not complete, I can't tell for sure if it's an actual issue or not, but it's definitely something new that was introduced in 2.38-4.

Additional info:
* package version(s)
glibc 2.38-4
This task depends upon

Closed by  Toolybird (Toolybird)
Friday, 29 September 2023, 07:07 GMT
Reason for closing:  Fixed
Additional comments about closing:  glibc 2.38-5
Comment by loqs (loqs) - Thursday, 28 September 2023, 20:17 GMT Comment by Frantisek Sumsal (mrc0mmand) - Thursday, 28 September 2023, 20:49 GMT
Thanks for the links, loqs! Given that, I suspect that [0] might be the fix for the leak.

[0] https://github.com/bminor/glibc/commit/ec6b95c3303c700eb89eebeda2d7264cc184a796
Comment by Christian Hesse (eworm) - Thursday, 28 September 2023, 20:49 GMT
Looks like this leaks in `getaddrinfo()`. Possibly we need this?

https://github.com/bminor/glibc/commit/ec6b95c3303c700eb89eebeda2d7264cc184a796
Comment by freswa (frederik) - Thursday, 28 September 2023, 21:11 GMT
It's already backported to the 2.38 master branch, build in progress.
Comment by freswa (frederik) - Thursday, 28 September 2023, 22:37 GMT
Please test glibc-2.38-5 :)
Comment by Christian Hesse (eworm) - Friday, 29 September 2023, 04:38 GMT
Works for me. Thanks!
Comment by Frantisek Sumsal (mrc0mmand) - Friday, 29 September 2023, 05:49 GMT
Works for me as well, thanks!
Comment by Christian Hesse (eworm) - Friday, 29 September 2023, 06:02 GMT
BTW, the memory leak was assigned CVE-2023-5156.

Loading...