From sa@gw2.svzserv.kemerovo.su  Mon Mar 10 22:24:59 2003
Return-Path: <sa@gw2.svzserv.kemerovo.su>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 4A59637B401
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 10 Mar 2003 22:24:59 -0800 (PST)
Received: from gw2.svzserv.kemerovo.su (gw2.svzserv.kemerovo.su [213.184.65.69])
	by mx1.FreeBSD.org (Postfix) with ESMTP id C611E43F93
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 10 Mar 2003 22:24:57 -0800 (PST)
	(envelope-from sa@gw2.svzserv.kemerovo.su)
Received: from gw2.svzserv.kemerovo.su (localhost [127.0.0.1])
	by gw2.svzserv.kemerovo.su (8.12.7/8.12.7) with ESMTP id h2B6Os8L056405
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 11 Mar 2003 13:24:54 +0700 (KRAT)
	(envelope-from sa@gw2.svzserv.kemerovo.su)
Received: (from root@localhost)
	by gw2.svzserv.kemerovo.su (8.12.7/8.12.7/Submit) id h2B6OsXP056404;
	Tue, 11 Mar 2003 13:24:54 +0700 (KRAT)
Message-Id: <200303110624.h2B6OsXP056404@gw2.svzserv.kemerovo.su>
Date: Tue, 11 Mar 2003 13:24:54 +0700 (KRAT)
From: Eugene Grosbein <eugen@grosbein.pp.ru>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: cron(8) may segfault when system open file table is full
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         49096
>Category:       bin
>Synopsis:       cron(8) may segfault when system open file table is full
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    silby
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Mar 10 22:30:04 PST 2003
>Closed-Date:    Tue Jun 24 19:46:14 PDT 2003
>Last-Modified:  Tue Jun 24 19:46:14 PDT 2003
>Originator:     Eugene Grosbein
>Release:        FreeBSD 4.8-RC i386
>Organization:
Svyaz Service JSC
>Environment:
System: FreeBSD gw2.svzserv.kemerovo.su 4.8-RC FreeBSD 4.8-RC #12: Tue Mar 4 02:15:40 KRAT 2003 sa@gw2.svzserv.kemerovo.su:/usr/obj/usr/src/sys/GW2 i386

>Description:
	I've found that cron(8) can segfault easily when a system
	table of open files is full or nearly full. I tried to rebuild
	cron with -O0 -g to analyze core dump, reproduced the problem
	but stack seems to be corrupted completely and gdb does not help.

>How-To-Repeat:
	Run 'sysctl -a | grep files'. Make kern.maxfilesfiles and
	kern.maxfilesperproc so small that kernel table would be nearly full.
	Wait for cron to segfault.

>Fix:

	Unknown for me.

	Eugene Grosbein
>Release-Note:
>Audit-Trail:

From: Dmitry Sivachenko <mitya@cavia.pp.ru>
To: freebsd-gnats-submit@FreeBSD.org
Cc: eugen@grosbein.pp.ru
Subject: Re: bin/49096: cron(8) may segfault when system open file table is full
Date: Wed, 30 Apr 2003 18:45:33 +0400

 Does the following patch fix the problem?
 
 
 --- do_command.c.orig	Fri May  4 04:59:40 2001
 +++ do_command.c	Wed Apr 30 18:41:48 2003
 @@ -369,13 +369,14 @@ child_process(e, u)
  
  	/*local*/{
  		register FILE	*in = fdopen(stdout_pipe[READ_PIPE], "r");
 -		register int	ch = getc(in);
 +		register int	ch;
  
  		if (in == NULL) {
  			warn("fdopen failed in child");
  			_exit(ERROR_EXIT);
  		}
  
 +		ch = getc(in);
  		if (ch != EOF) {
  			register FILE	*mail;
  			register int	bytes = 1;
Responsible-Changed-From-To: freebsd-bugs->silby 
Responsible-Changed-By: silby 
Responsible-Changed-When: Thu Jun 19 11:16:10 PDT 2003 
Responsible-Changed-Why:  
Looks like I'll be committing this. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=49096 
State-Changed-From-To: open->closed 
State-Changed-By: silby 
State-Changed-When: Tue Jun 24 19:45:55 PDT 2003 
State-Changed-Why:  
Fix committed to -current and -stable. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=49096 
>Unformatted:
