From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6036BC33CAF for ; Thu, 16 Jan 2020 21:19:04 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BA0C620728 for ; Thu, 16 Jan 2020 21:19:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BA0C620728 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=chris-wilson.co.uk Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=intel-gfx-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 50FF06E2BE; Thu, 16 Jan 2020 21:19:03 +0000 (UTC) Received: from fireflyinternet.com (mail.fireflyinternet.com [109.228.58.192]) by gabe.freedesktop.org (Postfix) with ESMTPS id 66B0E6E2BE for ; Thu, 16 Jan 2020 21:19:01 +0000 (UTC) X-Default-Received-SPF: pass (skip=forwardok (res=PASS)) x-ip-name=78.156.65.138; Received: from localhost (unverified [78.156.65.138]) by fireflyinternet.com (Firefly Internet (M1)) with ESMTP (TLS) id 19908090-1500050 for multiple; Thu, 16 Jan 2020 21:18:57 +0000 MIME-Version: 1.0 From: Chris Wilson User-Agent: alot/0.6 To: Matthew Auld , intel-gfx@lists.freedesktop.org References: <20200116203150.923826-1-matthew.auld@intel.com> In-Reply-To: <20200116203150.923826-1-matthew.auld@intel.com> Message-ID: <157920953480.7612.16415611914387513987@skylake-alporthouse-com> Date: Thu, 16 Jan 2020 21:18:54 +0000 Subject: Re: [Intel-gfx] [PATCH v2 1/2] drm/i915/userptr: add user_size limit check X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Quoting Matthew Auld (2020-01-16 20:31:49) > Don't allow a mismatch between obj->base.size/vma->size and the actual > number of pages for the backing store, which is limited to INT_MAX > pages. > > Signed-off-by: Matthew Auld > Cc: Chris Wilson > --- > drivers/gpu/drm/i915/gem/i915_gem_userptr.c | 12 ++++++++++++ > 1 file changed, 12 insertions(+) > > diff --git a/drivers/gpu/drm/i915/gem/i915_gem_userptr.c b/drivers/gpu/drm/i915/gem/i915_gem_userptr.c > index e5558af111e2..fef96a303d9d 100644 > --- a/drivers/gpu/drm/i915/gem/i915_gem_userptr.c > +++ b/drivers/gpu/drm/i915/gem/i915_gem_userptr.c > @@ -768,6 +768,18 @@ i915_gem_userptr_ioctl(struct drm_device *dev, > if (args->flags & ~(I915_USERPTR_READ_ONLY | > I915_USERPTR_UNSYNCHRONIZED)) > return -EINVAL; > + /* > + * XXX: There is a prevalence of the assumption that we fit the > + * object's page count inside a 32bit _signed_ variable. Let's document > + * this and catch if we ever need to fix it. In the meantime, if you do > + * spot such a local variable, please consider fixing! > + */ > + > + if (args->user_size >> PAGE_SHIFT > INT_MAX) > + return -E2BIG; I'm convinced that the following patch is the last bug (excusing i915_gem_internal.c), and think we should commit to removing this limit. -Chris _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx