Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #16653
| Path | csiph.com!xmission!news.snarked.org!news.linkpendium.com!news.linkpendium.com!panix!usenet.stanford.edu!not-for-mail |
|---|---|
| From | Chris Dunlop <chris@onthe.net.au> |
| Newsgroups | gnu.bash.bug |
| Subject | File descriptor leak |
| Date | Fri, 31 Jul 2020 14:29:59 +1000 |
| Lines | 81 |
| Approved | bug-bash@gnu.org |
| Message-ID | <mailman.364.1596175695.2739.bug-bash@gnu.org> (permalink) |
| References | <20200731042959.GA15513@onthe.net.au> |
| NNTP-Posting-Host | lists.gnu.org |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=us-ascii; format=flowed |
| X-Trace | usenet.stanford.edu 1596175695 19888 209.51.188.17 (31 Jul 2020 06:08:15 GMT) |
| X-Complaints-To | action@cs.stanford.edu |
| To | bug-bash@gnu.org |
| Envelope-to | bug-bash@gnu.org |
| Content-Disposition | inline |
| User-Agent | Mutt/1.9.4 (2018-02-28) |
| Received-SPF | pass client-ip=203.22.196.249; envelope-from=chris@onthe.net.au; helo=smtp1.onthe.net.au |
| X-detected-operating-system | by eggs.gnu.org: First seen = 2020/07/31 00:30:00 |
| X-ACL-Warn | Detected OS = Linux 2.6.x |
| X-Spam_score_int | -18 |
| X-Spam_score | -1.9 |
| X-Spam_bar | - |
| X-Spam_report | (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no |
| X-Spam_action | no action |
| X-Mailman-Approved-At | Fri, 31 Jul 2020 02:08:14 -0400 |
| X-BeenThere | bug-bash@gnu.org |
| X-Mailman-Version | 2.1.23 |
| Precedence | list |
| List-Id | Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org> |
| List-Unsubscribe | <https://lists.gnu.org/mailman/options/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=unsubscribe> |
| List-Archive | <https://lists.gnu.org/archive/html/bug-bash> |
| List-Post | <mailto:bug-bash@gnu.org> |
| List-Help | <mailto:bug-bash-request@gnu.org?subject=help> |
| List-Subscribe | <https://lists.gnu.org/mailman/listinfo/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=subscribe> |
| X-Mailman-Original-Message-ID | <20200731042959.GA15513@onthe.net.au> |
| Xref | csiph.com gnu.bash.bug:16653 |
Show key headers only | View raw
From: chris@onthe.net.au
To: bug-bash@gnu.org
Subject: File descriptor leak
Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS: -g -O2 -fdebug-prefix-map=/build/bash-2bxm7h/bash-5.0=. -fstack-protector-strong -Wformat -Werror=format-security -Wall -Wno-parentheses -Wno-format-security
uname output: Linux b2 5.7.9-otn-00003-g8c0bb49bc11c #1 SMP Fri Jul 17 04:37:20 UTC 2020 x86_64 GNU/Linux
Machine Type: x86_64-pc-linux-gnu
Bash Version: 5.0
Patch Level: 3
Release Status: release
Description:
Bash is leaking a file descriptor.
Repeat-By:
----------------------------------------------------------------------
#!/bin/bash
if :
then
while read l
do
grep . /proc/$$/fdinfo/*
pvs > /dev/null
done < <( echo )
echo
fi
----------------------------------------------------------------------
The script generates output like:
/proc/2320431/fdinfo/0:pos: 0
/proc/2320431/fdinfo/0:flags: 0100000
/proc/2320431/fdinfo/0:mnt_id: 10
/proc/2320431/fdinfo/1:pos: 0
/proc/2320431/fdinfo/1:flags: 02
/proc/2320431/fdinfo/1:mnt_id: 20
/proc/2320431/fdinfo/10:pos: 0
/proc/2320431/fdinfo/10:flags: 02000002
/proc/2320431/fdinfo/10:mnt_id: 20
/proc/2320431/fdinfo/2:pos: 0
/proc/2320431/fdinfo/2:flags: 02
/proc/2320431/fdinfo/2:mnt_id: 20
/proc/2320431/fdinfo/255:pos: 123
/proc/2320431/fdinfo/255:flags: 02100000
/proc/2320431/fdinfo/255:mnt_id: 22
grep: /proc/2320431/fdinfo/3: No such file or directory
/proc/2320431/fdinfo/63:pos: 0
/proc/2320431/fdinfo/63:flags: 00
/proc/2320431/fdinfo/63:mnt_id: 10
File descriptor 63 (pipe:[189620647]) leaked on pvs invocation. Parent PID 2320431: /bin/bash
The last 'echo' within the 'if' is required to trigger the error.
The 'grep' is just to see the open file descriptors at that point, it's
not required to trigger the bug.
The 'pvs' (part of the lvm2 Logical Volume Manager suite) is also not
required to trigger the bug, it's just how I noticed the bug. The lvm2
stuff is particularly loud about file descriptor leaks.
Oh. Huh. I just noticed this also reproduces the problem:
----------------------------------------------------------------------
# pvs < <(echo) > /dev/null
File descriptor 63 (pipe:[190051752]) leaked on pvs invocation. Parent PID 204155: -bash
----------------------------------------------------------------------
This version of the problem may be subtly different because as previously
noted the first reproducer script requires the 'echo' within the 'if'.
See also:
- https://lists.gnu.org/archive/html/bug-bash/2017-01/msg00026.html
- https://github.com/lvmteam/lvm2/blob/e10f20bc23088a2f9f7529f8f2b40d9c1fcb54c6/tools/lvmcmdline.c#L3333
--
Chris Dunlop
Back to gnu.bash.bug | Previous | Next | Find similar
File descriptor leak Chris Dunlop <chris@onthe.net.au> - 2020-07-31 14:29 +1000
csiph-web