Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp2162015ybz; Thu, 23 Apr 2020 12:42:49 -0700 (PDT) X-Google-Smtp-Source: APiQypJ1fjTrRDYW96aUyb4skUh2AyiMC+FyPpC3V2JNDK1AXorqfEHzaik6+lBh7g9VJdcSWOmx X-Received: by 2002:a17:906:1e47:: with SMTP id i7mr4147136ejj.61.1587670968975; Thu, 23 Apr 2020 12:42:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587670968; cv=none; d=google.com; s=arc-20160816; b=Vith8mnkWKQbUZgo/R3LEPX3TdafkE1vLs2IZaYhXRmtoUO6zLCS9V5BWgFjtjFz67 JnPMrId7sfxjkgQUgK4Ka27kzC63hKQCYvsAgRHFtefOyiKZbeWHtXQPWvCHT5zqKeLB fmFK35lz3mMqYfE0H/hexF2FugdJzH9QCFjJxZ9TMdAk1zdm5coA/tX8g8eG8vKWLz3Q baBq26vhrqSc2BBP9kRrtrotjLbR7LIk2ihZoPUt7T3UITyAozPjhi6MeHTDxngGjI6Q TkTqAaZqC5qxNST5vaNZdENWRa+mu9zveuyJ3+K2p3crfI6q/D9yRC8LjnTuW509wHX3 eSAA== 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=wEJbXUDJkpYa9ECGAVqHJHBlYw3IMWucQjzLlAtyiV4=; b=h9w6DJMkivVwlTYhU/wH1/krd8yLKecjQnY8nPreSo0J2JllHQ+SfUoGrTA10opRsR U+TVlPYXhSVeM0IU125moRtTLPYYu/rpQSRVqPlWwk2kyxoi8h36uAXDk6vSDbFSgCSm eOpTR75IMilxnUscfkfp5gVyMl4qXf+4ogAKQqOU/VnKkvRzBS/GA3C0AuWRwiZ2y//1 z5HicCIMxudivyStBKqYBKdvHym0kkGAGzJtGf/0SzpeUDT1EhoZ1cRsUhQjvQKp+1xu 3ZvzEnnP3jBhxmso+uDN3VN0U55KgDL0RR3v/WmPUyZ9v+KNv6bmgNInTuXjDAQ84ecy WLLg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f8si1920687ejt.461.2020.04.23.12.42.17; Thu, 23 Apr 2020 12:42:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728782AbgDWTeG (ORCPT + 99 others); Thu, 23 Apr 2020 15:34:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35190 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728308AbgDWTeG (ORCPT ); Thu, 23 Apr 2020 15:34:06 -0400 Received: from fieldses.org (fieldses.org [IPv6:2600:3c00::f03c:91ff:fe50:41d6]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3E81FC09B042 for ; Thu, 23 Apr 2020 12:34:06 -0700 (PDT) Received: by fieldses.org (Postfix, from userid 2815) id 757D414DC; Thu, 23 Apr 2020 15:34:05 -0400 (EDT) Date: Thu, 23 Apr 2020 15:34:05 -0400 From: Bruce Fields To: Chuck Lever Cc: Trond Myklebust , Jeff Layton , Linux NFS Mailing List Subject: Re: GSS unwrapping breaks the DRC Message-ID: <20200423193405.GB4561@fieldses.org> References: <20200415192542.GA6466@fieldses.org> <0775FBE7-C2DD-4ED6-955D-22B944F302E0@oracle.com> <20200415215823.GB6466@fieldses.org> <39815C35-EAD8-4B2E-B48F-88F3D5B10C57@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org On Fri, Apr 17, 2020 at 05:48:35PM -0400, Chuck Lever wrote: > I've hit a snag here. > > I reverted 241b1f419f0e on my server, and all tests completed > successfully. > > I reverted 241b1f419f0e on my client, and now krb5p is failing. Using > xdr_buf_trim does the right thing on the server, but on the client it > has exposed a latent bug in gss_unwrap_resp_priv() (ie, the bug does > not appear to be harmful until 241b1f419f0e has been reverted). > > The calculation of au_ralign in that function is wrong, and that forces > rpc_prepare_reply_pages to allocate a zero-length tail. xdr_buf_trim() > then lops off the end of each subsequent clear-text RPC message, and > eventually a short READ results in test failures. > > After experimenting with this for a day, I don't see any way for > gss_unwrap_resp_priv() to estimate au_ralign based on what gss_unwrap() > has done to the xdr_buf. The kerberos_v1 unwrap method does not appear > to have any trailing checksum, for example, but v2 does. > > The best approach for now seems to be to have the pseudoflavor-specific > unwrap methods return the correct ralign value. A straightforward way > to do this would be to add a *int parameter to ->gss_unwrap that would > be set to the proper value; or hide that value somewhere in the xdr_buf. > > Any other thoughts or random bits of inspiration? No. Among other things, a quick skim wasn't enough to remind me what au_ralign is and why we have both that and au_rslack.... Sorry! I've got not much to offer but sympathy. ... I have a random thought out of left field: after the xdr_stream conversion, fs/nfs/nfs4xdr.c mostly doesn't deal directly with the reply buffer any more. It calls xdr_inline_decode(xdr, n) and gets back a pointer to the next n bytes of rpc data. Or it calls xdr_read_pages() after which read data's supposed to be moved to the right place. Would it be possible to delay rpcsec_gss decoding until then? Would that make things simpler or more complicated? Eh, I think the answer is probably "more complicated". --b.