Received: by 2002:ac0:c50a:0:0:0:0:0 with SMTP id y10csp1315442imi; Fri, 1 Jul 2022 07:19:54 -0700 (PDT) X-Google-Smtp-Source: AGRyM1v2H1Vxxj3xpasAsGizRXBPJDQB77wsOrrQzmquj+ZSD/k+tUvhUguru+JH6HSlMlPzhZgS X-Received: by 2002:a17:90b:3887:b0:1ec:e6a1:b965 with SMTP id mu7-20020a17090b388700b001ece6a1b965mr16835800pjb.162.1656685194357; Fri, 01 Jul 2022 07:19:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656685194; cv=none; d=google.com; s=arc-20160816; b=KAwvGsX1bgS1z4/ZJO3QsxnruzW60mmFV5s+ztndNxAAfMTCT6qoEeBB5x+vYHgGJU lhcBLw8ky9vBbwg5s3hFtzmEATnLLmjY66R6ik9bFTnA79gknyeJr3DUi4woN29NQ+R6 uB8MBzAiu4u6xUiNRmF3+rqSKgEFWoDD5jx+n9HB0rspsvF7pHdZuVbvsv56ixobDnEQ oCviWNqH4lz8sYV8nGjEA9cuOBXdZSNG8d5edZG+Cy0KDC6z70lQsOSLrX2j1KOxHCjW elEPfTTb9W1Qrolw+aQo9jEgbaYZyA3hwZntOEd9nEggJ6INnHjK8L55GReU6ihTYiR/ vJEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature:dkim-filter; bh=B9MZnGRTwYde4QoxzDBsp5SPVzYCVCm/rGuCLK4COtw=; b=i000MY12pXzliyxirQJ7YfWYjvgsapJ+Suk8FQjPrp3gl8J9A603q2AGksLsYAiIw+ 514t6402tyJEsNbHmOMKsjyeXkRotCddB1+7lInjqM2JBz5xZ54HpGG5IqAi4QVQxCrz WuWHHkuL/u816FupSesgyhvZgf4XSg9OgepQzPa+eszJZL6UHn4aVI1h/GWSqK7tS3K1 DeXNrQsmO12OeGMy45izuv0FAKd7tTO7edy7mkvYEGDs+48vfUIq/7lMKmkgCZoWMsF4 yXxLqNLJHmrPYTpQEVXWKxHD9TgqTqW6ZscRZ8Vh05B5uiY2LN5xmTlE/5ugFrlsrq3A DZ+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@fieldses.org header.s=default header.b=ZkavusZu; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=fieldses.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y11-20020aa79aeb000000b00525613a9ae5si30591608pfp.74.2022.07.01.07.19.27; Fri, 01 Jul 2022 07:19:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@fieldses.org header.s=default header.b=ZkavusZu; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=fieldses.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230261AbiGAORz (ORCPT + 99 others); Fri, 1 Jul 2022 10:17:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34144 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229768AbiGAORy (ORCPT ); Fri, 1 Jul 2022 10:17:54 -0400 Received: from fieldses.org (fieldses.org [IPv6:2600:3c00:e000:2f7::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 93C1939170 for ; Fri, 1 Jul 2022 07:17:53 -0700 (PDT) Received: by fieldses.org (Postfix, from userid 2815) id EB3DB608A; Fri, 1 Jul 2022 10:17:52 -0400 (EDT) DKIM-Filter: OpenDKIM Filter v2.11.0 fieldses.org EB3DB608A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fieldses.org; s=default; t=1656685072; bh=B9MZnGRTwYde4QoxzDBsp5SPVzYCVCm/rGuCLK4COtw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ZkavusZuG0enUMdo/1koe/Ca094GzlxkGyq5I7yfyb5OX/+w15gql9qTZ+zHSVjE/ lwxsShmUJwsucGX0EniHASZabaTGIe0RfXScPVuKgDN5DCwabhsEZvnShEEkieyqF5 8S3yZRFqEQXxjic6DRvPr0O7ZltpZpgEFatdc+ag= Date: Fri, 1 Jul 2022 10:17:52 -0400 From: "J. Bruce Fields" To: Chuck Lever Cc: linux-nfs@vger.kernel.org, anna.schumaker@netapp.com, zlang@redhat.com Subject: Re: [PATCH v2] SUNRPC: Fix READ_PLUS crasher Message-ID: <20220701141752.GA13890@fieldses.org> References: <165662209842.1459.4593520026847863736.stgit@klimt.1015granger.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <165662209842.1459.4593520026847863736.stgit@klimt.1015granger.net> User-Agent: Mutt/1.5.21 (2010-09-15) X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org This also gets through my tests without a crash.--b. On Thu, Jun 30, 2022 at 04:48:18PM -0400, Chuck Lever wrote: > Looks like there are still cases when "space_left - frag1bytes" can > legitimately exceed PAGE_SIZE. Ensure that xdr->end always remains > within the current encode buffer. > > Reported-by: Bruce Fields > Reported-by: Zorro Lang > Link: https://bugzilla.kernel.org/show_bug.cgi?id=216151 > Fixes: 6c254bf3b637 ("SUNRPC: Fix the calculation of xdr->end in xdr_get_next_encode_buffer()") > Signed-off-by: Chuck Lever > --- > net/sunrpc/xdr.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/net/sunrpc/xdr.c b/net/sunrpc/xdr.c > index f87a2d8f23a7..5d2b3e6979fb 100644 > --- a/net/sunrpc/xdr.c > +++ b/net/sunrpc/xdr.c > @@ -984,7 +984,7 @@ static noinline __be32 *xdr_get_next_encode_buffer(struct xdr_stream *xdr, > p = page_address(*xdr->page_ptr); > xdr->p = p + frag2bytes; > space_left = xdr->buf->buflen - xdr->buf->len; > - if (space_left - nbytes >= PAGE_SIZE) > + if (space_left - frag1bytes >= PAGE_SIZE) > xdr->end = p + PAGE_SIZE; > else > xdr->end = p + space_left - frag1bytes; >