From patchwork Thu Dec 21 02:59:37 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dave Airlie X-Patchwork-Id: 10126927 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 C69B860388 for ; Thu, 21 Dec 2017 02:59:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B0DEB28AF9 for ; Thu, 21 Dec 2017 02:59:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A260F28C0F; Thu, 21 Dec 2017 02:59:42 +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.2 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM,RCVD_IN_DNSWL_MED 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 3A69228AF9 for ; Thu, 21 Dec 2017 02:59:41 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id DDA8A6E573; Thu, 21 Dec 2017 02:59:40 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3E74A6E573 for ; Thu, 21 Dec 2017 02:59:40 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7E49561D1C for ; Thu, 21 Dec 2017 02:59:39 +0000 (UTC) Received: from dreadlord-bne-redhat-com.bne.redhat.com (dhcp-40-179.bne.redhat.com [10.64.40.179]) by smtp.corp.redhat.com (Postfix) with ESMTP id DF0515C552 for ; Thu, 21 Dec 2017 02:59:38 +0000 (UTC) From: Dave Airlie To: intel-gfx@lists.freedesktop.org Date: Thu, 21 Dec 2017 12:59:37 +1000 Message-Id: <20171221025937.32670-1-airlied@gmail.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Thu, 21 Dec 2017 02:59:39 +0000 (UTC) Subject: [Intel-gfx] [PATCH i-g-t] syncobj: add test for handle->fd + close twice. 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 From: Dave Airlie This demos a bug found in the vulkan CTS that causes VFS: Close: file count is 0 in dmesg, and ls /proc/self/fd to oops. Signed-off-by: Dave Airlie Reviewed-by: Chris Wilson --- tests/syncobj_basic.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tests/syncobj_basic.c b/tests/syncobj_basic.c index acc4a641..42fc99f8 100644 --- a/tests/syncobj_basic.c +++ b/tests/syncobj_basic.c @@ -177,6 +177,22 @@ test_valid_cycle(int fd) syncobj_destroy(fd, second_handle); } +static void +test_create_close_twice(int fd) +{ + uint32_t handle; + int syncobj_fd; + + handle = syncobj_create(fd, 0); + syncobj_fd = syncobj_handle_to_fd(fd, handle, 0); + close(syncobj_fd); + + syncobj_fd = syncobj_handle_to_fd(fd, handle, 0); + close(syncobj_fd); + + syncobj_destroy(fd, handle); +} + static bool has_syncobj(int fd) { uint64_t value; @@ -231,4 +247,7 @@ igt_main igt_subtest("test-valid-cycle") test_valid_cycle(fd); + igt_subtest("test-create-close-twice") + test_create_close_twice(fd); + }