Bug 15604 - [7.5 regression] gdbserver leaks socket to inferior
Summary: [7.5 regression] gdbserver leaks socket to inferior
Status: RESOLVED FIXED
Alias: None
Product: gdb
Classification: Unclassified
Component: server (show other bugs)
Version: 7.5
: P2 normal
Target Milestone: 7.6.1
Assignee: Jan Kratochvil
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-06-11 18:00 UTC by Jan Kratochvil
Modified: 2013-08-30 16:09 UTC (History)
2 users (show)

See Also:
Host: x86_64-unknown-linux-gnu
Target: x86_64-unknown-linux-gnu
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Kratochvil 2013-06-11 18:00:35 UTC
gdbserver :1234 true & sleep 1;ls -l /proc/`pidof true`/fd/4

7.4 PASS: ls: cannot access /proc/25283/fd/3: No such file or directory
7.5 FAIL: lrwx------ 1 64 Jun 11 19:56 /proc/25283/fd/3 -> socket:[428409464]
7.6 FAIL


dc13f571984e51e99fef1f49b39c3c3b1a0119f6 is the first bad commit
commit dc13f571984e51e99fef1f49b39c3c3b1a0119f6
Author: Doug Evans <dje@google.com>
Date:   Fri Dec 16 19:06:34 2011 +0000
    	* NEWS: Add entry for stdio gdbserver.
[RFA] stdio gdbserver
http://sourceware.org/ml/gdb-patches/2011-12/msg00022.html
Message-Id: <20111201212632.E6F892461D0@ruffy.mtv.corp.google.com>
Comment 1 Jan Kratochvil 2013-08-26 20:22:33 UTC
[gdbserver patch] [7.6.1] Fix fd leak regression
https://sourceware.org/ml/gdb-patches/2013-08/msg00765.html
Message-ID: <20130826202121.GA31493@host2.jankratochvil.net>
Comment 2 cvs-commit@gcc.gnu.org 2013-08-28 17:41:00 UTC
CVSROOT:	/cvs/src
Module name:	src
Changes by:	jkratoch@sourceware.org	2013-08-28 17:40:58

Modified files:
	gdb/gdbserver  : ChangeLog linux-low.c lynx-low.c server.c 
	                 spu-low.c 

Log message:
	PR server/15604
	
	gdb/gdbserver/
	2013-08-28  Jan Kratochvil  <jan.kratochvil@redhat.com>
	
	PR server/15604
	* linux-low.c: Include filestuff.h.
	(linux_create_inferior) <pid == 0>: Call close_most_fds.
	* lynx-low.c: Include filestuff.h.
	(lynx_create_inferior) <pid == 0>: Call close_most_fds.
	* server.c: Include filestuff.h.
	(main): Call notice_open_fds.
	* spu-low.c: Include filestuff.h.
	(spu_create_inferior) <pid == 0>: Call close_most_fds.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/gdbserver/ChangeLog.diff?cvsroot=src&r1=1.750&r2=1.751
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/gdbserver/linux-low.c.diff?cvsroot=src&r1=1.245&r2=1.246
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/gdbserver/lynx-low.c.diff?cvsroot=src&r1=1.21&r2=1.22
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/gdbserver/server.c.diff?cvsroot=src&r1=1.195&r2=1.196
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/gdbserver/spu-low.c.diff?cvsroot=src&r1=1.43&r2=1.44
Comment 3 Jan Kratochvil 2013-08-28 17:46:33 UTC
Checked in without 7.6.1 - 7.6 does not yet have gdb/common/filestuff.[ch] and
from various available solutions I think it is just OK to wait for 7.7.
Comment 4 cvs-commit@gcc.gnu.org 2013-08-29 14:24:17 UTC
CVSROOT:	/cvs/src
Module name:	src
Branch: 	gdb_7_6-branch
Changes by:	jkratoch@sourceware.org	2013-08-29 14:24:16

Modified files:
	gdb/gdbserver  : ChangeLog linux-low.c lynx-low.c remote-utils.c 
	                 server.h spu-low.c 

Log message:
	PR server/15604
	
	gdb/gdbserver/
	2013-08-29  Jan Kratochvil  <jan.kratochvil@redhat.com>
	
	PR server/15604
	* linux-low.c
	(linux_create_inferior) <pid == 0 && !remote_connection_is_stdio ()>:
	Close LISTEN_DESC and optionally REMOTE_DESC.
	(lynx_create_inferior) <pid == 0 && !remote_connection_is_stdio ()>:
	Close LISTEN_DESC and optionally REMOTE_DESC.
	* remote-utils.c (remote_desc, listen_desc): Remove static qualifier.
	* server.h (remote_desc, listen_desc): New declaration.
	* spu-low.c
	(spu_create_inferior) <pid == 0 && !remote_connection_is_stdio ()>:
	Close LISTEN_DESC and optionally REMOTE_DESC.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/gdbserver/ChangeLog.diff?cvsroot=src&only_with_tag=gdb_7_6-branch&r1=1.697.2.6&r2=1.697.2.7
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/gdbserver/linux-low.c.diff?cvsroot=src&only_with_tag=gdb_7_6-branch&r1=1.233.2.1&r2=1.233.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/gdbserver/lynx-low.c.diff?cvsroot=src&only_with_tag=gdb_7_6-branch&r1=1.18&r2=1.18.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/gdbserver/remote-utils.c.diff?cvsroot=src&only_with_tag=gdb_7_6-branch&r1=1.96&r2=1.96.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/gdbserver/server.h.diff?cvsroot=src&only_with_tag=gdb_7_6-branch&r1=1.106&r2=1.106.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/gdbserver/spu-low.c.diff?cvsroot=src&only_with_tag=gdb_7_6-branch&r1=1.42&r2=1.42.2.1