Compare commits
10 Commits
9a67f950af
...
918f50f586
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
918f50f586 | ||
|
|
cc5b7b9051 | ||
|
|
89180e7db3 | ||
|
|
6dba89320c | ||
|
|
a23b3c3195 | ||
|
|
cbb3a0fa56 | ||
|
|
4cede45962 | ||
|
|
7e19852438 | ||
|
|
61de1f5964 | ||
|
|
cdcaa3dd25 |
@ -1,32 +0,0 @@
|
||||
From b0d9cad81f2e811608b898922643f655043361aa Mon Sep 17 00:00:00 2001
|
||||
From: Vishal Verma <vishal.l.verma@intel.com>
|
||||
Date: Tue, 21 Jul 2020 23:17:27 -0600
|
||||
Subject: [PATCH 1/2] ndctl/namespace: fix a resource leak in
|
||||
file_write_infoblock()
|
||||
|
||||
Static analysis showed that we might leak 'fd' in the given function.
|
||||
Fix the error path to close(fd) if 'fd >= 0' rather than just 'fd > 0'.
|
||||
|
||||
Fixes: 7787807bcffe ("ndctl/namespace: Add write-infoblock command")
|
||||
Cc: Dan Williams <dan.j.williams@intel.com>
|
||||
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
|
||||
---
|
||||
ndctl/namespace.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/ndctl/namespace.c b/ndctl/namespace.c
|
||||
index 0550580..17e67c9 100644
|
||||
--- a/ndctl/namespace.c
|
||||
+++ b/ndctl/namespace.c
|
||||
@@ -1977,7 +1977,7 @@ static int file_write_infoblock(const char *path)
|
||||
|
||||
free(buf);
|
||||
out:
|
||||
- if (fd > 0 && fd != STDOUT_FILENO)
|
||||
+ if (fd >= 0 && fd != STDOUT_FILENO)
|
||||
close(fd);
|
||||
return rc;
|
||||
}
|
||||
--
|
||||
1.8.3.1
|
||||
|
||||
40
0001-ndctl-test-Fix-device-dax-mremap-test.patch
Normal file
40
0001-ndctl-test-Fix-device-dax-mremap-test.patch
Normal file
@ -0,0 +1,40 @@
|
||||
From 6694afe31dd67d186199a58d2252be5ea3472692 Mon Sep 17 00:00:00 2001
|
||||
From: Dan Williams <dan.j.williams@intel.com>
|
||||
Date: Tue, 12 Jan 2021 23:15:09 -0800
|
||||
Subject: [PATCH] ndctl/test: Fix device-dax mremap() test
|
||||
|
||||
The test_dax_remap() test is a regression check for mishandling of mremap()
|
||||
in the presence of pmd_devmap(). My understanding is that it was a fuzzing
|
||||
condition not something an application would want to do in practice.
|
||||
|
||||
On recent kernels with commit 73d5e0629919 ("mremap: check if it's possible
|
||||
to split original vma"), the test fails for device-dax. That seems an
|
||||
equally acceptable result of attempting this remap, so update the test
|
||||
rather than ask the kernel to preserve the old behaviour.
|
||||
|
||||
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
|
||||
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
|
||||
Link: https://lore.kernel.org/r/161052210936.1804207.17896246772670985157.stgit@dwillia2-desk3.amr.corp.intel.com
|
||||
---
|
||||
test/dax-pmd.c | 5 +++++
|
||||
1 file changed, 5 insertions(+)
|
||||
|
||||
diff --git a/test/dax-pmd.c b/test/dax-pmd.c
|
||||
index b1251db..7648e34 100644
|
||||
--- a/test/dax-pmd.c
|
||||
+++ b/test/dax-pmd.c
|
||||
@@ -69,6 +69,11 @@ int test_dax_remap(struct ndctl_test *test, int dax_fd, unsigned long align, voi
|
||||
|
||||
remap = mremap(addr, REMAP_SIZE, REMAP_SIZE, MREMAP_MAYMOVE|MREMAP_FIXED, anon);
|
||||
|
||||
+ if (remap == MAP_FAILED) {
|
||||
+ fprintf(stderr, "%s: mremap failed, that's ok too\n", __func__);
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
if (remap != anon) {
|
||||
rc = -ENXIO;
|
||||
perror("mremap");
|
||||
--
|
||||
2.33.0
|
||||
|
||||
@ -1,33 +0,0 @@
|
||||
From 2f99e11812e6a4d9814bfc8ef038ca845db5394c Mon Sep 17 00:00:00 2001
|
||||
From: Vishal Verma <vishal.l.verma@intel.com>
|
||||
Date: Thu, 1 Oct 2020 11:10:00 -0600
|
||||
Subject: [PATCH 2/2] libndctl: fix a potential buffer overflow
|
||||
|
||||
Static analysis points out that the 'buf' in ndctl_dimm_is_active was
|
||||
inappropriately sized. We already have 'SYSFS_ATTR_SIZE' for such
|
||||
buffers, and it looks like this was just an oversight.
|
||||
|
||||
Fixes: 0a4509d7de2f ("ndctl: enumerate interleave sets")
|
||||
Cc: Dan Williams <dan.j.williams@intel.com>
|
||||
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
|
||||
---
|
||||
ndctl/lib/libndctl.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/ndctl/lib/libndctl.c b/ndctl/lib/libndctl.c
|
||||
index ee737cb..5b276a7 100644
|
||||
--- a/ndctl/lib/libndctl.c
|
||||
+++ b/ndctl/lib/libndctl.c
|
||||
@@ -3292,8 +3292,8 @@ NDCTL_EXPORT int ndctl_dimm_is_active(struct ndctl_dimm *dimm)
|
||||
{
|
||||
struct ndctl_ctx *ctx = ndctl_dimm_get_ctx(dimm);
|
||||
char *path = dimm->dimm_buf;
|
||||
+ char buf[SYSFS_ATTR_SIZE];
|
||||
int len = dimm->buf_len;
|
||||
- char buf[20];
|
||||
|
||||
if (snprintf(path, len, "%s/state", dimm->dimm_path) >= len) {
|
||||
err(ctx, "%s: buffer too small!\n",
|
||||
--
|
||||
1.8.3.1
|
||||
|
||||
49
0002-zero_info_block-skip-seed-devices.patch
Normal file
49
0002-zero_info_block-skip-seed-devices.patch
Normal file
@ -0,0 +1,49 @@
|
||||
From fb13dfb8d84c4f0a749665c8f07179450b199f3e Mon Sep 17 00:00:00 2001
|
||||
From: Jeff Moyer <jmoyer@redhat.com>
|
||||
Date: Tue, 9 Feb 2021 16:51:53 -0500
|
||||
Subject: [PATCH] zero_info_block: skip seed devices
|
||||
|
||||
Currently, ndctl destroy-namespace -f all will output errors of the
|
||||
form:
|
||||
|
||||
Error: destroy namespace: namespace0.0 failed to enable for zeroing, continuing
|
||||
|
||||
for any zero-sized namespace. That particular namespace looks like this:
|
||||
|
||||
{
|
||||
"dev":"namespace0.0",
|
||||
"mode":"raw",
|
||||
"size":0,
|
||||
"uuid":"00000000-0000-0000-0000-000000000000",
|
||||
"sector_size":512,
|
||||
"state":"disabled"
|
||||
}
|
||||
|
||||
This patch skips over namespaces with size=0 when zeroing out info
|
||||
blocks.
|
||||
|
||||
Fixes: 46654c2d60b70 ("ndctl/namespace: Always zero info-blocks")
|
||||
Reported-by: Zhang Yi <yizhan@redhat.com>
|
||||
Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
|
||||
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
|
||||
Link: https://lore.kernel.org/r/x49r1lohpty.fsf@segfault.boston.devel.redhat.com
|
||||
---
|
||||
ndctl/namespace.c | 3 +++
|
||||
1 file changed, 3 insertions(+)
|
||||
|
||||
diff --git a/ndctl/namespace.c b/ndctl/namespace.c
|
||||
index 1feb74d..1e8a2cd 100644
|
||||
--- a/ndctl/namespace.c
|
||||
+++ b/ndctl/namespace.c
|
||||
@@ -1052,6 +1052,9 @@ static int zero_info_block(struct ndctl_namespace *ndns)
|
||||
void *buf = NULL, *read_buf = NULL;
|
||||
char path[50];
|
||||
|
||||
+ if (ndctl_namespace_get_size(ndns) == 0)
|
||||
+ return 1;
|
||||
+
|
||||
ndctl_namespace_set_raw_mode(ndns, 1);
|
||||
rc = ndctl_namespace_enable(ndns);
|
||||
if (rc < 0) {
|
||||
--
|
||||
2.37.0.windows.1
|
||||
BIN
ndctl-68.tar.gz
BIN
ndctl-68.tar.gz
Binary file not shown.
BIN
ndctl-71.1.tar.gz
Normal file
BIN
ndctl-71.1.tar.gz
Normal file
Binary file not shown.
39
ndctl.spec
39
ndctl.spec
@ -1,14 +1,14 @@
|
||||
Name: ndctl
|
||||
Version: 68
|
||||
Release: 2
|
||||
Version: 71.1
|
||||
Release: 5
|
||||
Summary: Manage "libnvdimm" subsystem devices (Non-volatile Memory)
|
||||
License: GPLv2
|
||||
License: GPL-2, LGPL-2.1, MIT, CC0-1.0
|
||||
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
|
||||
|
||||
Patch1: 0001-ndctl-namespace-fix-a-resource-leak-in-file_write_in.patch
|
||||
Patch2: 0002-libndctl-fix-a-potential-buffer-overflow.patch
|
||||
Patch1: 0001-ndctl-test-Fix-device-dax-mremap-test.patch
|
||||
Patch2: 0002-zero_info_block-skip-seed-devices.patch
|
||||
|
||||
Requires: ndctl-libs%{?_isa} = %{version}-%{release}
|
||||
Requires: daxctl-libs%{?_isa} = %{version}-%{release}
|
||||
@ -90,7 +90,7 @@ control API for these devices.
|
||||
|
||||
|
||||
%prep
|
||||
%autosetup -Sgit -n ndctl-%{version}
|
||||
%autosetup -n ndctl-%{version} -p1
|
||||
|
||||
%build
|
||||
echo %{version} > version
|
||||
@ -116,7 +116,7 @@ make check
|
||||
%define bashcompdir %(pkg-config --variable=completionsdir bash-completion)
|
||||
|
||||
%files
|
||||
%license util/COPYING licenses/BSD-MIT licenses/CC0
|
||||
%license LICENSES/preferred/GPL-2.0 LICENSES/other/MIT LICENSES/other/CC0-1.0
|
||||
%{_bindir}/ndctl
|
||||
%{_mandir}/man1/ndctl*
|
||||
%{bashcompdir}/
|
||||
@ -126,35 +126,50 @@ make check
|
||||
%{_sysconfdir}/modprobe.d/nvdimm-security.conf
|
||||
|
||||
%files -n daxctl
|
||||
%license util/COPYING licenses/BSD-MIT licenses/CC0
|
||||
%license LICENSES/preferred/GPL-2.0 LICENSES/other/MIT LICENSES/other/CC0-1.0
|
||||
%{_bindir}/daxctl
|
||||
%{_mandir}/man1/daxctl*
|
||||
%{_datadir}/daxctl/daxctl.conf
|
||||
|
||||
%files -n ndctl-libs
|
||||
%doc README.md
|
||||
%license COPYING licenses/BSD-MIT licenses/CC0
|
||||
%license LICENSES/preferred/LGPL-2.1 LICENSES/other/MIT LICENSES/other/CC0-1.0
|
||||
%{_libdir}/libndctl.so.*
|
||||
|
||||
%files -n daxctl-libs
|
||||
%doc README.md
|
||||
%license COPYING licenses/BSD-MIT licenses/CC0
|
||||
%license LICENSES/preferred/LGPL-2.1 LICENSES/other/MIT LICENSES/other/CC0-1.0
|
||||
%{_libdir}/libdaxctl.so.*
|
||||
|
||||
%files -n ndctl-devel
|
||||
%license COPYING
|
||||
%license LICENSES/preferred/LGPL-2.1
|
||||
%{_includedir}/ndctl/
|
||||
%{_libdir}/libndctl.so
|
||||
%{_libdir}/pkgconfig/libndctl.pc
|
||||
|
||||
%files -n daxctl-devel
|
||||
%license COPYING
|
||||
%license LICENSES/preferred/LGPL-2.1
|
||||
%{_includedir}/daxctl/
|
||||
%{_libdir}/libdaxctl.so
|
||||
%{_libdir}/pkgconfig/libdaxctl.pc
|
||||
|
||||
|
||||
%changelog
|
||||
* Fri Jan 6 2023 lihaoxiang <lihaoxiang9@huawei.com> - 71.1-5
|
||||
- fix ndctl delete namespace exception
|
||||
|
||||
* Thu Oct 20 2022 liusirui <liusirui@huawei.com> - 71.1-4
|
||||
- backport patch to fix test case
|
||||
|
||||
* Mon Aug 02 2021 chenyanpanHW <chenyanpan@huawei.com> - 71.1-3
|
||||
- DESC: delete -Sgit from %autosetup, and delete BuildRequires git
|
||||
|
||||
* Tue Jun 29 2021 zhouwenpei <zhouwenpei1@huawei.com> - 71.1-2
|
||||
- add buildrequire git
|
||||
|
||||
* Thu Jan 28 2021 Zhiqiang Liu <liuzhiqiang26@huawei.com> - 71.1-1
|
||||
- update ndctl to v71.1 latest version
|
||||
|
||||
* Fri Oct 30 2020 Zhiqiang Liu <liuzhiqiang26@huawei.com> - 68-2
|
||||
- backport upstream patches to fix some potential problems
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user