Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp1191698ybg; Fri, 18 Oct 2019 13:32:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqwEi2W3ZY0Ub6G/kInCm5luUwZPQ3BXGcCnemvfhXFB8Rf3dyS2LB3CnAQya5BT+Nt4CsPY X-Received: by 2002:a50:af45:: with SMTP id g63mr11606202edd.21.1571430722918; Fri, 18 Oct 2019 13:32:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571430722; cv=none; d=google.com; s=arc-20160816; b=I3vodWBwg36Pw3SqZO2W96LH2mlHnmM4OkfCzwVJTgI0vmaUAssvh7nakRSObZCzig iDi6XW9jNtCoNkTwUc9UTlnnz3GSyjN6NXh0MrYuFE1iNEk+5itce3kUJjnORhJ4CcOq 8utPYhcvAgR0iuoLtvIVFyKKPENI7bvVUe4JcRUGx5y8tsrDV1SG1Bdyvj3CV3ZmYpCe H3fgJG5AzPSLcLsZssfkCQOhMMTXMw4qiI01EgGAZ/UaLv3LyaAu9ivqUDt36TiUZrrY UYagui7vVeNyKMtT47/17S0KZ8VCyEjFsHKXOsealbTLS7Wi0iAS+k1KqR1/gGW+eLu2 +56A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=AXWS/TZ/ttodSUU5rHzpiQvkvt73pKv2Sb4pZjWr7hA=; b=FHsm77E+iuSk0RaTSLls9qRWzo21HWsqT4++/dRA/tvxevJJtl9qnbRWBsNrFZTWET K0F+4pDxChU57JRVTEKXnVek09jva52fbEvAO0R5ot6Ob7GXYqVg+p4h6HDi1oQUrtOU VtWPNWSLXlyLrJuW/XQSOiWDiEtBqRS8HhFv1Ij4uk9TW5TQxrQFF+Nr8XVMpmLgji15 FFEU8slBL4LE3yXnqu+pD3q87UVgtOZ+kR6qa1JAED6jjdOjFdlp+aES7LeXdCkxLNa9 xBAFowCXys5U9d1QyqDKR9F+wKQWGHEuOVnSW22vVFGNmuIqw1yQku1eEWLtuycz5G5+ qOug== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p38si4630720edc.449.2019.10.18.13.31.38; Fri, 18 Oct 2019 13:32:02 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2438683AbfJQP03 (ORCPT + 99 others); Thu, 17 Oct 2019 11:26:29 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34128 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2438633AbfJQP03 (ORCPT ); Thu, 17 Oct 2019 11:26:29 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EC28810DCCA3 for ; Thu, 17 Oct 2019 15:26:28 +0000 (UTC) Received: from coeurl.usersys.redhat.com (ovpn-120-158.rdu2.redhat.com [10.10.120.158]) by smtp.corp.redhat.com (Postfix) with ESMTP id C81835C1D6; Thu, 17 Oct 2019 15:26:28 +0000 (UTC) Received: by coeurl.usersys.redhat.com (Postfix, from userid 1000) id 6F19720836; Thu, 17 Oct 2019 11:26:28 -0400 (EDT) Date: Thu, 17 Oct 2019 11:26:28 -0400 From: Scott Mayhew To: steved@redhat.com Cc: linux-nfs@vger.kernel.org Subject: Re: [nfs-utils PATCH v3] gssd: daemonize earlier Message-ID: <20191017152628.GA5017@coeurl.usersys.redhat.com.nfsv4bat.org> References: <20191017150844.21045-1-smayhew@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191017150844.21045-1-smayhew@redhat.com> User-Agent: Mutt/1.11.3 (2019-02-01) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.64]); Thu, 17 Oct 2019 15:26:28 +0000 (UTC) Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org Note this is v1 patch. I forgot to check my git config before creating the patch :) -Scott On Thu, 17 Oct 2019, Scott Mayhew wrote: > daemon_init() calls closeall() which closes all fd's >= 4. This causes > rpc.gssd to fail when it's configured to use the gssproxy interposer > plugin (via "use-gss-proxy=1" in nfs.conf or GSS_USE_PROXY="yes" in the > environment) *and* libtirpc debugging is enabled (i.e. at least one > "-r" on the command line): > > 1. During startup if rpc debugging is enabled then libtirpc_set_debug() > is called, which calls openlog() which consumes fd 3. > 2. If the gssproxy interposer plugin is enabled then when > gssd_check_mechs() is called, a socket is created (fd 4) and > connected to /var/lib/gssproxy/default.sock. The fd is stored > internally in a struct gpm_ctx. > 3. daemon_init() runs and closes all fd's >= 4. > 4. event_init() runs which calls epoll_create() which returns an epoll > fd of 4. > 5. Later when handling an upcall, gssd calls gssd_acquire_krb5_cred() > which winds up closing the gpm_ctx->fd which was 4. > 6. event_dispatch() calls epoll_wait() with epfd=4, and -EBADF is > returned. gssd logs the message ""ERROR: event_dispatch() returned!" > and exits. > > The solution is to call daemon_init() earlier. > > Signed-off-by: Scott Mayhew > --- > utils/gssd/gssd.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/utils/gssd/gssd.c b/utils/gssd/gssd.c > index 19ad4da..c38dedb 100644 > --- a/utils/gssd/gssd.c > +++ b/utils/gssd/gssd.c > @@ -1020,11 +1020,11 @@ main(int argc, char *argv[]) > "support setting debug levels\n"); > #endif > > + daemon_init(fg); > + > if (gssd_check_mechs() != 0) > errx(1, "Problem with gssapi library"); > > - daemon_init(fg); > - > event_init(); > > pipefs_dir = opendir(pipefs_path); > -- > 2.17.2 >