| Summary: | File descriptor leak and frequent crashes of rpc.rstatd [PATCH] | ||||||
|---|---|---|---|---|---|---|---|
| Product: | Base System | Reporter: | Martin Butkus <mb> | ||||
| Component: | bin | Assignee: | freebsd-bugs (Nobody) <bugs> | ||||
| Status: | Closed FIXED | ||||||
| Severity: | Affects Only Me | ||||||
| Priority: | Normal | ||||||
| Version: | 4.2-STABLE | ||||||
| Hardware: | Any | ||||||
| OS: | Any | ||||||
| Attachments: |
|
||||||
|
Description
Martin Butkus
2001-02-05 00:00:01 UTC
> However, when run standalone, it crashed frequently, and I also
> discovered a file descriptor leak.
>
> I have observed that:
>
> 1) rpc.rstatd opens /dev/mem and /dev/kmem multiple times
> until running out of file descriptors.
> 2) rpc.rstatd often crashes within 24 hours
The following patch is what I've applied to -CURRENT. It simplifies what
you have to fix (1) and more correctly fixes (2) (your code still allows a
small window where the problem can still occur). Please test it out.
To crash rpc.rstatd, I used something similar to the following:
rup localhost & ; rup localhost & ;rup localhost & ;rup localhost & ;[repeat]
Index: rstat_proc.c
===================================================================
RCS file: /export/ncvs/src/libexec/rpc.rstatd/rstat_proc.c,v
retrieving revision 1.14
diff -u -r1.14 rstat_proc.c
--- rstat_proc.c 1999/08/28 00:09:54 1.14
+++ rstat_proc.c 2001/08/03 00:12:15
@@ -115,6 +115,7 @@
{
stat_is_init = 1;
setup();
+ alarm(0);
updatestat();
(void) signal(SIGALRM, updatestat);
alarm(1);
@@ -203,6 +204,7 @@
#ifdef DEBUG
fprintf(stderr, "about to closedown\n");
#endif
+ kvm_close(kd);
if (from_inetd)
exit(0);
else {
State Changed From-To: open->closed Fixed in libexec/rpc.rstatd 1.15, MFC after 4.4 |