From owner-freebsd-current Sun Jul 21 16:52: 4 2002 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 C2B1E37B400 for ; Sun, 21 Jul 2002 16:51:59 -0700 (PDT) Received: from web20909.mail.yahoo.com (web20909.mail.yahoo.com [216.136.226.231]) by mx1.FreeBSD.org (Postfix) with SMTP id 8A2F543E5E for ; Sun, 21 Jul 2002 16:50:38 -0700 (PDT) (envelope-from bsddiy@yahoo.com) Message-ID: <20020721234347.4677.qmail@web20909.mail.yahoo.com> Received: from [218.108.153.73] by web20909.mail.yahoo.com via HTTP; Sun, 21 Jul 2002 16:43:47 PDT Date: Sun, 21 Jul 2002 16:43:47 -0700 (PDT) From: David Xu Subject: signal handling bug in KSE MIII To: Julian Elischer Cc: freebsd-current@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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 I found signal handling is still broken in CURRENT source. the following program demostrates the bug is still in kernel: #include #include void handler(int sig) { signal(SIGTSTP, SIG_DFL); kill(getpid(), SIGTSTP); } int main() { char buf[64]; signal(SIGTSTP, handler); kill(getpid(), SIGTSTP); printf("input foo:"); scanf("%63s", buf); printf("you input:%s\n", buf); return 0; } when I press CTRL+Z, the program does not suspend and directly exits. ktrace indicates that the program directly exits in kernel without calling exit() from program. I found SA_STOP handling is disabled in issignal(), delayed SIGTSTP is forgotten by kernel, this is the reason why SIGTSTP signal handling is broken. at least, one program is affected --- ftp, run ftp client program, when 'ftp>' prompt appears, pressing CTRL+Z, causes ftp to exit and do not suspend. patch: --- kern_sig.c.old Sun Jul 21 15:38:00 2002 +++ kern_sig.c Sun Jul 21 16:31:02 2002 @@ -1657,7 +1657,7 @@ #endif break; /* == ignore */ } -#if 0 + /* * If there is a pending stop signal to process * with default action, stop here, @@ -1679,16 +1679,10 @@ PROC_UNLOCK(p->p_pptr); mtx_lock_spin(&sched_lock); stop(p); - PROC_UNLOCK(p); - DROP_GIANT(); - p->p_stats->p_ru.ru_nivcsw++; - mi_switch(); mtx_unlock_spin(&sched_lock); - PICKUP_GIANT(); - PROC_LOCK(p); break; } else -#endif + if (prop & SA_IGNORE) { /* * Except for SIGCONT, shouldn't get here. David Xu __________________________________________________ Do You Yahoo!? Yahoo! Health - Feel better, live better http://health.yahoo.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message