Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp3643021ybl; Fri, 20 Dec 2019 12:57:54 -0800 (PST) X-Google-Smtp-Source: APXvYqyER/9VhLv8NpF362ltRVaEioOckRVFh7BM57YCj9YHVtGrceYw7RUQbT0/kzk08hsq5ypQ X-Received: by 2002:a9d:7a46:: with SMTP id z6mr17415446otm.194.1576875474590; Fri, 20 Dec 2019 12:57:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576875474; cv=none; d=google.com; s=arc-20160816; b=A/SBKgag+sBFfucFD78WMLXLMP6maC9Ku0JWAiRGpFxDUuVTMzA3M7fCvullQCZ74F WSatLE7x7OIn/i3JdPuTYXE+/0KiovOiIG5FOlk8x+dwt5oCgNUIFzYmwbnMLb+DK6wu xjqDMC16K8HJKkAwrcVWJ+SNTYrue4BZH8o0AgI4ngkEZ3CD4+67WnyGknVcEphdllvn A7OP8vpcqZtcbSA1Wb75wQUjgEJzcuOyYKXOqRvr5Q1XeojrIy7JTPcAIl/0vFMA2eAQ XWKHIaZH1dTVzKReJHvXZb/zU0OX/itW0val38ZgscxFPxDjsUD+fPjuCff4sxn8wFMy 1Ysg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version:dkim-signature; bh=7seFl66qgjRX1tWmlQ99VOm8wsOFyejWlwIU7ot/H6M=; b=IfcajyclQ7SxNE36k6lA2vrm9qHjcahSq7+Di0jWJpVn8qnXzrrcFaRmwc74H2KJad rGuHcVzIFwBbiNm+cDUpYMocEAFUqxixUJdqZeuWdmPmg1FiNUydO3g340xcVUHtrQPG lzuk1iBiw9OkLGilQ/6kQdJA1J0iv+pLkSmgJCDILVxkOFr60fSiaA87cjuTrBg1pRME m4BZOnf+th8WHcYWAtVq/ES/h5q8QmSXM2dFS3soisZY0kcekK2+5K8K9HBi25P9Wzvk lbSmEiyXZGC8uZTgv159JGBg5uj7OzLB5xnJsiWP+EplSfmWaxqo+75kstwC2kr9E28M YSpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2019-08-05 header.b="i5YVdzN/"; 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=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s3si1668802otr.57.2019.12.20.12.57.44; Fri, 20 Dec 2019 12:57:54 -0800 (PST) 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=@oracle.com header.s=corp-2019-08-05 header.b="i5YVdzN/"; 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=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727402AbfLTU5k (ORCPT + 99 others); Fri, 20 Dec 2019 15:57:40 -0500 Received: from aserp2120.oracle.com ([141.146.126.78]:60226 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726525AbfLTU5k (ORCPT ); Fri, 20 Dec 2019 15:57:40 -0500 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.27/8.16.0.27) with SMTP id xBKKsACO062374; Fri, 20 Dec 2019 20:57:32 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=content-type : mime-version : subject : from : in-reply-to : date : cc : content-transfer-encoding : message-id : references : to; s=corp-2019-08-05; bh=7seFl66qgjRX1tWmlQ99VOm8wsOFyejWlwIU7ot/H6M=; b=i5YVdzN/kqK8H3q+X7JMedZfiyyI58HgPVB34DSfHurxv2g8fAOVrHkxy9SeIXziXybi k2K8PTmIR77Q9hQRn8PWTYr3z03YAXAlon1kJ+mtM6STVFIXXj9teYLnAFN0zEWK0hqW WHVjxW7j5OsPwaGQB2QD/JcqYx+E2/9q+mEmDSZfFZ7xB8Fg8oO1psVviRwOQTMI3akH 7mRFkI0tle8St/ol+KTgUZZ1vcMJWw2mwiJOAzQJRIX3ucdq2lzA/wYvbY9jVbWJuH05 0idhIOV6QOovHb2nfos+Tsm3t5ScrUKq7nnswmBT0Z1snUGhmfWCgxqOt0HaLtFyiSEA dw== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by aserp2120.oracle.com with ESMTP id 2x01kntwpg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 20 Dec 2019 20:57:32 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.27/8.16.0.27) with SMTP id xBKKrM8q143781; Fri, 20 Dec 2019 20:57:31 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userp3030.oracle.com with ESMTP id 2x0vc4j401-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 20 Dec 2019 20:57:31 +0000 Received: from abhmp0017.oracle.com (abhmp0017.oracle.com [141.146.116.23]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id xBKKvR01026486; Fri, 20 Dec 2019 20:57:28 GMT Received: from anon-dhcp-152.1015granger.net (/68.61.232.219) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 20 Dec 2019 12:57:27 -0800 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) Subject: Re: acls+kerberos (limitation) From: Chuck Lever In-Reply-To: Date: Fri, 20 Dec 2019 15:57:26 -0500 Cc: Trond Myklebust , Linux NFS Mailing List Content-Transfer-Encoding: quoted-printable Message-Id: <5ABD9A2F-64D5-406C-A28D-5FEA70B0AD4A@oracle.com> References: To: Olga Kornievskaia X-Mailer: Apple Mail (2.3445.104.11) X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9477 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1911140001 definitions=main-1912200159 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9477 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1911140001 definitions=main-1912200159 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org > On Dec 20, 2019, at 3:53 PM, Olga Kornievskaia wrote: >=20 > On Fri, Dec 20, 2019 at 3:11 PM Chuck Lever = wrote: >>=20 >>=20 >>=20 >>> On Dec 20, 2019, at 3:04 PM, Olga Kornievskaia = wrote: >>>=20 >>> On Fri, Dec 20, 2019 at 1:28 PM Chuck Lever = wrote: >>>>=20 >>>>=20 >>>>=20 >>>>> On Dec 20, 2019, at 1:15 PM, Olga Kornievskaia = wrote: >>>>>=20 >>>>> On Wed, Dec 18, 2019 at 2:34 PM Chuck Lever = wrote: >>>>>>=20 >>>>>>=20 >>>>>>=20 >>>>>>> On Dec 18, 2019, at 2:31 PM, Olga Kornievskaia = wrote: >>>>>>>=20 >>>>>>> On Wed, Dec 18, 2019 at 2:05 PM Trond Myklebust = wrote: >>>>>>>>=20 >>>>>>>> On Wed, 2019-12-18 at 12:47 -0500, Olga Kornievskaia wrote: >>>>>>>>> Hi folks, >>>>>>>>>=20 >>>>>>>>> Is this a well know but undocumented fact that you can't set = large >>>>>>>>> amount of acls (over 4096bytes, ~90acls) while mounted using >>>>>>>>> krb5i/krb5p? That if you want to get/set large acls, it must = be done >>>>>>>>> over auth_sys/krb5? >>>>>>>>>=20 >>>>>>>>=20 >>>>>>>> It's certainly not something that I was aware of. Do you see = where that >>>>>>>> limitation is coming from? >>>>>>>=20 >>>>>>> I haven't figure it exactly but gss_unwrap_resp_integ() is = failing in >>>>>>> if (mic_offset > rcv_buf->len). I'm just not sure who sets up = the >>>>>>> buffer (or why rvc_buf->len is (4280) larger than a page can a >>>>>>> page-limit might make sense to for me but it's not). So you = think it >>>>>>> should have been working. >>>>>>=20 >>>>>> The buffer is set up in the XDR encoder. But pages can be added >>>>>> by the transport... I guess rcv_buf->len isn't updated when that >>>>>> happens. >>>>>>=20 >>>>>=20 >>>>> Here's why the acl+krbi/krb5p is failing. >>>>>=20 >>>>> acl tool first calls into the kernel to find out how large of a = buffer >>>>> it needs to supply and gets acl size then calls down again then = code >>>>> in __nfs4_get_acl_uncached() allocates a number of pages (this = what >>>>> set's the available buffer length later used by the sunrpc code). = That >>>>> works for non-integrity because in call_decode() the call >>>>> rpc_unwrap_resp() doesn't try to calculate the checksum on the = buffer >>>>> that was just read. However, when its krb5i/krb5p we have = truncated >>>>> buffer and mic offset that's larger than the existing buffer. >>>>>=20 >>>>> I think something needs to be marked to skip doing gss for the = initial >>>>> acl query? I first try providing more space in >>>>> __nfs4_get_acl_uncached() for when authflavor=3Dkrb5i/krb5p and = buflen=3D0 >>>>> but no matter what the number is the received acl can be larger = than >>>>> that thus I don't think that's a good approach. >>>>=20 >>>> It's not strictly true that the received ACL can be always be = larger. >>>> There is an upper bound on request sizes. >>>>=20 >>>> My preference has always been to allocate a receive buffer of the = maximum >>>> size before the call, just like every other request works. I can't = think >>>> of any reason why retrieving an ACL has to be different. Then we = can get >>>> rid of the hack in the transports to fill in those pages behind the = back >>>> of the upper layers. >>>>=20 >>>> The issue here has always been that there's no way for the client = to >>>> discover the number of bytes it needs to retrieve before it sets up = the >>>> GETACL. >>>>=20 >>>> For NFSv4.1+ you can probably assume that the ACL will never be = larger >>>> than the session's maximum reply size. >>>>=20 >>>> For NFSv4.0 you'll have to make something up. >>>>=20 >>>> But allocating a large receive buffer for this request is the only = way to >>>> make the receive reliable. You should be able to do that by = stuffing the >>>> recv XDR buffer with individual pages, just like nfsd does, in = GETACL's >>>> encoding function. >>>>=20 >>>> Others might have a different opinion. Or I might have completely >>>> misunderstood the issue. >>>>=20 >>>=20 >>> Putting a limit would be easier. I thought of using rsize (wsize) as >>> we can't get anything larger than in the payload that but that's not >>> possible. Because the code sets limits based on XATTR_MAX_SIZE which >>> is a linux server side limitation and it doesn't seem to be >>> appropriate to be applied as a generic implementation. Would it be = ok >>> to change the static memory allocation to be dynamic and based on = the >>> rsize? Thoughts? >>=20 >> Why is using the NFSv4.1 session max reply size not possible? For >> NFSv4.0, rsize seems reasonable to me. >=20 > It's not possible because there is a hard limit of number of pages the > code will allocate (right now). >=20 > static ssize_t __nfs4_get_acl_uncached(struct inode *inode, void *buf, > size_t buflen) > { > struct page *pages[NFS4ACL_MAXPAGES + 1] =3D {NULL, }; >=20 > NFS4ACL_MAXPAGES are based on the 64K limit (from the XATTR_MAX_SIZE). >=20 > if (npages > ARRAY_SIZE(pages)) > return -ERANGE; >=20 > Typically session size (or r/wsizes) are something like 262K or 1M. >=20 > I was just saying that I'd then would need to remove the static > structure for pages and make it dynamic based on the (rsize or session > size). IMO you should do that. There should be a page array available in the recv XDR buffer. > I thought that r/wsize was set to whatever the session sizes > are so using the r/wsize values would make it work for both 4.0 and > 4.1+. OK... that choice should be documented in a comment. -- Chuck Lever