Skip to contentSkip to conversation

hppfs file descriptor leak?

uml-devel Dan Eaton 5 participants 6 messages May 3, 2004 – Sep 8, 2005 User-mode Linux (UML)

lore
Share & tools
lore

Dan Eaton

author
#0 lore raw

I am attempting to track down an issue that I am seeing but I thought that I would ask if you have anyone has seen this or has any insight into the behavior in parallel to my troubleshooting. I am using hppfs to spoof some /proc entries in the UML. When I mount /proc with hppfs, however, the system only runs for a short while before the UML kernel process runs out of file descriptors (1024). It seems that each access to /proc entries that I am spoofing from the host results in an open file that never gets closed. I am looking at it via gdb but any insight that anyone has would be greatly appreciated.

Configuration:

2.4.24-2 for UML
2.4.24 for host with the skas3 patch(same thing seen running tt mode) The host and UML are running RH9.
(Basically latest and greatest 2.4 stuff I could find.)

Thanks in advance for any help.

Signature · 12 lines
Dan Eaton <[email protected]>


-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g. 
Take an Oracle 10g class now, and we'll give you the exam FREE. 
http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click
_______________________________________________
User-mode-linux-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
#1 lore raw
Quoted 4 lines · [email protected] said:

It seems that each access to /proc entries that I am spoofing from the host results in an open file that never gets closed. I am looking at it via gdb but any insight that anyone has would be greatly appreciated.

First I've heard of it, but I'm not too surprised. The thing to do to track it down is see what file descriptors are being lost by looking at /proc/<uml-pid>/fd. It should be pretty obvious.

I'll take a look at it when I get a chance.

Jeff

-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g. Take an Oracle 10g class now, and we'll give you the exam FREE.
http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

#2 lore raw

In run_helper() in helper.c, fds[0] is never closed. Could this be it?

When debugging sbuml, I had to add this line:

helper.c renamed from helper.c.org +2 -0
@@ -100,6 +100,8 @@
 		pid = -errno;
 	}
 
+	os_close_file(fds[0]);  // for sbuml...  Is this a uml bug?
+
 	if(stack_out == NULL) free_stack(stack, 0);
         else *stack_out = stack;
 	return(pid);

change_tramp() in net_user.c also does not close fds[0].

These are in 2.4.23-2.
I don't know if these are related to hppfs, but it may show the pattern to look for in other code.

--Richard

Quoted 16 lines
Quoted 4 lines · [email protected] said:

It seems that each access to /proc entries that I am spoofing from the host results in an open file that never gets closed. I am looking at it via gdb but any insight that anyone has would be greatly appreciated.

First I've heard of it, but I'm not too surprised. The thing to do to track it down is see what file descriptors are being lost by looking at /proc/<uml-pid>/fd. It should be pretty obvious.

I'll take a look at it when I get a chance.

Jeff

Quoted 9 lines

-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g. Take an Oracle 10g class now, and we'll give you the exam FREE.
http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g. Take an Oracle 10g class now, and we'll give you the exam FREE.
http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

#3 lore raw
Quoted 2 lines · [email protected] said:

In run_helper() in helper.c, fds[0] is never closed. Could this be it?

Nice spotting, but hppfs doesn't use the helper stuff at all.

BTW, those functions were also racy, fds[1] could be closed before the child was execed.

Jeff

-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g. Take an Oracle 10g class now, and we'll give you the exam FREE.
http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

#4 lore raw
In reply to Dan Eaton
Quoted 9 lines · Dan Eaton

I am attempting to track down an issue that I am seeing but I thought that I would ask if you have anyone has seen this or has any insight into the behavior in parallel to my troubleshooting. I am using hppfs to spoof some /proc entries in the UML. When I mount /proc with hppfs, however, the system only runs for a short while before the UML kernel process runs out of file descriptors (1024). It seems that each access to /proc entries that I am spoofing from the host results in an open file that never gets closed. I am looking at it via gdb but any insight that anyone has would be greatly appreciated.

Don't know if this is relevant for you any more (I guess not), but I think I found it, while working on other stuff.

There's almost no call to close() in hppfs code, and everything matches with your description. Every time a file is opened in hostfs, an host fd is allocated where appropriate (for each distinct call to open() in userspace, even if more calls refer to the same file), and it's leaked.

Antoine, have you a clue why you never hit that? It's there both in 2.4 and 2.6.

Signature · 24 lines
Inform me of my mistakes, so I can keep imitating Homer Simpson's "Doh!".
Paolo Giarrusso, aka Blaisorblade (Skype ID "PaoloGiarrusso", ICQ 215621894)
http://www.user-mode-linux.org/~blaisorblade


	

	
		
___________________________________ 
Yahoo! Mail: gratis 1GB per i messaggi e allegati da 10MB 
http://mail.yahoo.it



-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
User-mode-linux-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
#5 lore raw
Quoted 2 lines

Antoine, have you a clue why you never hit that? It's there both in 2.4 and 2.6.

That's because I haven't used it lately, I made sure it worked - but did not push it, I am still struggling to figure out which libraries need to be included in the chroot - especially with pcap: building as a 32-bit app on a 64-bit host was kind of difficult.

I am hoping to get more time to play with this in the next few weeks and I will keep you posted.

Antoine

-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel