Skip to content

Commit

Permalink
selftests: add memfd_create() + sealing tests
Browse files Browse the repository at this point in the history
Some basic tests to verify sealing on memfds works as expected and
guarantees the advertised semantics.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Acked-by: Hugh Dickins <hughd@google.com>
Cc: Michael Kerrisk <mtk.manpages@gmail.com>
Cc: Ryan Lortie <desrt@desrt.ca>
Cc: Lennart Poettering <lennart@poettering.net>
Cc: Daniel Mack <zonque@gmail.com>
Cc: Andy Lutomirski <luto@amacapital.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
David Herrmann authored and Linus Torvalds committed Aug 8, 2014
1 parent 9183df2 commit 4f5ce5e
Show file tree
Hide file tree
Showing 4 changed files with 945 additions and 0 deletions.
1 change: 1 addition & 0 deletions tools/testing/selftests/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ TARGETS = breakpoints
TARGETS += cpu-hotplug
TARGETS += efivarfs
TARGETS += kcmp
TARGETS += memfd
TARGETS += memory-hotplug
TARGETS += mqueue
TARGETS += net
Expand Down
2 changes: 2 additions & 0 deletions tools/testing/selftests/memfd/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
memfd_test
memfd-test-file
29 changes: 29 additions & 0 deletions tools/testing/selftests/memfd/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
uname_M := $(shell uname -m 2>/dev/null || echo not)
ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/i386/)
ifeq ($(ARCH),i386)
ARCH := X86
endif
ifeq ($(ARCH),x86_64)
ARCH := X86
endif

CFLAGS += -I../../../../arch/x86/include/generated/uapi/
CFLAGS += -I../../../../arch/x86/include/uapi/
CFLAGS += -I../../../../include/uapi/
CFLAGS += -I../../../../include/

all:
ifeq ($(ARCH),X86)
gcc $(CFLAGS) memfd_test.c -o memfd_test
else
echo "Not an x86 target, can't build memfd selftest"
endif

run_tests: all
ifeq ($(ARCH),X86)
gcc $(CFLAGS) memfd_test.c -o memfd_test
endif
@./memfd_test || echo "memfd_test: [FAIL]"

clean:
$(RM) memfd_test
Loading

0 comments on commit 4f5ce5e

Please sign in to comment.