Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2653252imj; Mon, 11 Feb 2019 06:31:09 -0800 (PST) X-Google-Smtp-Source: AHgI3IaA8YHoP+ekkp2pY1Mxx6L0LMoNp+PNxbXs97huzMt5IVLGfzIG8QZ6OMxc6KHbooj8zkdM X-Received: by 2002:a63:f553:: with SMTP id e19mr33074492pgk.87.1549895469202; Mon, 11 Feb 2019 06:31:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549895469; cv=none; d=google.com; s=arc-20160816; b=07xNM44hafYB78KS+yb8IH/O/eJOo73UB4ODDreHs1DkpRooouM6LfYzUR9AtMbj4K uV6T3gfowy1hXlQ6u6sUqYJqFLMlpu6arB90YquleiJ8FN8MX0hH02mIxmriNSAcXdih S2Wqw1yKpC7a2pZSzQu8MxRHEE1yiwTQHifkvEIMDy38WpYjozM1lD1+YUYdk2yBVYN1 og9u9KIC8/FaZ812X6Lynug+NLQQoRMCQBedu4zeb71IoZPTdqp+2TZEkiZ5+L3FJ6AO k7j9YoRYCCe0mNY/6RVvyhz+g5r8f0/kcSPJNahAo7WkiJuFpr1zV062yaB9i6AgN/hE oCug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=MjQFaaG7O6VKPnB9YnveaBah2HZ5o+U0ru5bYD3hxWc=; b=ajWJRGLnZRh3dA50NizOUnCJ4Ff0TfQUhpfCEAY8/M6Z4GGHu9Pk8zan+wxbkyo0gQ BxBTpA3ocKufiND29UC8jJqEEs8TGRdBCFpLz7N5/kaCrsKYvKcznKUhb5aSXjiJIEod iHuPJWb6beRCV7X8te7n7uvtbRb+ZoCXbb1Jahpu5zvmRkJM2IIZ9WBGBk8AZbyiY971 19e8jL75RR/fCmdygGn4AP5AzSt56YdhLQybGYSvpTm8LZmU0kmcKvCpPgHkXA1GnvS4 JxN0XhT5sqMfqvQfvONxBVoIzMwJVhUM70lV5cfHOgxB6lhsFR60eDdcHw5pytXegSzY 0GAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=CRorByWh; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a13si4656794pgj.133.2019.02.11.06.30.52; Mon, 11 Feb 2019 06:31:09 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=CRorByWh; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729891AbfBKO2m (ORCPT + 99 others); Mon, 11 Feb 2019 09:28:42 -0500 Received: from mail.kernel.org ([198.145.29.99]:34604 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729883AbfBKO2j (ORCPT ); Mon, 11 Feb 2019 09:28:39 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3C3FB20821; Mon, 11 Feb 2019 14:28:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549895318; bh=kNcSL1ZfTSTjciDPKLioPB2oZ/7NQ91T2Co6b5B3j78=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CRorByWhhJcBJGgH4xcNeuCj21T/wr7rCGV6M9sELGuC/8OKTvOGJ1vErRkndQltR fVq44eJJw/pA+eeJVCZoLwynRKizTyOstNmO8vabx3xGhBJxAiSKPzgZUw2lyblFpO PLl4h+IItM2cdvOEAK0O4nJmnWMpnCv1nKnjUr7M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tom Murphy , Gerd Hoffmann , Shuah Khan , Sasha Levin Subject: [PATCH 4.20 165/352] fix dma-buf/udmabuf selftest Date: Mon, 11 Feb 2019 15:16:32 +0100 Message-Id: <20190211141857.475128124@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190211141846.543045703@linuxfoundation.org> References: <20190211141846.543045703@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.20-stable review patch. If anyone has any objections, please let me know. ------------------ [ Upstream commit 6edf2e3710f4ef2555ad7a2681dbeb4a69092b2d ] 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 Signed-off-by: Shuah Khan Signed-off-by: Sasha Levin --- 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 f0017c831e57..a43a07a09a98 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) { -- 2.19.1