summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThorsten Leemhuis <fedora@leemhuis.info>2018-10-05 19:59:10 +0200
committerThorsten Leemhuis <fedora@leemhuis.info>2018-10-05 19:59:10 +0200
commitd81e0b2f2ae9175dc1e1da62ffc539d4e6b7c850 (patch)
tree9b04427efd3704c8bb075e3dedd3cc4964837b09
parent9a91d33c5cdf8b932b0d96e8402a263b6714d607 (diff)
parent73a194639b32ade20dacdf22a914ead178a69b06 (diff)
downloadkernel-d81e0b2f2ae9175dc1e1da62ffc539d4e6b7c850.tar.gz
kernel-d81e0b2f2ae9175dc1e1da62ffc539d4e6b7c850.tar.xz
kernel-d81e0b2f2ae9175dc1e1da62ffc539d4e6b7c850.zip
-rw-r--r--configs/fedora/generic/arm/CONFIG_SCSI_MPT3SAS1
-rw-r--r--gitrev2
-rw-r--r--kernel-aarch64-debug.config2
-rw-r--r--kernel-aarch64.config2
-rw-r--r--kernel-armv7hl-debug.config2
-rw-r--r--kernel-armv7hl-lpae-debug.config2
-rw-r--r--kernel-armv7hl-lpae.config2
-rw-r--r--kernel-armv7hl.config2
-rw-r--r--kernel.spec12
-rw-r--r--sources2
-rw-r--r--tests/filesystem.yml42
-rw-r--r--tests/filesystem/ext4/freeze-protection-bypass/Makefile56
-rw-r--r--tests/filesystem/ext4/freeze-protection-bypass/PURPOSE5
-rwxr-xr-xtests/filesystem/ext4/freeze-protection-bypass/runtest.sh86
-rwxr-xr-xtests/filesystem/ext4/inventory3
-rw-r--r--tests/memory.yml15
-rw-r--r--tests/memory/memfd_create/Makefile70
-rw-r--r--tests/memory/memfd_create/PURPOSE3
-rw-r--r--tests/memory/memfd_create/_env8
-rwxr-xr-xtests/memory/memfd_create/runtest.sh54
-rw-r--r--tests/memory/memfd_create/t_get_seals.c62
-rw-r--r--tests/memory/memfd_create/t_memfd_create.c102
-rw-r--r--tests/tests.yml6
23 files changed, 530 insertions, 11 deletions
diff --git a/configs/fedora/generic/arm/CONFIG_SCSI_MPT3SAS b/configs/fedora/generic/arm/CONFIG_SCSI_MPT3SAS
deleted file mode 100644
index 887255096..000000000
--- a/configs/fedora/generic/arm/CONFIG_SCSI_MPT3SAS
+++ /dev/null
@@ -1 +0,0 @@
-# CONFIG_SCSI_MPT3SAS is not set
diff --git a/gitrev b/gitrev
index 690fa8341..face28bbc 100644
--- a/gitrev
+++ b/gitrev
@@ -1 +1 @@
-6bebe37927f3023e92de66964df8ff75151dcea9
+befad944e2312c18d855013ce154ca7d2b110ade
diff --git a/kernel-aarch64-debug.config b/kernel-aarch64-debug.config
index dfa50c756..09ccc8c0d 100644
--- a/kernel-aarch64-debug.config
+++ b/kernel-aarch64-debug.config
@@ -5169,7 +5169,7 @@ CONFIG_SCSI_LOWLEVEL=y
CONFIG_SCSI_LPFC=m
# CONFIG_SCSI_MPT2SAS is not set
CONFIG_SCSI_MPT2SAS_MAX_SGE=128
-# CONFIG_SCSI_MPT3SAS is not set
+CONFIG_SCSI_MPT3SAS=m
CONFIG_SCSI_MPT3SAS_MAX_SGE=128
# CONFIG_SCSI_MQ_DEFAULT is not set
# CONFIG_SCSI_MVSAS_DEBUG is not set
diff --git a/kernel-aarch64.config b/kernel-aarch64.config
index cab8a9da2..82e40e175 100644
--- a/kernel-aarch64.config
+++ b/kernel-aarch64.config
@@ -5146,7 +5146,7 @@ CONFIG_SCSI_LOWLEVEL=y
CONFIG_SCSI_LPFC=m
# CONFIG_SCSI_MPT2SAS is not set
CONFIG_SCSI_MPT2SAS_MAX_SGE=128
-# CONFIG_SCSI_MPT3SAS is not set
+CONFIG_SCSI_MPT3SAS=m
CONFIG_SCSI_MPT3SAS_MAX_SGE=128
# CONFIG_SCSI_MQ_DEFAULT is not set
# CONFIG_SCSI_MVSAS_DEBUG is not set
diff --git a/kernel-armv7hl-debug.config b/kernel-armv7hl-debug.config
index 75e81fbd6..163aeeec2 100644
--- a/kernel-armv7hl-debug.config
+++ b/kernel-armv7hl-debug.config
@@ -5481,7 +5481,7 @@ CONFIG_SCSI_LOWLEVEL=y
CONFIG_SCSI_LPFC=m
# CONFIG_SCSI_MPT2SAS is not set
CONFIG_SCSI_MPT2SAS_MAX_SGE=128
-# CONFIG_SCSI_MPT3SAS is not set
+CONFIG_SCSI_MPT3SAS=m
CONFIG_SCSI_MPT3SAS_MAX_SGE=128
# CONFIG_SCSI_MQ_DEFAULT is not set
# CONFIG_SCSI_MVSAS_DEBUG is not set
diff --git a/kernel-armv7hl-lpae-debug.config b/kernel-armv7hl-lpae-debug.config
index 133b13bab..199cd0b59 100644
--- a/kernel-armv7hl-lpae-debug.config
+++ b/kernel-armv7hl-lpae-debug.config
@@ -5176,7 +5176,7 @@ CONFIG_SCSI_LOWLEVEL=y
CONFIG_SCSI_LPFC=m
# CONFIG_SCSI_MPT2SAS is not set
CONFIG_SCSI_MPT2SAS_MAX_SGE=128
-# CONFIG_SCSI_MPT3SAS is not set
+CONFIG_SCSI_MPT3SAS=m
CONFIG_SCSI_MPT3SAS_MAX_SGE=128
# CONFIG_SCSI_MQ_DEFAULT is not set
# CONFIG_SCSI_MVSAS_DEBUG is not set
diff --git a/kernel-armv7hl-lpae.config b/kernel-armv7hl-lpae.config
index afe40d0ee..6d3ad2e86 100644
--- a/kernel-armv7hl-lpae.config
+++ b/kernel-armv7hl-lpae.config
@@ -5153,7 +5153,7 @@ CONFIG_SCSI_LOWLEVEL=y
CONFIG_SCSI_LPFC=m
# CONFIG_SCSI_MPT2SAS is not set
CONFIG_SCSI_MPT2SAS_MAX_SGE=128
-# CONFIG_SCSI_MPT3SAS is not set
+CONFIG_SCSI_MPT3SAS=m
CONFIG_SCSI_MPT3SAS_MAX_SGE=128
# CONFIG_SCSI_MQ_DEFAULT is not set
# CONFIG_SCSI_MVSAS_DEBUG is not set
diff --git a/kernel-armv7hl.config b/kernel-armv7hl.config
index c1dd5c7ec..efd8d437d 100644
--- a/kernel-armv7hl.config
+++ b/kernel-armv7hl.config
@@ -5458,7 +5458,7 @@ CONFIG_SCSI_LOWLEVEL=y
CONFIG_SCSI_LPFC=m
# CONFIG_SCSI_MPT2SAS is not set
CONFIG_SCSI_MPT2SAS_MAX_SGE=128
-# CONFIG_SCSI_MPT3SAS is not set
+CONFIG_SCSI_MPT3SAS=m
CONFIG_SCSI_MPT3SAS_MAX_SGE=128
# CONFIG_SCSI_MQ_DEFAULT is not set
# CONFIG_SCSI_MVSAS_DEBUG is not set
diff --git a/kernel.spec b/kernel.spec
index 4c03caa80..42761d3a6 100644
--- a/kernel.spec
+++ b/kernel.spec
@@ -77,7 +77,7 @@ Summary: The Linux kernel
# The rc snapshot level
%global rcrev 6
# The git snapshot level
-%define gitrev 2
+%define gitrev 4
# Set rpm version accordingly
%define rpmversion 4.%{upstream_sublevel}.0
%endif
@@ -1255,7 +1255,9 @@ BuildKernel() {
%endif
# make sure EXTRAVERSION says what we want it to say
- perl -p -i -e "s/^EXTRAVERSION.*/EXTRAVERSION = -%{release}.%{_target_cpu}${Flav}/" Makefile
+ # Trim the release if this is a CI build, since KERNELVERSION is limited to 64 characters
+ ShortRel=$(python3 -c "import re; print(re.sub(r'\.pr\.[0-9A-Fa-f]{32}', '', '%{release}'))")
+ perl -p -i -e "s/^EXTRAVERSION.*/EXTRAVERSION = -${ShortRel}.%{_target_cpu}${Flav}/" Makefile
# if pre-rc1 devel kernel, must fix up PATCHLEVEL for our versioning scheme
%if !0%{?rcrev}
@@ -1903,6 +1905,12 @@ fi
#
#
%changelog
+* Fri Oct 05 2018 Jeremy Cline <jcline@redhat.com> - 4.19.0-0.rc6.git4.1
+- Linux v4.19-rc6-223-gbefad944e231
+
+* Thu Oct 04 2018 Jeremy Cline <jcline@redhat.com> - 4.19.0-0.rc6.git3.1
+- Linux v4.19-rc6-177-gcec4de302c5f
+
* Wed Oct 03 2018 Jeremy Cline <jcline@redhat.com> - 4.19.0-0.rc6.git2.1
- Linux v4.19-rc6-37-g6bebe37927f3
diff --git a/sources b/sources
index c5057b019..58ebd25fb 100644
--- a/sources
+++ b/sources
@@ -1,3 +1,3 @@
SHA512 (linux-4.18.tar.xz) = 950eb85ac743b291afe9f21cd174d823e25f11883ee62cecfbfff8fe8c5672aae707654b1b8f29a133b1f2e3529e63b9f7fba4c45d6dacccc8000b3a9a9ae038
SHA512 (patch-4.19-rc6.xz) = bd620da022968f325f95ec586e4a18b436433d677709a351be028e80789978914e09326941b0cb37d9a95b5e972bc1ec9ee290c6aff36797256bab73d287b57d
-SHA512 (patch-4.19-rc6-git2.xz) = a04f39282d4d948343309f2f49e8dd46365dbd1f66d7ff802d24b2e45a06b60ccd95c477e1ac643c74aabb230b1d6e7b22c8ebe461ba76d8aca4d123b56f7814
+SHA512 (patch-4.19-rc6-git4.xz) = a15ea25e423641d892c909b958aff7cf0335847d6438ac6ea433fc2b94eca43eb8a82d7873e8f65eb4e89d41d1dd706d4a2a6d9a774d86bdac03b3ff7152d069
diff --git a/tests/filesystem.yml b/tests/filesystem.yml
new file mode 100644
index 000000000..09b1c4344
--- /dev/null
+++ b/tests/filesystem.yml
@@ -0,0 +1,42 @@
+---
+# Tests suitable to run in a classic environment
+- hosts: localhost
+ tags:
+ - classic
+ roles:
+ - role: standard-test-beakerlib
+ tests:
+ - filesystem/ext4/freeze-protection-bypass
+ required_packages:
+ - kernel
+ - e2fsprogs
+ - util-linux
+ ignore_errors: yes
+
+# Tests suitable to run in a docker environment
+- hosts: localhost
+ tags:
+ - container
+ roles:
+ - role: standard-test-beakerlib
+ tests:
+ - filesystem/ext4/freeze-protection-bypass
+ required_packages:
+ - kernel
+ - e2fsprogs
+ - util-linux
+ ignore_errors: yes
+
+# Tests suitable to run in an Atomic Host environment
+- hosts: localhost
+ tags:
+ - atomic
+ roles:
+ - role: standard-test-beakerlib
+ tests:
+ - filesystem/ext4/freeze-protection-bypass
+ required_packages:
+ - kernel
+ - e2fsprogs
+ - util-linux
+ ignore_errors: yes \ No newline at end of file
diff --git a/tests/filesystem/ext4/freeze-protection-bypass/Makefile b/tests/filesystem/ext4/freeze-protection-bypass/Makefile
new file mode 100644
index 000000000..24233a4b0
--- /dev/null
+++ b/tests/filesystem/ext4/freeze-protection-bypass/Makefile
@@ -0,0 +1,56 @@
+# Copyright (c) 2018 Red Hat, Inc.
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+# Author: Boyang Xue <bxue@redhat.com>
+
+TOPLEVEL_NAMESPACE=
+PACKAGE_NAME=kernel
+
+export TEST=freeze-protection-bypass
+export TESTVERSION=1.0
+
+BUILT_FILES=
+
+FILES=$(METADATA) runtest.sh Makefile
+
+.PHONY: all install download clean
+
+run: $(FILES) build
+ ./runtest.sh
+
+build: $(BUILT_FILES)
+ chmod a+x ./runtest.sh
+
+clean:
+ rm -f *~ $(BUILT_FILES)
+
+include /usr/share/rhts/lib/rhts-make.include
+
+$(METADATA): Makefile
+ @echo "Owner: Boyang Xue <bxue@redhat.com>" > $(METADATA)
+ @echo "Name: $(TEST)" >> $(METADATA)
+ @echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
+ @echo "Path: $(TEST_DIR)" >> $(METADATA)
+ @echo "Description: Test for Bug - ext4: fix freeze protection bypass" >> $(METADATA)
+ @echo "Type: Regression" >> $(METADATA)
+ @echo "TestTime: 3m" >> $(METADATA)
+ @echo "RunFor: kernel" >> $(METADATA)
+ @echo "Requires: " >> $(METADATA)
+ @echo "Priority: Normal" >> $(METADATA)
+ @echo "License: GPLv2+" >> $(METADATA)
+ @echo "Confidential: no" >> $(METADATA)
+ @echo "Destructive: no" >> $(METADATA)
+
+ rhts-lint $(METADATA)
diff --git a/tests/filesystem/ext4/freeze-protection-bypass/PURPOSE b/tests/filesystem/ext4/freeze-protection-bypass/PURPOSE
new file mode 100644
index 000000000..fa8df1870
--- /dev/null
+++ b/tests/filesystem/ext4/freeze-protection-bypass/PURPOSE
@@ -0,0 +1,5 @@
+Test Name: freeze-protection-bypass
+Author: Boyang Xue <bxue@redhat.com>
+Location: /kernel/filesystem/freeze-protection-bypass
+
+Description: regression test for Bug - ext4: fix freeze protection bypass
diff --git a/tests/filesystem/ext4/freeze-protection-bypass/runtest.sh b/tests/filesystem/ext4/freeze-protection-bypass/runtest.sh
new file mode 100755
index 000000000..b70c2b130
--- /dev/null
+++ b/tests/filesystem/ext4/freeze-protection-bypass/runtest.sh
@@ -0,0 +1,86 @@
+#!/bin/bash
+#
+# Copyright (c) 2018 Red Hat, Inc.
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+# Author: Boyang Xue <bxue@redhat.com>
+
+PACKAGE=kernel
+
+. /usr/share/beakerlib/beakerlib.sh
+
+rlJournalStart
+
+WDIR=/tmp/TC_freeze-protection-bypass.tmp.workdir
+ODIR=/tmp/TC_freeze-protection-bypass.tmp.oldmnt
+NDIR=/tmp/TC_freeze-protection-bypass.tmp.newmnt
+mkdir $ODIR $NDIR $WDIR
+
+cd $WDIR
+fallocate -l 64M 64M.img
+mkfs.ext4 -qF 64M.img
+TDEV=$(losetup -f --show 64M.img)
+
+TRID=$RANDOM
+
+rlPhaseStartSetup
+
+ # The following patch for this bug is integrated in kernel v4.18
+ #
+ # vfs: add the sb_start_intwrite_trylock() helper
+ # ext4: factor out helper ext4_sample_last_mounted()
+ # ext4: do not update s_last_mounted of a frozen fs
+ KNVR=$(uname -r | cut -d '-' -f1)
+ rlCmpVersion $KNVR 4.18.0 >/dev/null
+ if [[ $? -eq 2 ]]; then
+ ISFIXED=0
+ rlPass "Kernel version < 4.18, indicating it's vulnerable to this bug. Test skipped as pass."
+ exit 0
+ else
+ ISFIXED=1
+ fi
+
+ rlRun "mount $TDEV $ODIR"
+ rlRun "echo TC_freeze-protection-bypass > $ODIR/TC_freeze-protection-bypass"
+ rlRun "umount $ODIR"
+rlPhaseEnd
+
+rlPhaseStartTest
+ rlRun "echo \"run TC_freeze-protection-bypass#${TRID}\" >/dev/kmsg"
+ rlRun "mount $TDEV $NDIR"
+ rlLog "Run 'fsfreeze -f $NDIR &'"
+ fsfreeze -f $NDIR &
+ wait $!
+ rlRun "grep TC_freeze-protection-bypass $NDIR/TC_freeze-protection-bypass"
+ rlRun "! dmesg | tac | sed -ne \"0,\#run TC_freeze-protection-bypass\#${TRID}#p\" | tac | grep -E \"ext4_journal_check_start|ext4_journal_start_sb\""
+ if [[ $? -eq 0 ]]; then
+ rlPass "The kernel warning isn't triggered. Test passes."
+ else
+ rlFail "The kernel warning is triggered. Test fails."
+ fi
+rlPhaseEnd
+
+rlPhaseStartCleanup
+ rlRun "fsfreeze -u $NDIR"
+ rlRun "umount $TDEV"
+ rlRun "losetup -d $TDEV"
+ rlRun "rm -f 64M.img"
+ rlRun "rm -rf $NDIR"
+ rlRun "rm -rf $ODIR"
+ rlRun "rm -rf $WDIR"
+rlPhaseEnd
+
+rlJournalPrintText
+rlJournalEnd
diff --git a/tests/filesystem/ext4/inventory b/tests/filesystem/ext4/inventory
new file mode 100755
index 000000000..fe5129040
--- /dev/null
+++ b/tests/filesystem/ext4/inventory
@@ -0,0 +1,3 @@
+#!/bin/bash
+export TEST_DOCKER_EXTRA_ARGS="--privileged -v /dev:/dev"
+exec merge-standard-inventory "$@"
diff --git a/tests/memory.yml b/tests/memory.yml
new file mode 100644
index 000000000..90c74a4c0
--- /dev/null
+++ b/tests/memory.yml
@@ -0,0 +1,15 @@
+---
+# Tests suitable to run in a classic environment
+- hosts: localhost
+ tags:
+ - classic
+ roles:
+ - role: standard-test-beakerlib
+ tests:
+ - memory/memfd_create
+ required_packages:
+ - gcc
+ - libgcc
+ - glibc-devel
+ - glibc-static
+ ignore_errors: yes
diff --git a/tests/memory/memfd_create/Makefile b/tests/memory/memfd_create/Makefile
new file mode 100644
index 000000000..132cdb891
--- /dev/null
+++ b/tests/memory/memfd_create/Makefile
@@ -0,0 +1,70 @@
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+# Description: memfd_create test
+# Author: Shu Wang <shuwang@redhat.com>
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+# Copyright (c) 2016 Red Hat, Inc.
+#
+# This program is free software: you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation, either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be
+# useful, but WITHOUT ANY WARRANTY; without even the implied
+# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+# PURPOSE. See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see http://www.gnu.org/licenses/.
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+TENV=_env
+ifeq ($(PKG_TOP_DIR),)
+ export PKG_TOP_DIR := $(shell p=$$PWD; while :; do \
+ [ -e $$p/env.mk -o -z "$$p" ] && { echo $$p; break; }; p=$${p%/*}; done)
+ export _TOP_DIR := $(shell p=$$PWD; while :; do \
+ [ -d $$p/.git -o -z "$$p" ] && { echo $$p; break; }; p=$${p%/*}; done)
+ -include $(PKG_TOP_DIR)/env.mk
+endif
+include $(TENV)
+ifeq ($(_TOP_DIR),)
+ _TOP_DIR=/mnt/tests/$(TOPLEVEL_NAMESPACE)
+endif
+
+export TESTVERSION=1.0
+
+BUILT_FILES=
+
+FILES=$(METADATA) runtest.sh Makefile PURPOSE _env t_get_seals.c t_memfd_create.c
+
+.PHONY: all install download clean
+
+run: $(FILES) build
+ ./runtest.sh
+
+build: $(BUILT_FILES)
+ test -x runtest.sh || chmod a+x runtest.sh
+
+clean:
+ rm -f *~ $(BUILT_FILES)
+
+
+include /usr/share/rhts/lib/rhts-make.include
+
+$(METADATA): Makefile
+ @echo "Owner: Shu Wang <shuwang@redhat.com>" > $(METADATA)
+ @echo "Name: $(TEST)" >> $(METADATA)
+ @echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
+ @echo "Path: $(TEST_DIR)" >> $(METADATA)
+ @echo "Description: Test for memfd_create syscall." >> $(METADATA)
+ @echo "Type: Function" >> $(METADATA)
+ @echo "TestTime: 20m" >> $(METADATA)
+ @echo "RunFor: kernel" >> $(METADATA)
+ @echo "Priority: Normal" >> $(METADATA)
+ @echo "License: GPLv2+" >> $(METADATA)
+ @echo "Confidential: no" >> $(METADATA)
+ @echo "Destructive: no" >> $(METADATA)
+ rhts-lint $(METADATA)
diff --git a/tests/memory/memfd_create/PURPOSE b/tests/memory/memfd_create/PURPOSE
new file mode 100644
index 000000000..f588ec734
--- /dev/null
+++ b/tests/memory/memfd_create/PURPOSE
@@ -0,0 +1,3 @@
+PURPOSE:
+Description: tests for memfd_create syscall.
+Author: Shu Wang <shuwang@redhat.com>
diff --git a/tests/memory/memfd_create/_env b/tests/memory/memfd_create/_env
new file mode 100644
index 000000000..5dd5fe078
--- /dev/null
+++ b/tests/memory/memfd_create/_env
@@ -0,0 +1,8 @@
+#This file was generated automatically,do not manually change it.
+export TOPLEVEL_NAMESPACE=kernel
+export PKG_NAMESPACE=kernel/general
+export RELATIVE_PATH=memory/function/memfd_create
+export PACKAGE=general
+export PACKAGE_NAME=general
+export PKG_LIST=
+export TEST=/kernel/general/memory/function/memfd_create
diff --git a/tests/memory/memfd_create/runtest.sh b/tests/memory/memfd_create/runtest.sh
new file mode 100755
index 000000000..24dfeb5b6
--- /dev/null
+++ b/tests/memory/memfd_create/runtest.sh
@@ -0,0 +1,54 @@
+#!/bin/bash
+# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+# Description: memfd_create test
+# Author: Shu Wang <shuwang@redhat.com>
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+# Copyright (c) 2016 Red Hat, Inc.
+#
+# This program is free software: you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation, either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be
+# useful, but WITHOUT ANY WARRANTY; without even the implied
+# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+# PURPOSE. See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see http://www.gnu.org/licenses/.
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+# Include Beaker environment
+. /usr/bin/rhts-environment.sh || exit 1
+. /usr/share/beakerlib/beakerlib.sh || exit 1
+
+gcc t_memfd_create.c -o t_memfd_create &&
+gcc t_get_seals.c -o t_get_seals
+if [ $? != 0 ]; then
+ rlLog "memfd_create is not supported."
+ report_result Test_Skipped PASS 99
+ exit 0
+fi
+
+function sanity_memfd_create()
+{
+ rlRun "./t_memfd_create memf 1024 gswS &"
+ rlRun "./t_get_seals /proc/$!/fd/3 > seals"
+ rlRun "cat ./seals"
+ rlAssertGrep "SEAL GROW WRITE SHRINK" ./seals
+ rlRun "pkill t_memfd_create"
+}
+
+
+rlJournalStart
+ rlPhaseStartTest "sanity"
+ sanity_memfd_create
+ rlPhaseEnd
+rlJournalEnd
+rlJournalPrintText
diff --git a/tests/memory/memfd_create/t_get_seals.c b/tests/memory/memfd_create/t_get_seals.c
new file mode 100644
index 000000000..8babe34d2
--- /dev/null
+++ b/tests/memory/memfd_create/t_get_seals.c
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2016 Red Hat, Inc.
+ *
+ * This program is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be
+ * useful, but WITHOUT ANY WARRANTY; without even the implied
+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see http://www.gnu.org/licenses/.
+ *
+ */
+
+#include <linux/fcntl.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+
+#define errExit(msg) do { perror(msg); exit(EXIT_FAILURE); \
+} while (0)
+
+int main(int argc, char *argv[])
+{
+ int fd;
+ unsigned int seals;
+
+ if (argc != 2) {
+ fprintf(stderr, "%s /proc/PID/fd/FD\n", argv[0]);
+ exit(EXIT_FAILURE);
+ }
+
+ fd = open(argv[1], O_RDWR);
+ if (fd == -1)
+ errExit("open");
+
+ seals = fcntl(fd, F_GET_SEALS);
+ if (seals == -1)
+ errExit("fcntl");
+
+ printf("Existing seals:");
+ if (seals & F_SEAL_SEAL)
+ printf(" SEAL");
+ if (seals & F_SEAL_GROW)
+ printf(" GROW");
+ if (seals & F_SEAL_WRITE)
+ printf(" WRITE");
+ if (seals & F_SEAL_SHRINK)
+ printf(" SHRINK");
+ printf("\n");
+
+ /* Code to map the file and access the contents of the
+ resulting mapping omitted */
+
+ exit(EXIT_SUCCESS);
+}
+
diff --git a/tests/memory/memfd_create/t_memfd_create.c b/tests/memory/memfd_create/t_memfd_create.c
new file mode 100644
index 000000000..73d641a6e
--- /dev/null
+++ b/tests/memory/memfd_create/t_memfd_create.c
@@ -0,0 +1,102 @@
+/*
+ * Copyright (c) 2016 Red Hat, Inc.
+ *
+ * This program is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be
+ * useful, but WITHOUT ANY WARRANTY; without even the implied
+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see http://www.gnu.org/licenses/.
+ *
+ */
+
+#include <linux/memfd.h>
+#include <linux/fcntl.h>
+#include <sys/syscall.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <stdio.h>
+
+#define errExit(msg) do { perror(msg); exit(EXIT_FAILURE); \
+} while (0)
+
+int main(int argc, char *argv[])
+{
+ int fd;
+ unsigned int seals;
+ char *addr;
+ char *name, *seals_arg;
+ ssize_t len;
+ char* message = "this is a test message for memfd\n";
+
+ if (argc < 3) {
+ fprintf(stderr, "%s name size [seals]\n", argv[0]);
+ fprintf(stderr, "\t'seals' can contain any of the "
+ "following characters:\n");
+ fprintf(stderr, "\t\tg - F_SEAL_GROW\n");
+ fprintf(stderr, "\t\ts - F_SEAL_SHRINK\n");
+ fprintf(stderr, "\t\tw - F_SEAL_WRITE\n");
+ fprintf(stderr, "\t\tS - F_SEAL_SEAL\n");
+ exit(EXIT_FAILURE);
+ }
+
+ name = argv[1];
+ len = atoi(argv[2]);
+ seals_arg = argv[3];
+
+ /* Create an anonymous file in tmpfs; allow seals to be
+ placed on the file */
+
+ fd = syscall(SYS_memfd_create, name, MFD_ALLOW_SEALING);
+ if (fd == -1)
+ errExit("memfd_create");
+
+ /* Size the file as specified on the command line */
+
+ if (ftruncate(fd, len) == -1)
+ errExit("truncate");
+
+ if (write(fd, message, strlen(message)) <= 0)
+ errExit("write");
+
+ //printf("PID: %ld; fd: %d; /proc/%ld/fd/%d\n",
+ // (long) getpid(), fd, (long) getpid(), fd);
+ printf("/proc/%ld/fd/%d\n", (long) getpid(), fd);
+
+ /* Code to map the file and populate the mapping with data
+ omitted */
+
+ /* If a 'seals' command-line argument was supplied, set some
+ seals on the file */
+
+ if (seals_arg != NULL) {
+ seals = 0;
+
+ if (strchr(seals_arg, 'g') != NULL)
+ seals |= F_SEAL_GROW;
+ if (strchr(seals_arg, 's') != NULL)
+ seals |= F_SEAL_SHRINK;
+ if (strchr(seals_arg, 'w') != NULL)
+ seals |= F_SEAL_WRITE;
+ if (strchr(seals_arg, 'S') != NULL)
+ seals |= F_SEAL_SEAL;
+
+ if (fcntl(fd, F_ADD_SEALS, seals) == -1)
+ errExit("fcntl");
+ }
+
+ /* Keep running, so that the file created by memfd_create()
+ continues to exist */
+
+ pause();
+
+ exit(EXIT_SUCCESS);
+}
+
diff --git a/tests/tests.yml b/tests/tests.yml
new file mode 100644
index 000000000..9e4fb3826
--- /dev/null
+++ b/tests/tests.yml
@@ -0,0 +1,6 @@
+---
+- name: memory test
+ import_playbook: memory.yml
+
+- name: filesystem test
+ import_playbook: filesystem.yml