From owner-freebsd-current Sat Jan 25 11:40:25 2003 Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 99FEA37B401 for ; Sat, 25 Jan 2003 11:40:23 -0800 (PST) Received: from critter.freebsd.dk (critter.freebsd.dk [212.242.86.163]) by mx1.FreeBSD.org (Postfix) with ESMTP id C3BD743F18 for ; Sat, 25 Jan 2003 11:40:22 -0800 (PST) (envelope-from phk@freebsd.org) Received: from critter.freebsd.dk (localhost [127.0.0.1]) by critter.freebsd.dk (8.12.6/8.12.6) with ESMTP id h0PJeI8k012904; Sat, 25 Jan 2003 20:40:19 +0100 (CET) (envelope-from phk@freebsd.org) To: "Peter Edwards" Cc: freebsd-current@freebsd.org Subject: Re: Opening /dev/tty in session leader after controlling terminal is revoked causes panic. From: phk@freebsd.org In-Reply-To: Your message of "Sat, 25 Jan 2003 18:34:06 GMT." <20030125183411.997FE43F43@mx1.FreeBSD.org> Date: Sat, 25 Jan 2003 20:40:18 +0100 Message-ID: <12903.1043523618@critter.freebsd.dk> Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG In message <20030125183411.997FE43F43@mx1.FreeBSD.org>, "Peter Edwards" writes: >The problem is in kern/tty_tty.c:ctty_clone. It's assuming that if the process >has its P_CONTROLT flag set, then it's session has a valid vnode for it's >controlling terminal. This doesn't hold if the terminal was revoked. Can you try this patch ? Index: tty_tty.c =================================================================== RCS file: /home/ncvs/src/sys/kern/tty_tty.c,v retrieving revision 1.46 diff -u -r1.46 tty_tty.c --- tty_tty.c 19 Jan 2003 11:03:07 -0000 1.46 +++ tty_tty.c 25 Jan 2003 19:39:15 -0000 @@ -70,10 +70,12 @@ return; if (strcmp(name, "tty")) return; - if (curthread->td_proc->p_flag & P_CONTROLT) - *dev = curthread->td_proc->p_session->s_ttyvp->v_rdev; - else + if (!(curthread->td_proc->p_flag & P_CONTROLT)) + *dev = ctty; + else if (curthread->td_proc->p_session->s_ttyvp == NULL) *dev = ctty; + else + *dev = curthread->td_proc->p_session->s_ttyvp->v_rdev; } static void -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk@FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message