Date: Wed, 18 Dec 2002 13:37:05 +0200 (EET) From: "Oleg V. Nauman" <oleg@reis.zp.ua> To: FreeBSD-gnats-submit@FreeBSD.org Subject: bin/46352: Open file descriptors and signal handling in the child login process Message-ID: <200212181137.gBIBb53K050362@core.zp.ua>
next in thread | raw e-mail | index | archive | help
>Number: 46352 >Category: bin >Synopsis: Open file descriptors and signal handling in the child login process >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Wed Dec 18 03:40:01 PST 2002 >Closed-Date: >Last-Modified: >Originator: Oleg V. Nauman <oleg@reis.zp.ua> >Release: FreeBSD 4.7-STABLE i386 >Organization: ReIS Ltd. >Environment: >Description: Child login process in STABLE leaves open file descriptors associated with terminal and has some problems with signals handling. >How-To-Repeat: Log in on the terminal line, start pppd and then kill -HUP pppd This leaves some errors in the ppp log file, such as: pppd: ioctl (PPPIOCGFLAGS): Inappropriate ioctl for device pppd: ioctl (PPPIOCGFLAGS): Inappropriate ioctl for device pppd: ioctl(PPPIOCSASYNCMAP): Inappropriate ioctl for device pppd: Couldn't restore device fd flags: Inappropriate ioctl for device pppd: ioctl(TIOCSETD): Inappropriate ioctl for device pppd: tcsetattr: Inappropriate ioctl for device >Fix: --- /usr/src/usr.bin/login/login.c Thu Mar 14 18:16:16 2002 +++ login.c Mon Dec 16 22:45:05 2002 @@ -632,6 +633,17 @@ } else if (pid) { /* parent - wait for child to finish, then cleanup session */ + fpurge(stdin); + close(STDIN_FILENO); + fpurge(stdout); + close(STDOUT_FILENO); + fpurge(stderr); + close(STDERR_FILENO); + (void)signal(SIGHUP, SIG_IGN); + (void)signal(SIGALRM, SIG_IGN); + (void)signal(SIGQUIT, SIG_IGN); + (void)signal(SIGINT, SIG_IGN); + wait(NULL); PAM_END; exit(0); As I understand, this is NOT better fix for signal handling problem. But it works for me and leaves for kill(0, SIG...) from pppd much smaller window for signal handling races in the current process group. >Release-Note: >Audit-Trail: >Unformatted: Environment: System: FreeBSD core.zp.ua 4.7-STABLE FreeBSD 4.7-STABLE #0: Mon Oct 28 21:50:40 EET 2002 root@core.zp.ua:/usr/src/sys/compile/core i386 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200212181137.gBIBb53K050362>