From owner-cvs-src Tue Mar 11 1: 4:30 2003 Delivered-To: cvs-src@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E010D37B401; Tue, 11 Mar 2003 01:04:21 -0800 (PST) Received: from exchhz01.viatech.com.cn (ip-167-164-97-218.anlai.com [218.97.164.167]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1103343F93; Tue, 11 Mar 2003 01:04:06 -0800 (PST) (envelope-from davidxu@freebsd.org) Received: from davidw2k (ip-240-1-168-192.rev.dyxnet.com [192.168.1.240]) by exchhz01.viatech.com.cn with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2650.21) id 1G6NW8WQ; Tue, 11 Mar 2003 16:50:41 +0800 Message-ID: <000501c2e7ad$48ab2790$f001a8c0@davidw2k> From: "David Xu" To: "Bruce Evans" Cc: , , References: <200303110010.h2B0ANe3061768@repoman.freebsd.org> <20030311180357.E23929@gamplex.bde.org> Subject: Re: cvs commit: src/usr.bin/su su.c Date: Tue, 11 Mar 2003 17:04:55 +0800 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4807.1700 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300 Sender: owner-cvs-src@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG ----- Original Message -----=20 From: "Bruce Evans" To: "David Xu" Cc: ; ; = Sent: Tuesday, March 11, 2003 3:59 PM Subject: Re: cvs commit: src/usr.bin/su su.c > On Mon, 10 Mar 2003, David Xu wrote: >=20 > > davidxu 2003/03/10 16:10:23 PST > > > > FreeBSD src repository > > > > Modified files: > > usr.bin/su su.c > > Log: > > Fix long standing job control bug. SIGTSTP shouldn't be ignored. > > Special instructions tested: > > suspend > > stop $$ >=20 > Er, this can't be right, since it removes the initialization of = sa_tstp > as a side effect, so sa_tstp is stack garbage when it is used set > SIGTSTP for the child. I think it may work because errors for the > second setting of SIGTSTP are ignored (all errors from sigaction are > ignored, of course :-(), and SIGTSTP is soon handled correctly by the > shell, but ignoring SIGTSTP was wrong for the inital su process. >=20 Unfortunately I had ignored code for child process :( BTW, The SIGTSTP handler will be reset by execsigs() in kernel, The garbage sa_tstp is only effective in very short time. > The bug is actually a shortstanding job control bug. SIGTSTP started = being > ignored in rev.1.53, in at attempt to work around the = not-so-shortstanding > PAM bug of gumming up job control by spawning shells instead of = exec'ing > them. su hasn't been PAMmed in RELENG_4, so the bug isn't in any = usable > release. >=20 > > Revision Changes Path > > 1.64 +0 -1 src/usr.bin/su/su.c >=20 > Rev.1.53 makes changes of +3 -1 for SIGTSTP. Backing out all these > changes would remove the use of stack garbage. But perhaps SIGTSTP > should have been set to SIG_DFL instead of SIG_IGN for the initial > su process, so su doesn't depend on its initial state. Then restoring > its initial state for child would be almost as dubious as "restoring" > stack garbage, so the sa_tstp variable is not needed eithe way. >=20 > Untested patches relative to relative to an old version: >=20 > ... > The patches also reduce nearby style bugs and add old code for = debugging > this problem. >=20 Thanks, I will test it, maybe commit if it is OK. > Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-src" in the body of the message