Received: by 10.213.65.68 with SMTP id h4csp683203imn; Wed, 28 Mar 2018 10:49:10 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+A6O/qE/sFxWk3e/k6CWeTuVhxcXz9FpYjboKjIsBak264yxaA6XOBJ0NX/cN/ul43DyZ2 X-Received: by 2002:a17:902:2ac3:: with SMTP id j61-v6mr4741631plb.224.1522259350584; Wed, 28 Mar 2018 10:49:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522259350; cv=none; d=google.com; s=arc-20160816; b=hGw6mxHxolR5JCGOGXDj9AUAL47n2kgSwNY4+NAocgD6+syULnCGZ1ct4sYM42CU0F rPGmevjLCQqq79rvtBY79+GFipKeuXe0+3HD4wnJRCSDImRnGktxHDC47US31M7lALUi bIvhpMQKEa036KrJPHxtEjdKOFw/va2NU/OZKBVoueWCsyWl7F2f+dJGdePkFJ4yxjMt 7HpbjgyK/fMOccf0KWR3V+v4aaslpsFYcm4xbLHlGy+6QeTgqI+onq+MtjTTGH0jUw+Z uMa+EcOUv9qC8KHnAfKEYj7dFRohnGta93qUv1ScAhGdCfKBMd0XWVxq7LFpn7QMARfw hf+w== 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:dkim-signature:arc-authentication-results; bh=1wjHJrljc9QgsE0cyMBejInMD6dKF1AjR91z5XUffGQ=; b=aZLSz8NQr5RrQnJnUBffVRXDBEvRCyohB2trpTiDvm3DlDlV20YbNjJhUE7QkLZnA4 WRenznPD72VFJPB1exZxJdt2R1Y6VTzZflV+fDiobhs4Qyz4++5ycuM/FjkyIhVdznZa zMTdcVTyRp7FToRGMSo2fs0L6wgIsgM27KnnFrBzPU1qr8wB4r1x0vr6mKR1FizrziD6 OFnzIHXRpcUopoxCcw4jHkqdfwLVD4JsPIN+gr/sgnDZOZTI476Pfmnz8njLfoRV7kyW MYvWwOR9BT8UUKuHM062skgnChaM+oDUzgSIqkLTFjtak5ig89dwsdMX4hRvG/c+qNl4 +rAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=tuBxafwP; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z1-v6si3936173plb.101.2018.03.28.10.48.56; Wed, 28 Mar 2018 10:49:10 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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=@google.com header.s=20161025 header.b=tuBxafwP; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753096AbeC1RsC (ORCPT + 99 others); Wed, 28 Mar 2018 13:48:02 -0400 Received: from mail-pg0-f47.google.com ([74.125.83.47]:41336 "EHLO mail-pg0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752457AbeC1RsB (ORCPT ); Wed, 28 Mar 2018 13:48:01 -0400 Received: by mail-pg0-f47.google.com with SMTP id t10so1231779pgv.8 for ; Wed, 28 Mar 2018 10:48:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=1wjHJrljc9QgsE0cyMBejInMD6dKF1AjR91z5XUffGQ=; b=tuBxafwPJnhdUb+JVEmxQDCAgflOJVDZjwmyeiSuABO+PaN4lEheVyPuDbw8h6Y3Gf QL1VAUQHirm0HZx6QZMAsyvNwHv8ocZx44CFX7Jxis/0EbYHWW2zCwK4wfPcbgWIIaS5 pQSFxdnyshAMkVN+Fc9KhqXfmE6qzkqF4/XxoasnUPJr0JXUUI9cgZ25eormvAqZWPNZ 7Ag9XGvYua9+5Ez1CjkrNih412lklOGSSyaUTnmSIjB4v+zVix/cyTXxfbQGm0nseFBf AQHZyH0nFK8hajdtU1FIxvUpb87gHTy4q4BrignnzJmIJRNX5lMgKxdcVPQzDUlBOW/G Ec2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=1wjHJrljc9QgsE0cyMBejInMD6dKF1AjR91z5XUffGQ=; b=J21F9H2RWfF7dNQLDcxjWLZa1jpM6uNFrjnGfmbAZUTIcktSLVR0ntFvplM3cUPHYH 4YAeSYTSetUkRjTIQsZ1cj4zrKRk3nFhlnAXrmVgkCHUN05QQWM7fOuGtCZuEbio2mlW Qwc4NC3rqtj35Z7RHq2qsPD36idRJjBOueA77OJyhdGqBVAeNrlkNrNDV4xL8dLDMRmG lN0jgCRP5UaRSGoBRo2GRS5qfGdyen6DeH/KlQhRQzEd4V6p5tRCczk/P/b/19LFcv6v 5rZ62Wdk+jv97RVTuX3iMwgQRbio1oyT4HG8vS9TFzrQ/SKr0NxVSH9eyqcI2mG4+NHK 4Pdg== X-Gm-Message-State: AElRT7EibK3Hm03ox7lXsAWm4TtxzEl7hPHL/FFFDaFPX2d7jKbwRBu3 +M9trX5M6hQbcnEBPz7+YZN44w== X-Received: by 10.98.200.82 with SMTP id z79mr3754600pff.45.1522259279914; Wed, 28 Mar 2018 10:47:59 -0700 (PDT) Received: from google.com ([2620:15c:17:3:dc28:5c82:b905:e8a8]) by smtp.gmail.com with ESMTPSA id 76sm7533319pge.5.2018.03.28.10.47.58 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 28 Mar 2018 10:47:58 -0700 (PDT) Date: Wed, 28 Mar 2018 10:47:57 -0700 From: Eric Biggers To: M A Young Cc: Herbert Xu , "J. Bruce Fields" , Jeff Layton , Trond Myklebust , Anna Schumaker , linux-nfs@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: NFS mounts failing when keytab present on client Message-ID: <20180328174757.GA185597@google.com> References: <20180327222950.GB257332@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 28, 2018 at 09:00:14AM +0100, M A Young wrote: > On Tue, 27 Mar 2018, Eric Biggers wrote: > > > Hi Michael, > > > > On Tue, Mar 27, 2018 at 11:06:14PM +0100, Michael Young wrote: > > > NFS mounts stopped working on one of my computers after a kernel update from > > > 4.15.3 to 4.15.4. I traced the problem to the commit > > > [46e8d06e423c4f35eac7a8b677b713b3ec9b0684] crypto: hash - prevent using > > > keyed hashes without setting key > > > and a later kernel with this patch reverted works normally. > > > > > > The problem seems to be related to kerberos as the mount fails when the > > > keytab is present, but works if I rename the keytab file. This is true even > > > though the mount is with sec=sys . The mount should also work with sec=krb5 > > > but that also fails in the same way. When the mount fails there are errors > > > in dmesg like > > > [ 1232.522816] gss_marshal: gss_get_mic FAILED (851968) > > > [ 1232.522819] RPC: couldn't encode RPC header, exit EIO > > > [ 1232.522856] gss_marshal: gss_get_mic FAILED (851968) > > > [ 1232.522857] RPC: couldn't encode RPC header, exit EIO > > > [ 1232.522863] NFS: nfs4_discover_server_trunking unhandled error -5. > > > Exiting with error EIO > > > [ 1232.525039] gss_marshal: gss_get_mic FAILED (851968) > > > [ 1232.525042] RPC: couldn't encode RPC header, exit EIO > > > > > > Michael Young > > > > Thanks for the bug report. I think the error is coming from > > net/sunrpc/auth_gss/gss_krb5_crypto.c. There are two potential problems I see. > > The first one, which is definitely a bug, is that make_checksum_hmac_md5() > > allocates an HMAC transform and request, then does these crypto API calls: > > > > crypto_ahash_init() > > crypto_ahash_setkey() > > crypto_ahash_digest() > > > > This is wrong because it makes no sense to init() the HMAC request before the > > key has been set, and doubly so when it's calling digest() which is shorthand > > for init() + update() + final(). So I think it just needs to be removed. You > > can test the following patch: > > > > diff --git a/net/sunrpc/auth_gss/gss_krb5_crypto.c b/net/sunrpc/auth_gss/gss_krb5_crypto.c > > index 12649c9fedab..8654494b4d0a 100644 > > --- a/net/sunrpc/auth_gss/gss_krb5_crypto.c > > +++ b/net/sunrpc/auth_gss/gss_krb5_crypto.c > > @@ -237,9 +237,6 @@ make_checksum_hmac_md5(struct krb5_ctx *kctx, char *header, int hdrlen, > > > > ahash_request_set_callback(req, CRYPTO_TFM_REQ_MAY_SLEEP, NULL, NULL); > > > > - err = crypto_ahash_init(req); > > - if (err) > > - goto out; > > err = crypto_ahash_setkey(hmac_md5, cksumkey, kctx->gk5e->keylength); > > if (err) > > goto out; > > > > If that's not it, it's also possible that the error is coming from the > > crypto_ahash_init() in make_checksum(). That can only happen if 'cksumkey' is > > NULL and the hash algorithm is keyed, which implies a logical error as it > > doesn't make sense to use a keyed hash algorithm without the key. The callers > > do check kctx->gk5e->keyed_cksum which I'd hope would prevent this, though > > perhaps kctx->cksum can be NULL. > > > > Eric > > The patch fixes the problem. > > Michael Young Okay, thanks for testing! I'll send a formal patch. Eric