]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
fix dma-buf/udmabuf selftest
authorTom Murphy <murphyt7@tcd.ie>
Tue, 27 Nov 2018 10:33:08 +0000 (10:33 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 12 Feb 2019 19:02:19 +0000 (20:02 +0100)
[ 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 <murphyt7@tcd.ie>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Shuah Khan <shuah@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
tools/testing/selftests/Makefile
tools/testing/selftests/drivers/dma-buf/Makefile
tools/testing/selftests/drivers/dma-buf/udmabuf.c

index f0017c831e57bdf48caf0e4a334db009ad23f0bb..a43a07a09a9800f701d557f0f6e4c086d104254d 100644 (file)
@@ -6,6 +6,7 @@ TARGETS += capabilities
 TARGETS += cgroup
 TARGETS += cpufreq
 TARGETS += cpu-hotplug
+TARGETS += drivers/dma-buf
 TARGETS += efivarfs
 TARGETS += exec
 TARGETS += filesystems
index 4154c3d7aa585f1a8f36b07128dce44af08aed7f..f22c3f7cf612d1bd53b10f52c1bc9f299212e0ef 100644 (file)
@@ -2,4 +2,6 @@ CFLAGS += -I../../../../../usr/include/
 
 TEST_GEN_PROGS := udmabuf
 
+top_srcdir ?=../../../../..
+
 include ../../lib.mk
index 376b1d6730bd9965fcab295a5ba070375c6fde25..4de902ea14d82be9c06908e62e5d9bdb771a6279 100644 (file)
@@ -4,7 +4,7 @@
 #include <unistd.h>
 #include <string.h>
 #include <errno.h>
-#include <fcntl.h>
+#include <linux/fcntl.h>
 #include <malloc.h>
 
 #include <sys/ioctl.h>
@@ -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) {