From patchwork Tue Nov 27 10:33:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Murphy X-Patchwork-Id: 10700091 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id F1BFA13BB for ; Tue, 27 Nov 2018 10:33:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E0F72286BC for ; Tue, 27 Nov 2018 10:33:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D487228681; Tue, 27 Nov 2018 10:33:33 +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=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1A67728879 for ; Tue, 27 Nov 2018 10:33:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730731AbeK0Va7 (ORCPT ); Tue, 27 Nov 2018 16:30:59 -0500 Received: from mail-ed1-f66.google.com ([209.85.208.66]:32855 "EHLO mail-ed1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729359AbeK0Va7 (ORCPT ); Tue, 27 Nov 2018 16:30:59 -0500 Received: by mail-ed1-f66.google.com with SMTP id r27so18562631eda.0 for ; Tue, 27 Nov 2018 02:33:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tcd-ie.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=/kuCNfpIi+sZF8N3hGFOfrqe+U2khD9BA/v2leQDKRI=; b=jxFbG8SqYnt07M8yikbxdwNFB+P6yjv6H25yjROblpQxV8vcoyzqhVI6U7p6vhrb9Z 6IccYJEE9tr4USiB4CW0EHL9vHth9/5wsbnimZVGR32P3M4bbyDjvyKh49U6tUfdhmxr baYhC9wKLomod2pqlDuE78Ci4MXG5CEBp4W27l1Xa9r+sJFHnWd6hFu/uR2859DQd7hf Vg3Q2QC3UAPzrvL2gHfJNeSpVQ2z68r/SIaMrOqkWHpAbkyh1f08wjQOY1lqdhpdSzJL 5yOvl5mS3cT2D7kSzBykr5yLqrCI5WZx+0PboIMlYC7rmFGkzs3J6bZfS2FGmXF7sgk3 w5TA== 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; bh=/kuCNfpIi+sZF8N3hGFOfrqe+U2khD9BA/v2leQDKRI=; b=cX8U96dedJsDscmbmsoVdtjE7nMl48N0yX9Y+v+NQwnUW0WZP5QedAb990jit3at4t PK7ATCXhQu3eeWBPkY3aSZ5ztbtNrxSjTSUIB6Tjxju22VYWuVoHA5jisGEFx/mZqJph wtHl9a5hMK+FD05sN0epxpMMlDMo4hPFe+bUn+9CXfeqEiBNPwu2SoASpSeTdi56NrGE XunxWRcUwaITGo/NpysPVIzBKJJmqHtDbPfDy+czZ3qTLvIf9l3mVUiElmaCNe2RTpOh HVkVy+girD9vozeBDO5amVvCRd8Vl6Y1+09YSC2PqBK73OScTuxGkXJ0jkmx8opJMEuS JTwg== X-Gm-Message-State: AA+aEWZ2fCCQBCihC4dEWkbqe5Li4b0EZ4i2ew47nKxL4MXBLU0pLWb6 99keg9ItgTHbJ9RhrlokbtXbROfPwgnMOQ== X-Google-Smtp-Source: AFSGD/W/7E1bGK2BKESMGJTXR4miv8IRvJmw7kBGg/Fjs36lXKq2G7mMfA/HytdWBcbAhR5s02FIBQ== X-Received: by 2002:a17:906:4e82:: with SMTP id v2-v6mr19996835eju.149.1543314810659; Tue, 27 Nov 2018 02:33:30 -0800 (PST) Received: from localhost.localdomain (95-45-154-4-dynamic.agg2.phb.bdt-fng.eircom.net. [95.45.154.4]) by smtp.gmail.com with ESMTPSA id z39sm895739edb.81.2018.11.27.02.33.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 27 Nov 2018 02:33:30 -0800 (PST) From: Tom Murphy To: linux-kselftest@vger.kernel.org Cc: Tom Murphy , Shuah Khan , Gerd Hoffmann , Daniel Vetter , linux-kernel@vger.kernel.org Subject: [PATCH] fix dma-buf/udmabuf selftest Date: Tue, 27 Nov 2018 10:33:08 +0000 Message-Id: <20181127103312.19368-1-murphyt7@tcd.ie> X-Mailer: git-send-email 2.17.1 Sender: linux-kselftest-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch fixes the udmabuf selftest. Currently the selftest is broken. I fixed the selftest by setting the F_SEAL_SHRINK seal on the memfd file descriptor which is required by udmabuf and added the test to the selftest Makefile. Signed-off-by: Tom Murphy Reviewed-by: Gerd Hoffmann --- tools/testing/selftests/Makefile | 1 + tools/testing/selftests/drivers/dma-buf/Makefile | 2 ++ tools/testing/selftests/drivers/dma-buf/udmabuf.c | 11 +++++++++-- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile index f1fe492c8e17..25efcde61d95 100644 --- a/tools/testing/selftests/Makefile +++ b/tools/testing/selftests/Makefile @@ -6,6 +6,7 @@ TARGETS += capabilities TARGETS += cgroup TARGETS += cpufreq TARGETS += cpu-hotplug +TARGETS += drivers/dma-buf TARGETS += efivarfs TARGETS += exec TARGETS += filesystems diff --git a/tools/testing/selftests/drivers/dma-buf/Makefile b/tools/testing/selftests/drivers/dma-buf/Makefile index 4154c3d7aa58..f22c3f7cf612 100644 --- a/tools/testing/selftests/drivers/dma-buf/Makefile +++ b/tools/testing/selftests/drivers/dma-buf/Makefile @@ -2,4 +2,6 @@ CFLAGS += -I../../../../../usr/include/ TEST_GEN_PROGS := udmabuf +top_srcdir ?=../../../../.. + include ../../lib.mk diff --git a/tools/testing/selftests/drivers/dma-buf/udmabuf.c b/tools/testing/selftests/drivers/dma-buf/udmabuf.c index 376b1d6730bd..4de902ea14d8 100644 --- a/tools/testing/selftests/drivers/dma-buf/udmabuf.c +++ b/tools/testing/selftests/drivers/dma-buf/udmabuf.c @@ -4,7 +4,7 @@ #include #include #include -#include +#include #include #include @@ -33,12 +33,19 @@ int main(int argc, char *argv[]) exit(77); } - memfd = memfd_create("udmabuf-test", MFD_CLOEXEC); + memfd = memfd_create("udmabuf-test", MFD_ALLOW_SEALING); if (memfd < 0) { printf("%s: [skip,no-memfd]\n", TEST_PREFIX); exit(77); } + ret = fcntl(memfd, F_ADD_SEALS, F_SEAL_SHRINK); + if (ret < 0) { + printf("%s: [skip,fcntl-add-seals]\n", TEST_PREFIX); + exit(77); + } + + size = getpagesize() * NUM_PAGES; ret = ftruncate(memfd, size); if (ret == -1) {