From owner-freebsd-arch Sat Oct 5 2:29:12 2002 Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4511837B401; Sat, 5 Oct 2002 02:29:10 -0700 (PDT) Received: from gw.catspoiler.org (217-ip-163.nccn.net [209.79.217.163]) by mx1.FreeBSD.org (Postfix) with ESMTP id BD00D43E42; Sat, 5 Oct 2002 02:29:09 -0700 (PDT) (envelope-from dl-freebsd@catspoiler.org) Received: from mousie.catspoiler.org (mousie.catspoiler.org [192.168.101.2]) by gw.catspoiler.org (8.12.5/8.12.5) with ESMTP id g959T1vU023691; Sat, 5 Oct 2002 02:29:05 -0700 (PDT) (envelope-from dl-freebsd@catspoiler.org) Message-Id: <200210050929.g959T1vU023691@gw.catspoiler.org> Date: Sat, 5 Oct 2002 02:29:01 -0700 (PDT) From: Don Lewis Subject: Re: [jmallett@FreeBSD.org: [PATCH] Reliable signal queues, etc., [for review]] To: jmallett@FreeBSD.ORG Cc: dl-freebsd@catspoiler.org, arch@FreeBSD.ORG In-Reply-To: <20021005011257.A16980@FreeBSD.org> MIME-Version: 1.0 Content-Type: TEXT/plain; charset=us-ascii Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On 5 Oct, Juli Mallett wrote: > * De: Don Lewis [ Data: 2002-10-05 ] > [ Subjecte: Re: [jmallett@FreeBSD.org: [PATCH] Reliable signal queues, etc., [for review]] ] >> On 5 Oct, Juli Mallett wrote: >> > To >> > accomodate situations where allocation of a 'ksiginfo' is a failure >> > mode (no memory), the destination process is told to exit via a new >> > member of 'struct proc', p_suicide, which tells a process to kill itself >> > next time it goes through userret. >> >> I hope that doesn't happen when I fg my editor ... > > In this situation (can't allocate 64 bytes) you're screwed if you have an > editor in the background, coming to the foreground, anyway. A lot of things that receive SIGCHLD, such as shells and inetd could also be affected a temporary shortage of kmem. Somehow it seems wasteful to have to allocate kmem to deliver SIGKILL. How is an ordinary userland program prevented from consuming all of kmem by blocking signal delivery and looping on kill()? Does a quota system need to be added? The following code never sets error to anything other than zero. It also looks like it is missing a return statement for the malloc() failed case. +int +ksiginfo_alloc(struct ksiginfo **ksip, struct proc *p, int signo) +{ + int error; + struct ksiginfo *ksi; + + error = 0; + + PROC_LOCK_ASSERT(p, MA_NOTOWNED); + ksi = malloc(sizeof *ksi, M_KSIGINFO, M_ZERO | M_NOWAIT); + if (ksi == NULL) { + PROC_LOCK(p); + p->p_suicide = 1; + PROC_UNLOCK(p); + } + ksi->ksi_signo = signo; + if (curproc != NULL) { + ksi->ksi_pid = curproc->p_pid; + ksi->ksi_ruid = curproc->p_ucred->cr_uid; + } + *ksip = ksi; + return (error); +} To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message