Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp3709370ybg; Fri, 25 Oct 2019 07:55:44 -0700 (PDT) X-Google-Smtp-Source: APXvYqzYsnpQoXHZSNC0OottJ4ZAWmsbfVaLrjyDulskmK4fGqj3SoLM/ioHZSDSS3P/VbeL9iOu X-Received: by 2002:a17:907:2130:: with SMTP id qo16mr3885575ejb.183.1572015344183; Fri, 25 Oct 2019 07:55:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572015344; cv=none; d=google.com; s=arc-20160816; b=U0U70GBTbZIudl5dDT2FKaE4ZeeHkwcnlsBJ18pppgG0ZcFiAuXd3nhqdhkr237dzc nHPr5bDjVSlSiIUPkdnAlFEciZhhJL2/wouaMpLSj/y3m2POzuMtXLqBS0nsAFqGTCAL yAsbOlSgzxD84WhjofREwO8CEOKrF4e+mxIC+RGPk9iNuck4v/jNM+3ZADx/Ck65e/oK VkwMsHD4cvGN09A4WqUxAO+P1AWdAKlYxCUzknPtjefKpHrvakTwGRxoVNWKr1Bw1N2x O8Vi2sjSKVUFIr8Z9ysaK8XIoGq1Ky1hoN91h04fXTjYA3lYL/6iQMu8lL0/hIr0+IXp FAJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=n2s2+OTlmIW/d1PsS5EQsCEFOkdJELm8wiSwgPfUQ5M=; b=AFacmsaiTe3eJl4GcNEM6qzmuDdw+fi3ecMC4mlezJ2pyqr8PVFtkiy4vzqH9NlyUh gDSi1q4c8WHApQLI0gdHqwkMPhs+1vgmVGWzNmVGpUDURUUmmSZP8DXCo7oZqCYiFvoF nqSolfjQwVfcGxgwim85VTbTgh8sDMu096jLITX2gC7Y5EI2WZaeqm5vvNXeS90ux4Kz VVJkkN3hwfJqzjJ02Abq4T/xXX3YZXHJ09TqyLrb783q9YX/4/G8kfRB28M7yMpjJuB5 ppPDrlKBJoARLqZy6IxfB/ZEcmHdtgk87V0VGkU5YipmBb11T5lqnfEGsLLsmmtQS6rB aQqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=DaZjsFa6; 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=pass (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 r2si1280959ejz.204.2019.10.25.07.55.12; Fri, 25 Oct 2019 07:55:44 -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; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=DaZjsFa6; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2503984AbfJXSF0 (ORCPT + 99 others); Thu, 24 Oct 2019 14:05:26 -0400 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:46810 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2503978AbfJXSF0 (ORCPT ); Thu, 24 Oct 2019 14:05:26 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1571940325; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=n2s2+OTlmIW/d1PsS5EQsCEFOkdJELm8wiSwgPfUQ5M=; b=DaZjsFa6uQWuLhsEM1oJ2tOmYTmy92I6L2WxaPVnhok2Cf+WrLIA0cg3Cc1KkIY5GogMQ5 PK42wzjbtm6UcKbVhVFRckJv2caYjFiZUziEEgSWpfh5SsDRfh6BllWhdrOTIiuJoa7+NR 4s5Vu7dXhPNfkHrJdtoJHbTizIunU4A= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-248-ppsrEca3PQefowPjkadn0Q-1; Thu, 24 Oct 2019 14:05:23 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id DB882107AD31 for ; Thu, 24 Oct 2019 18:05:22 +0000 (UTC) Received: from madhat.boston.devel.redhat.com (ovpn-118-15.phx2.redhat.com [10.3.118.15]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8FB9560BE3; Thu, 24 Oct 2019 18:05:22 +0000 (UTC) Subject: Re: [nfs-utils PATCH v3] gssd: daemonize earlier To: Scott Mayhew Cc: linux-nfs@vger.kernel.org References: <20191017150844.21045-1-smayhew@redhat.com> From: Steve Dickson Message-ID: <3d4df712-d1e9-e46c-26a2-8ed75e681dc0@RedHat.com> Date: Thu, 24 Oct 2019 14:05:22 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.1.1 MIME-Version: 1.0 In-Reply-To: <20191017150844.21045-1-smayhew@redhat.com> Content-Language: en-US X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-MC-Unique: ppsrEca3PQefowPjkadn0Q-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org On 10/17/19 11:08 AM, Scott Mayhew wrote: > daemon_init() calls closeall() which closes all fd's >=3D 4. This causes > rpc.gssd to fail when it's configured to use the gssproxy interposer > plugin (via "use-gss-proxy=3D1" in nfs.conf or GSS_USE_PROXY=3D"yes" in t= he > environment) *and* libtirpc debugging is enabled (i.e. at least one > "-r" on the command line): >=20 > 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 >=3D 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=3D4, and -EBADF is > returned. gssd logs the message ""ERROR: event_dispatch() returned!" > and exits. >=20 > The solution is to call daemon_init() earlier. >=20 > Signed-off-by: Scott Mayhew Committed...=20 steved. > --- > utils/gssd/gssd.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) >=20 > 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[]) > =09=09=09 "support setting debug levels\n"); > #endif > =20 > +=09daemon_init(fg); > + > =09if (gssd_check_mechs() !=3D 0) > =09=09errx(1, "Problem with gssapi library"); > =20 > -=09daemon_init(fg); > - > =09event_init(); > =20 > =09pipefs_dir =3D opendir(pipefs_path); >=20