From patchwork Wed Aug 23 17:14:44 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Ekstrand X-Patchwork-Id: 9917939 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id AD90C603FA for ; Wed, 23 Aug 2017 17:14:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 93D2228786 for ; Wed, 23 Aug 2017 17:14:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8886C28811; Wed, 23 Aug 2017 17:14:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5202228786 for ; Wed, 23 Aug 2017 17:14:58 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 054556E5E1; Wed, 23 Aug 2017 17:14:58 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-pg0-x242.google.com (mail-pg0-x242.google.com [IPv6:2607:f8b0:400e:c05::242]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7AB146E5E1 for ; Wed, 23 Aug 2017 17:14:56 +0000 (UTC) Received: by mail-pg0-x242.google.com with SMTP id 189so112639pgj.0 for ; Wed, 23 Aug 2017 10:14:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jlekstrand-net.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=graXM1Gtu4w58mp1AHQyE6eY0PBZoxNLGxr/RWqfkC8=; b=M4sBS8y20CsFSqHi1dmJXNAmL9MBXADtH9yl3AGFqVyoKIMoIdr0k6LBoARBbQu/le z8gnQVLZc6ZPhmwwkJO+NtgFljUQYp6rekv59LPzt1h7aIjwsBrznrCiRHtRUIu86/wC gceZnypemakLRBXIVJizY1+UydQRSPkVwSEjUEPwxGQaGS+9UUqhmq26dUqJWsxLyTk2 JzFR0kUmD/9qT8yWKSjMlogMxzUEkuNW4lUFt0F/dguqL5DtfqeZqgoWv+WL6M7f45K7 EI1pQTGwZ0zcg/Hyt7eMyFYnBY4Xe9UyD5DVJWEajwIJc6r1rw2lyClXAr5OCAj3mZoN Rl0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=graXM1Gtu4w58mp1AHQyE6eY0PBZoxNLGxr/RWqfkC8=; b=CNPP/E5+rAFm/4xAo//z8ONREkvCXalisS2EVtMhNvADBEB3VuTBQu7sJDJuAUuXb+ 3DnTMKWSsa3W8WeG+uBpotLQr1LLbxZfiKeqtjyTEO9Q1/hxG0UaMa1T1g83mfNk+WtH +lgDp3wPTuhrKjznlVhEzELz2b2sG8z/AeGJSy1befhikRL6wFBI3JKo337oEL/yr5sC PvApuLOoWCutNRUJbPau67CCpCwZ7rpwsr/ne63dVgayilfWWHTwQvYOgFb3sinXTUnp 6pvcbw30TbwVgssBHTnBIbz3wFXgBcnEsJVsJpPa8FrCoVX972jbBPuMsyPduVMbGUw1 YcPA== X-Gm-Message-State: AHYfb5iuXV9O7ExfKNOLgvbzfb7KFc02xqw9KzSPcS423X/RSLck3Xv3 UsLTIoJYO12FV6KmRiADLg== X-Received: by 10.99.181.7 with SMTP id y7mr3334775pge.313.1503508495437; Wed, 23 Aug 2017 10:14:55 -0700 (PDT) Received: from omlet.jf.intel.com (fmdmzpr01-ext.fm.intel.com. [192.55.54.36]) by smtp.gmail.com with ESMTPSA id v12sm5297185pgf.6.2017.08.23.10.14.53 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 23 Aug 2017 10:14:54 -0700 (PDT) From: Jason Ekstrand X-Google-Original-From: Jason Ekstrand To: intel-gfx@lists.freedesktop.org Date: Wed, 23 Aug 2017 10:14:44 -0700 Message-Id: <1503508486-19432-2-git-send-email-jason.ekstrand@intel.com> X-Mailer: git-send-email 2.5.0.400.gff86faf In-Reply-To: <1503508486-19432-1-git-send-email-jason.ekstrand@intel.com> References: <1503508486-19432-1-git-send-email-jason.ekstrand@intel.com> Cc: Jason Ekstrand Subject: [Intel-gfx] [PATCH i-g-t 1/3] aubdump: Reject execbuffer2 calls with bad BOs X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP This is required for the supports_48b_addresses check in the Vulkan driver to work without messing up the resulting aub. Reviewed-by: Lionel Landwerlin --- tools/aubdump.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tools/aubdump.c b/tools/aubdump.c index 610526c..c14c9fa 100644 --- a/tools/aubdump.c +++ b/tools/aubdump.c @@ -426,6 +426,12 @@ dump_execbuffer2(int fd, struct drm_i915_gem_execbuffer2 *execbuffer2) obj = &exec_objects[i]; bo = get_bo(obj->handle); + /* If bo->size == 0, this means they passed us an invalid + * buffer. The kernel will reject it and so should we. + */ + if (bo->size == 0) + return; + if (obj->flags & EXEC_OBJECT_PINNED) { bo->offset = obj->offset; } else { @@ -475,6 +481,7 @@ add_new_bo(int handle, uint64_t size, void *map) struct bo *bo = &bos[handle]; fail_if(handle >= MAX_BO_COUNT, "intel_aubdump: bo handle out of range\n"); + fail_if(size == 0, "intel_aubdump: bo size is invalid\n"); bo->size = size; bo->map = map; @@ -487,6 +494,7 @@ remove_bo(int handle) if (bo->map && !IS_USERPTR(bo->map)) munmap(bo->map, bo->size); + bo->size = 0; bo->map = NULL; }