Commit 6edf2e37 authored by Tom Murphy's avatar Tom Murphy Committed by Shuah Khan

fix dma-buf/udmabuf selftest

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: default avatarTom Murphy <murphyt7@tcd.ie>
Reviewed-by: default avatarGerd Hoffmann <kraxel@redhat.com>
Signed-off-by: default avatarShuah Khan <shuah@kernel.org>
parent 0ca2923e
...@@ -6,6 +6,7 @@ TARGETS += capabilities ...@@ -6,6 +6,7 @@ TARGETS += capabilities
TARGETS += cgroup TARGETS += cgroup
TARGETS += cpufreq TARGETS += cpufreq
TARGETS += cpu-hotplug TARGETS += cpu-hotplug
TARGETS += drivers/dma-buf
TARGETS += efivarfs TARGETS += efivarfs
TARGETS += exec TARGETS += exec
TARGETS += filesystems TARGETS += filesystems
......
...@@ -2,4 +2,6 @@ CFLAGS += -I../../../../../usr/include/ ...@@ -2,4 +2,6 @@ CFLAGS += -I../../../../../usr/include/
TEST_GEN_PROGS := udmabuf TEST_GEN_PROGS := udmabuf
top_srcdir ?=../../../../..
include ../../lib.mk include ../../lib.mk
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
#include <unistd.h> #include <unistd.h>
#include <string.h> #include <string.h>
#include <errno.h> #include <errno.h>
#include <fcntl.h> #include <linux/fcntl.h>
#include <malloc.h> #include <malloc.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
...@@ -33,12 +33,19 @@ int main(int argc, char *argv[]) ...@@ -33,12 +33,19 @@ int main(int argc, char *argv[])
exit(77); exit(77);
} }
memfd = memfd_create("udmabuf-test", MFD_CLOEXEC); memfd = memfd_create("udmabuf-test", MFD_ALLOW_SEALING);
if (memfd < 0) { if (memfd < 0) {
printf("%s: [skip,no-memfd]\n", TEST_PREFIX); printf("%s: [skip,no-memfd]\n", TEST_PREFIX);
exit(77); 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; size = getpagesize() * NUM_PAGES;
ret = ftruncate(memfd, size); ret = ftruncate(memfd, size);
if (ret == -1) { if (ret == -1) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment