diff --git a/SOURCES/daxctl-remove-migrate-device-model.patch b/SOURCES/daxctl-remove-migrate-device-model.patch new file mode 100644 index 00000000..e5397569 --- /dev/null +++ b/SOURCES/daxctl-remove-migrate-device-model.patch @@ -0,0 +1,140 @@ +diff -uprN ndctl-65.orig/Documentation/daxctl/Makefile.am ndctl-65/Documentation/daxctl/Makefile.am +--- ndctl-65.orig/Documentation/daxctl/Makefile.am 2019-07-29 14:41:44.474017128 -0400 ++++ ndctl-65/Documentation/daxctl/Makefile.am 2019-07-29 14:53:17.934283220 -0400 +@@ -27,8 +27,7 @@ endif + + man1_MANS = \ + daxctl.1 \ +- daxctl-list.1 \ +- daxctl-migrate-device-model.1 ++ daxctl-list.1 + + CLEANFILES = $(man1_MANS) + +diff -uprN ndctl-65.orig/Documentation/daxctl/daxctl-migrate-device-model.txt ndctl-65/Documentation/daxctl/daxctl-migrate-device-model.txt +--- ndctl-65.orig/Documentation/daxctl/daxctl-migrate-device-model.txt 2019-07-29 14:41:44.473017124 -0400 ++++ ndctl-65/Documentation/daxctl/daxctl-migrate-device-model.txt 1969-12-31 19:00:00.000000000 -0500 +@@ -1,47 +0,0 @@ +-// SPDX-License-Identifier: GPL-2.0 +- +-daxctl-migrate-device-model(1) +-============================== +- +-NAME +----- +-daxctl-migrate-device-model - Opt-in to the /sys/bus/dax device-model, +-allow for alternative Device-DAX instance drivers. +- +-SYNOPSIS +--------- +-[verse] +-'daxctl migrate-device-model' +- +-Arrange for modprobe to disable the dax_pmem_compat, if present, and +-instead deploy the dax_pmem module to convert to the /sys/bus/dax model. +-Kernel versions prior to v5.1 may not support /sys/bus/dax in which case +-the result of this command is a nop until the kernel is updated. The +-motivation for changing from /sys/class/dax to /sys/bus/dax is to allow +-for alternative drivers for Device-DAX instances, in particular the +-dax_kmem driver. +- +-By default device-dax publishes a /dev/daxX.Y character device for +-userspace to directly map performance differentiated memory. This is +-fine if the memory is to be exclusively consumed / managed by userspace. +-Alternatively an administrator may want the kernel to manage the memory, +-make it available via malloc(), allow for over-provisioning, and / or +-apply kernel-based resource control schemes to the memory. In that case +-the memory fronted by a given Device-DAX instance can be assigned to the +-dax_kmem driver which arranges for the core-kernel memory-management +-sub-system to assume management of the memory range. +- +-This behavior is opt-in for consideration of existing applications / +-scripts that may be hard coded to use /sys/class/dax. Fixes have been +-submitted to applications known to have these direct dependencies +-http://git.kernel.dk/cgit/fio/commit/?id=b08e7d6b18b4[FIO] +-https://github.com/pmem/pmdk/commit/91bc8620884e[PMDK], however, there may +-be others and a system-owner should be aware of the potential for +-regression of Device-DAX consuming scripts, applications, or older +-daxctl binaries. +- +-The modprobe policy established by this utility becomes effective after +-the next reboot, or after all DAX related modules have been removed and +-re-loaded with "udevadm trigger" +- +-include::../copyright.txt[] +diff -uprN ndctl-65.orig/daxctl/Makefile.am ndctl-65/daxctl/Makefile.am +--- ndctl-65.orig/daxctl/Makefile.am 2019-07-29 14:41:44.486017168 -0400 ++++ ndctl-65/daxctl/Makefile.am 2019-07-29 14:53:10.288257995 -0400 +@@ -14,7 +14,6 @@ config.h: $(srcdir)/Makefile.am + daxctl_SOURCES =\ + daxctl.c \ + list.c \ +- migrate.c \ + ../util/json.c + + daxctl_LDADD =\ +diff -uprN ndctl-65.orig/daxctl/builtin.h ndctl-65/daxctl/builtin.h +--- ndctl-65.orig/daxctl/builtin.h 2019-07-29 14:41:44.486017168 -0400 ++++ ndctl-65/daxctl/builtin.h 2019-07-29 14:53:10.288257995 -0400 +@@ -5,5 +5,4 @@ + + struct daxctl_ctx; + int cmd_list(int argc, const char **argv, struct daxctl_ctx *ctx); +-int cmd_migrate(int argc, const char **argv, struct daxctl_ctx *ctx); + #endif /* _DAXCTL_BUILTIN_H_ */ +diff -uprN ndctl-65.orig/daxctl/daxctl.c ndctl-65/daxctl/daxctl.c +--- ndctl-65.orig/daxctl/daxctl.c 2019-07-29 14:41:44.486017168 -0400 ++++ ndctl-65/daxctl/daxctl.c 2019-07-29 14:53:10.288257995 -0400 +@@ -70,7 +70,6 @@ static struct cmd_struct commands[] = { + { "version", .d_fn = cmd_version }, + { "list", .d_fn = cmd_list }, + { "help", .d_fn = cmd_help }, +- { "migrate-device-model", .d_fn = cmd_migrate }, + }; + + int main(int argc, const char **argv) +diff -uprN ndctl-65.orig/daxctl/migrate.c ndctl-65/daxctl/migrate.c +--- ndctl-65.orig/daxctl/migrate.c 2019-07-29 14:41:44.487017171 -0400 ++++ ndctl-65/daxctl/migrate.c 1969-12-31 19:00:00.000000000 -0500 +@@ -1,41 +0,0 @@ +-/* SPDX-License-Identifier: GPL-2.0 */ +-/* Copyright(c) 2019 Intel Corporation. All rights reserved. */ +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +- +-int cmd_migrate(int argc, const char **argv, struct daxctl_ctx *ctx) +-{ +- int i; +- static const struct option options[] = { +- OPT_END(), +- }; +- const char * const u[] = { +- "daxctl migrate-device-model", +- NULL +- }; +- +- argc = parse_options(argc, argv, options, u, 0); +- for (i = 0; i < argc; i++) +- error("unknown parameter \"%s\"\n", argv[i]); +- +- if (argc) +- usage_with_options(u, options); +- +- if (symlink(DAXCTL_MODPROBE_DATA, DAXCTL_MODPROBE_INSTALL) == 0) { +- fprintf(stderr, " success: installed %s\n", +- DAXCTL_MODPROBE_INSTALL); +- return EXIT_SUCCESS; +- } +- +- error("failed to install %s: %s\n", DAXCTL_MODPROBE_INSTALL, +- strerror(errno)); +- +- return EXIT_FAILURE; +-} diff --git a/SOURCES/dracut-nvdimm-security.conf b/SOURCES/dracut-nvdimm-security.conf new file mode 100644 index 00000000..fa83ad15 --- /dev/null +++ b/SOURCES/dracut-nvdimm-security.conf @@ -0,0 +1,3 @@ +# Make sure libnvdimm is loaded and ndctl is available in the initramfs +install_items+="/bin/ndctl" +add_drivers+=" libnvdimm " diff --git a/SOURCES/kmod-remove-space-before-semicolon-in-nvdimm-security-conf.patch b/SOURCES/kmod-remove-space-before-semicolon-in-nvdimm-security-conf.patch new file mode 100644 index 00000000..f576cd1a --- /dev/null +++ b/SOURCES/kmod-remove-space-before-semicolon-in-nvdimm-security-conf.patch @@ -0,0 +1,6 @@ +diff -up ndctl-65/contrib/nvdimm-security.conf.orig ndctl-65/contrib/nvdimm-security.conf +--- ndctl-65/contrib/nvdimm-security.conf.orig 2019-08-06 16:00:24.264089607 -0400 ++++ ndctl-65/contrib/nvdimm-security.conf 2019-08-06 16:00:34.971125206 -0400 +@@ -1 +1 @@ +-install libnvdimm /usr/bin/ndctl load-keys ; /sbin/modprobe --ignore-install libnvdimm $CMDLINE_OPTS ++install libnvdimm /usr/bin/ndctl load-keys; /sbin/modprobe --ignore-install libnvdimm $CMDLINE_OPTS diff --git a/SOURCES/ndctl-64-disable-asciidoctor.patch b/SOURCES/ndctl-64-disable-asciidoctor.patch new file mode 100644 index 00000000..1c576e5e --- /dev/null +++ b/SOURCES/ndctl-64-disable-asciidoctor.patch @@ -0,0 +1,12 @@ +diff -up ndctl-64.1/configure.ac.orig ndctl-64.1/configure.ac +--- ndctl-64.1/configure.ac.orig 2019-03-22 15:46:50.206526000 -0400 ++++ ndctl-64.1/configure.ac 2019-03-22 15:47:12.743488000 -0400 +@@ -45,7 +45,7 @@ AM_CONDITIONAL([ENABLE_DOCS], [test "x$e + AC_ARG_ENABLE([asciidoctor], + AS_HELP_STRING([--enable-asciidoctor], + [use asciidoctor for documentation build]), +- [], enable_asciidoctor=yes) ++ [], enable_asciidoctor=no) + AM_CONDITIONAL([USE_ASCIIDOCTOR], [test "x$enable_asciidoctor" = "xyes"]) + if test "x$enable_asciidoctor" = "xyes"; then + asciidoc="asciidoctor" diff --git a/SOURCES/ndctl-rhel7-fix-make-check.patch b/SOURCES/ndctl-rhel7-fix-make-check.patch new file mode 100644 index 00000000..e7545b1d --- /dev/null +++ b/SOURCES/ndctl-rhel7-fix-make-check.patch @@ -0,0 +1,95 @@ +diff --git a/test/core.c b/test/core.c +index b9e3bbf..4b36b2d 100644 +--- a/test/core.c ++++ b/test/core.c +@@ -129,8 +129,6 @@ int nfit_test_init(struct kmod_ctx **ctx, struct kmod_module **mod, + "nfit", + "device_dax", + "dax_pmem", +- "dax_pmem_core", +- "dax_pmem_compat", + "libnvdimm", + "nd_blk", + "nd_btt", +diff --git a/test/device-dax.c b/test/device-dax.c +index b19c1ed..d85862b 100644 +--- a/test/device-dax.c ++++ b/test/device-dax.c +@@ -166,6 +166,7 @@ static int __test_device_dax(unsigned long align, int loglevel, + if (!ndctl_test_attempt(test, KERNEL_VERSION(4, 7, 0))) + return 77; + ++#if 0 + /* setup up fsdax mode pmem device and seed with verification data */ + rc = setup_pmem_fsdax_mode(ndns, align); + if (rc < 0 || !(pfn = ndctl_namespace_get_pfn(ndns))) { +@@ -199,7 +200,7 @@ static int __test_device_dax(unsigned long align, int loglevel, + } + fsync(fd); + close(fd); +- ++#endif + /* switch the namespace to device-dax mode and verify data via mmap */ + rc = setup_device_dax(ndns, align); + if (rc < 0) { +@@ -219,6 +220,7 @@ static int __test_device_dax(unsigned long align, int loglevel, + } + + sprintf(path, "/dev/%s", daxctl_dev_get_devname(dev)); ++#if 0 + fd = open(path, O_RDONLY); + if (fd < 0) { + fprintf(stderr, "%s: failed to open(O_RDONLY) device-dax instance\n", +@@ -246,7 +248,7 @@ static int __test_device_dax(unsigned long align, int loglevel, + + close(fd); + munmap(buf, VERIFY_SIZE(align)); +- ++#endif + /* + * Prior to 4.8-final these tests cause crashes, or are + * otherwise not supported. +@@ -262,6 +264,7 @@ static int __test_device_dax(unsigned long align, int loglevel, + rc = -ENXIO; + goto out; + } ++ + rc = test_dax_directio(fd, align, NULL, 0); + if (rc) { + fprintf(stderr, "%s: failed dax direct-i/o\n", +diff --git a/test/libndctl.c b/test/libndctl.c +index 02bb9cc..2a20941 100644 +--- a/test/libndctl.c ++++ b/test/libndctl.c +@@ -160,9 +160,9 @@ static struct btt { + int enabled; + uuid_t uuid; + int num_sector_sizes; +- unsigned int sector_sizes[7]; ++ unsigned int sector_sizes[2]; + } default_btt = { +- 0, { 0, }, 7, { 512, 520, 528, 4096, 4104, 4160, 4224, }, ++ 0, { 0, }, 2, { 512, 4096, }, + }; + + struct pfn { +@@ -214,8 +214,8 @@ static struct btt btt_settings = { + .uuid = { 0, 1, 2, 3, 4, 5, 6, 7, + 8, 9, 10, 11, 12, 13, 14, 15 + }, +- .num_sector_sizes = 7, +- .sector_sizes = { 512, 520, 528, 4096, 4104, 4160, 4224, }, ++ .num_sector_sizes = 2, ++ .sector_sizes = { 512, 4096, }, + }; + + static struct pfn pfn_settings = { +@@ -250,7 +250,7 @@ struct namespace { + }; + + static uuid_t null_uuid; +-static unsigned long blk_sector_sizes[] = { 512, 520, 528, 4096, 4104, 4160, 4224, }; ++static unsigned long blk_sector_sizes[] = { 512, 4096, }; + static unsigned long pmem_sector_sizes[] = { 512, 4096 }; + static unsigned long io_sector_sizes[] = { 0 }; + diff --git a/SPECS/ndctl.spec b/SPECS/ndctl.spec index 8cd10baf..f69a74ed 100644 --- a/SPECS/ndctl.spec +++ b/SPECS/ndctl.spec @@ -1,11 +1,17 @@ Name: ndctl -Version: 62 -Release: 1%{?dist} +Version: 65 +Release: 5%{?dist} Summary: Manage "libnvdimm" subsystem devices (Non-volatile Memory) License: GPLv2 Group: System Environment/Base Url: https://github.com/pmem/ndctl Source0: https://github.com/pmem/%{name}/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz +Source1: dracut-nvdimm-security.conf + +Patch0: ndctl-64-disable-asciidoctor.patch +Patch1: ndctl-rhel7-fix-make-check.patch +Patch2: daxctl-remove-migrate-device-model.patch +Patch3: kmod-remove-space-before-semicolon-in-nvdimm-security-conf.patch Requires: ndctl-libs%{?_isa} = %{version}-%{release} Requires: daxctl-libs%{?_isa} = %{version}-%{release} @@ -20,7 +26,8 @@ BuildRequires: pkgconfig(libudev) BuildRequires: pkgconfig(uuid) BuildRequires: pkgconfig(json-c) BuildRequires: pkgconfig(bash-completion) -BuildRequires: systemd +BuildRequires: pkgconfig(systemd) +BuildRequires: keyutils-libs-devel %description Utility library for managing the "libnvdimm" subsystem. The "libnvdimm" @@ -87,6 +94,10 @@ control API for these devices. %prep %setup -q ndctl-%{version} +%patch0 -p1 +%patch1 -p1 +%patch2 -p1 +%patch3 -p1 chmod +x test/monitor.sh %build @@ -98,6 +109,7 @@ make %{?_smp_mflags} %install %make_install find $RPM_BUILD_ROOT -name '*.la' -exec rm -f {} ';' +install -Dp -m 0644 %{SOURCE1} $RPM_BUILD_ROOT/%{_sysconfdir}/dracut.conf.d/nvdimm-security.conf %check # There are x86-isms in the unit tests @@ -115,22 +127,24 @@ make check %postun -n daxctl-libs -p /sbin/ldconfig %define bashcompdir %(pkg-config --variable=completionsdir bash-completion) -%define udevdir %(pkg-config --variable=udevdir udev) %files %license util/COPYING licenses/BSD-MIT licenses/CC0 %{_bindir}/ndctl %{_mandir}/man1/ndctl* %{bashcompdir}/ -%{_sysconfdir}/ndctl/monitor.conf %{_unitdir}/ndctl-monitor.service -%{_udevrulesdir}/80-ndctl.rules -%{udevdir}/ndctl-udev +%{_sysconfdir}/ndctl/keys/keys.readme +%{_sysconfdir}/modprobe.d/nvdimm-security.conf +%{_sysconfdir}/dracut.conf.d/nvdimm-security.conf + +%config(noreplace) %{_sysconfdir}/ndctl/monitor.conf %files -n daxctl %license util/COPYING licenses/BSD-MIT licenses/CC0 %{_bindir}/daxctl %{_mandir}/man1/daxctl* +%{_datadir}/daxctl/daxctl.conf %files -n ndctl-libs %doc README.md @@ -156,6 +170,45 @@ make check %changelog +* Tue Sep 10 2019 Jeff Moyer - 65.5.el7 +- Once again attempt to fix nvdimm-security.conf +- Resolves: rhbz#1750199 + +* Mon Aug 12 2019 Jeff Moyer - 65.4.el7 +- Add spaces to the add_driver directive in the dracut module +- Resolves: rhbz#1740383 + +* Tue Aug 06 2019 Jeff Moyer - 65.3.el7 +- modify nvdimm-security.conf touse '&&' instead of ';' + Without this change, the module doesn't load +- Resolves: rhbz#1725405 + +* Mon Jul 29 2019 Jeff Moyer - 65.2.el7 +- Remove 'daxctl migrate-device-model' command. We won't + support hot-plugging device dax into the memory hierarchy + on RHEL 7. +- Resolves: rhbz#1734153 + +* Thu Jul 25 2019 Jeff Moyer - 65.1.el7 +- Rebase to v65 + - clear-errors: new command to clear errors on a namespace + - monitor: remove the requirement of a default config + - sanitize-dimm: allow a zero-key for secure-erase + - sanitize-dimm: preserve keys after an overwrite + - load-keys: fix for non-TPM keys +- Fix test harness to run against the rhel7 test kernel modules +- Related: rhbz#1722481 + +* Wed Mar 27 2019 Jeff Moyer - 64.1-2 +- Fix initramfs creating by forcing installation of libnvdimm.ko +- Related: bz#1634348 + +* Fri Mar 22 2019 Jeff Moyer - 64.1-1 +- Rebase to v64.1 (Jeff Moyer) + - add security commands + - fix broken udev rule for dirty shutdown count +- Resolves: bz#1634348 bz#1635441 + * Thu Aug 23 2018 Jeff Moyer - 62-1 - Rebase to v62 (Jeff Moyer) - a new monitor command / daemon