Bug 1224855

Summary: bash-4.3.39-1.fc22.x86_64 introduces memory leak
Product: [Fedora] Fedora Reporter: Peter Hutterer <peter.hutterer>
Component: bashAssignee: Ondrej Oprala <ooprala>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 22CC: admiller, nmavrogi, ooprala, ovasik
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: bash-4.3.39-5.fc21 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-07-18 02:07:27 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Peter Hutterer 2015-05-26 03:53:06 UTC
Description of problem:
process substitution in bash leaks memory with the 39 update.

Version-Release number of selected component (if applicable):
bash-4.3.39-1.fc22.x86_64 


Steps to Reproduce:

$ cat test-script.sh 
#!/bin/bash

cat <(echo foo)

$ valgrind --leak-check=full ./test-script.sh

==8235== 12 bytes in 1 blocks are definitely lost in loss record 85 of 255
==8235==    at 0x4C28C0F: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==8235==    by 0x18928F: xmalloc (xmalloc.c:112)
==8235==    by 0x18306A: set_default_locale (locale.c:81)
==8235==    by 0x1360B0: main (shell.c:410)
==8235== 
==8235== 17 bytes in 1 blocks are definitely lost in loss record 119 of 255
==8235==    at 0x4C28C0F: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==8235==    by 0x18925A: xmalloc (xmalloc.c:112)
==8235==    by 0x16B8F4: make_dev_fd_filename (subst.c:5025)
==8235==    by 0x16B8F4: process_substitute (subst.c:5084)
==8235==    by 0x16B8F4: expand_word_internal (subst.c:8278)
==8235==    by 0x16E430: shell_expand_word_list (subst.c:9586)
==8235==    by 0x16E430: expand_word_list_internal (subst.c:9706)
==8235==    by 0x134457: execute_simple_command (execute_cmd.c:4012)
==8235==    by 0x14C20B: execute_command_internal (execute_cmd.c:799)
==8235==    by 0x14DC61: execute_command (execute_cmd.c:394)
==8235==    by 0x1384EC: reader_loop (eval.c:161)
==8235==    by 0x136F61: main (shell.c:766)
==8235== 


Additional info:
bash-4.3.33-2.fc22.x86_64 does not have this bug. No custom bashrc present here.

I tried compiling bash from git but I get linker errors with the fedora configure options. fedpkg local doesn't work with the f22 tree (conftest is missing?) manually running configure and make with the options from the specfile didn't reproduce the leak.

Comment 1 Ondrej Oprala 2015-05-26 06:55:08 UTC
It seem that set_default_locale() leaks a pointer when ./configure --with-bash-malloc=no is used...

Comment 2 Fedora Update System 2015-07-06 10:55:15 UTC
bash-4.3.39-4.fc22 has been submitted as an update for Fedora 22.
https://admin.fedoraproject.org/updates/bash-4.3.39-4.fc22

Comment 3 Fedora Update System 2015-07-06 10:55:26 UTC
bash-4.3.39-4.fc21 has been submitted as an update for Fedora 21.
https://admin.fedoraproject.org/updates/bash-4.3.39-4.fc21

Comment 4 Ondrej Oprala 2015-07-10 07:18:02 UTC
*** Bug 1241533 has been marked as a duplicate of this bug. ***

Comment 5 Fedora Update System 2015-07-10 19:05:53 UTC
Package bash-4.3.39-4.fc21:
* should fix your issue,
* was pushed to the Fedora 21 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing bash-4.3.39-4.fc21'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2015-11260/bash-4.3.39-4.fc21
then log in and leave karma (feedback).

Comment 6 Peter Hutterer 2015-07-12 22:01:45 UTC
just tried the -4 package in F22 and it still shows the issue

Comment 7 Fedora Update System 2015-07-14 15:29:19 UTC
bash-4.3.39-4.fc22 has been pushed to the Fedora 22 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 8 Ondrej Oprala 2015-07-14 19:02:55 UTC
Thanks, I'll re-check.

Comment 9 Fedora Update System 2015-07-15 11:06:39 UTC
bash-4.3.39-5.fc21 has been submitted as an update for Fedora 21.
https://admin.fedoraproject.org/updates/bash-4.3.39-5.fc21

Comment 10 Fedora Update System 2015-07-15 11:07:54 UTC
bash-4.3.39-5.fc22 has been submitted as an update for Fedora 22.
https://admin.fedoraproject.org/updates/bash-4.3.39-5.fc22

Comment 11 Peter Hutterer 2015-07-15 23:24:31 UTC
thanks, leak is fixed now

Comment 12 Fedora Update System 2015-07-18 02:00:29 UTC
Package bash-4.3.39-5.fc21:
* should fix your issue,
* was pushed to the Fedora 21 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing bash-4.3.39-5.fc21'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2015-11698/bash-4.3.39-5.fc21
then log in and leave karma (feedback).

Comment 13 Fedora Update System 2015-07-18 02:07:27 UTC
bash-4.3.39-5.fc22 has been pushed to the Fedora 22 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 14 Fedora Update System 2015-07-29 01:43:23 UTC
bash-4.3.39-5.fc21 has been pushed to the Fedora 21 stable repository.  If problems still persist, please make note of it in this bug report.