From owner-freebsd-bugs Sun Nov 24 0:40: 7 2002 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id EADE337B401 for ; Sun, 24 Nov 2002 00:40:04 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id E1A6243EA3 for ; Sun, 24 Nov 2002 00:40:03 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.6/8.12.6) with ESMTP id gAO8e3x3094039 for ; Sun, 24 Nov 2002 00:40:03 -0800 (PST) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id gAO8e3l6094038; Sun, 24 Nov 2002 00:40:03 -0800 (PST) Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3075937B401 for ; Sun, 24 Nov 2002 00:36:10 -0800 (PST) Received: from lambda.foldr.org (lambda.foldr.org [198.78.66.36]) by mx1.FreeBSD.org (Postfix) with ESMTP id 61A8343E88 for ; Sun, 24 Nov 2002 00:36:04 -0800 (PST) (envelope-from vs@foldr.org) Received: from theater.foldr.org (pD95099FD.dip.t-dialin.net [217.80.153.253]) by lambda.foldr.org (8.12.3/8.11.6) with ESMTP id gAO8ZljN028222 (using TLSv1/SSLv3 with cipher EDH-RSA-DES-CBC3-SHA (168 bits) verified OK) for ; Sun, 24 Nov 2002 09:35:52 +0100 (CET) (envelope-from vs@foldr.org) Received: from monster.theater.foldr.org (monster.theater.foldr.org [IPv6:3ffe:b80:2de:3:2e0:29ff:fe98:abca]) by theater.foldr.org (8.12.5/8.12.5) with ESMTP id gAO8a2Ba057222 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=OK) for ; Sun, 24 Nov 2002 09:36:03 +0100 (CET) (envelope-from vs@monster.theater.foldr.org) Received: (from vs@localhost) by monster.theater.foldr.org (8.12.6/8.12.6/Submit) id gAO8ZeMs003709; Sun, 24 Nov 2002 09:35:40 +0100 (CET) (envelope-from vs) Message-Id: <200211240835.gAO8ZeMs003709@monster.theater.foldr.org> Date: Sun, 24 Nov 2002 09:35:40 +0100 (CET) From: Volker Stolz Reply-To: Volker Stolz To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Subject: bin/45669: pam_ssh fails in presence of SIGCHLD handlers Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >Number: 45669 >Category: bin >Synopsis: pam_ssh fails in presence of SIGCHLD handlers >Confidential: no >Severity: serious >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sun Nov 24 00:40:03 PST 2002 >Closed-Date: >Last-Modified: >Originator: Volker Stolz >Release: FreeBSD 5.0-CURRENT i386 >Organization: Lehrstuhl für Informatik II >Environment: System: FreeBSD monster.theater.foldr.org 5.0-CURRENT FreeBSD 5.0-CURRENT #1: Wed Nov 13 19:42:10 CET 2002 root@monster.ikea.net:/usr/src/sys/i386/compile/MONSTER i386 >Description: The pam_ssh module uses popen() to start an ssh-agent for the user during PAM authentication. However, pclose() causes the pam-module to return an error if somebody else already called waitpid(-1,...) because now pclose returns -1 and errno is set to ECHILD (observed with gdm who uses a whole bunch of processes). >How-To-Repeat: Install gdm, enable pam_ssh & try to login: You will get a login error an the first try because the pam_module fails on pclose(). If you try for a second time, now PAM will reuse the already running ssh-agent and let you in since it doesn't have to take the popen/pclose path. >Fix: Either use signal(SIGCHLD,SIG_DFL) before invoking popen() (tested here, works) or make the pclose() fail more gracefully when ECHILD is returned. For the latter case, I'm not sure if this combination of -1/ECHILD can be caused by a real, fatal error. Although the first solution is not bullet proof in cases where other processes are repeatedly wait()ing, it least provides a viable workaround because as is the case with gdm they do so in SIGCHLD handlers. [When debugging/reproducing this, make sure you remove ~/.ssh/agent-* between runs!] >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message