diff --git a/0001-Fix-query-watchdog-avoid-issues-on-heap-allocation-f.patch b/0001-Fix-query-watchdog-avoid-issues-on-heap-allocation-f.patch new file mode 100644 index 0000000000000000000000000000000000000000..3b0696a1bf23069d2dee4895a0457e8daa62bcab --- /dev/null +++ b/0001-Fix-query-watchdog-avoid-issues-on-heap-allocation-f.patch @@ -0,0 +1,84 @@ +From 030d7edb179235b7df65ada3a79837b01e682a5b Mon Sep 17 00:00:00 2001 +From: Klaus Wenninger +Date: Thu, 21 Jul 2022 10:48:21 +0200 +Subject: [PATCH] Fix: query-watchdog: avoid issues on heap allocation failing + +coverity is moaning either due to slight code rearangement +or new version/settings. +--- + src/sbd-common.c | 27 ++++++++++++++++++++++++++- + 1 file changed, 26 insertions(+), 1 deletion(-) + +diff --git a/src/sbd-common.c b/src/sbd-common.c +index f3f226a..3abf75f 100644 +--- a/src/sbd-common.c ++++ b/src/sbd-common.c +@@ -385,8 +385,17 @@ watchdog_populate_list(void) + struct link_list_item *lli = + calloc(1, sizeof(struct link_list_item)); + ++ if (lli == NULL) { ++ break; ++ } + lli->dev_node = strdup(buf); + lli->link_name = strdup(entry_name); ++ if ((lli->dev_node == NULL) || (lli->link_name == NULL)) { ++ free(lli->dev_node); ++ free(lli->link_name); ++ free(lli); ++ break; ++ } + lli->next = link_list; + link_list = lli; + } +@@ -404,18 +413,27 @@ watchdog_populate_list(void) + if(!stat(entry_name, &statbuf) && S_ISCHR(statbuf.st_mode) && + is_watchdog(statbuf.st_rdev)) { + +- int wdfd = watchdog_init_fd(entry_name, -1); ++ int wdfd; + struct watchdog_list_item *wdg = + calloc(1, sizeof(struct watchdog_list_item)); + int len; + struct link_list_item *tmp_list = NULL; + ++ if (wdg == NULL) { ++ break; ++ } ++ + wdg->dev = statbuf.st_rdev; + wdg->dev_node = strdup(entry_name); ++ if (wdg->dev_node == NULL) { ++ free(wdg); ++ break; ++ } + wdg->next = watchdog_list; + watchdog_list = wdg; + watchdog_list_items++; + ++ wdfd = watchdog_init_fd(entry_name, -1); + if (wdfd >= 0) { + struct watchdog_info ident; + +@@ -450,11 +468,18 @@ watchdog_populate_list(void) + struct watchdog_list_item *dupe_wdg = + calloc(1, sizeof(struct watchdog_list_item)); + ++ if (dupe_wdg == NULL) { ++ break; ++ } + /* as long as we never purge watchdog_list + * there is no need to dupe strings + */ + *dupe_wdg = *wdg; + dupe_wdg->dev_node = strdup(tmp_list->link_name); ++ if (dupe_wdg->dev_node == NULL) { ++ free(dupe_wdg); ++ break; ++ } + dupe_wdg->next = watchdog_list; + watchdog_list = dupe_wdg; + watchdog_list_items++; +-- +2.39.0 + diff --git a/0001-Fix-the-problem-of-service-error-when-uninstalling.patch b/0001-Fix-the-problem-of-service-error-when-uninstalling.patch deleted file mode 100644 index d68efc1674adacfd346e8f0c3e414a4b46de69f4..0000000000000000000000000000000000000000 --- a/0001-Fix-the-problem-of-service-error-when-uninstalling.patch +++ /dev/null @@ -1,39 +0,0 @@ -From 5925e37bb7aa3fe787478a2bf1f0b4bbbc2b93fb Mon Sep 17 00:00:00 2001 -From: jiangxinyu -Date: Mon, 28 Mar 2022 14:43:59 +0800 -Subject: [PATCH] Fix the problem of service error when uninstalling - ---- - src/sbd.service.in | 2 +- - src/sbd_remote.service.in | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -diff --git a/src/sbd.service.in b/src/sbd.service.in -index 94b0f99..b51f570 100644 ---- a/src/sbd.service.in -+++ b/src/sbd.service.in -@@ -5,7 +5,7 @@ Before=pacemaker.service - Before=dlm.service - After=systemd-modules-load.service iscsi.service - PartOf=corosync.service --RefuseManualStop=true -+RefuseManualStop=no - RefuseManualStart=true - - [Service] -diff --git a/src/sbd_remote.service.in b/src/sbd_remote.service.in -index cfcafb5..7392446 100644 ---- a/src/sbd_remote.service.in -+++ b/src/sbd_remote.service.in -@@ -3,7 +3,7 @@ Description=Shared-storage based fencing daemon on pacemaker remote node - Documentation=man:sbd(8) - After=systemd-modules-load.service iscsi.service - PartOf=pacemaker_remote.service --RefuseManualStop=true -+RefuseManualStop=no - RefuseManualStart=true - - [Service] --- -2.33.0 - diff --git a/0002-Refactor-sbd-md-alloc-de-alloc-reverse-order.patch b/0002-Refactor-sbd-md-alloc-de-alloc-reverse-order.patch new file mode 100644 index 0000000000000000000000000000000000000000..81cf4448f19750c4ca53bed972fdd0fa5b059eb4 --- /dev/null +++ b/0002-Refactor-sbd-md-alloc-de-alloc-reverse-order.patch @@ -0,0 +1,56 @@ +From 48c9a11e5b4ace22011e51d4c5dcacaddf9bbc43 Mon Sep 17 00:00:00 2001 +From: Klaus Wenninger +Date: Fri, 3 Feb 2023 10:58:10 +0100 +Subject: [PATCH] Refactor: sbd-md: alloc/de-alloc reverse order + +Having de-allocation in the reverse order compared to +allocation seems to make gcc-12 static analysis of +dynamic-memory-management happy. +--- + src/sbd-md.c | 11 +++++------ + 1 file changed, 5 insertions(+), 6 deletions(-) + +diff --git a/src/sbd-md.c b/src/sbd-md.c +index 7a37522..2a237ad 100644 +--- a/src/sbd-md.c ++++ b/src/sbd-md.c +@@ -441,9 +441,9 @@ init_device(struct sbd_context *st) + } + } + +-out: free(s_node); ++out: free(s_mbox); ++ free(s_node); + free(s_header); +- free(s_mbox); + return(rc); + } + +@@ -556,9 +556,9 @@ slot_allocate(struct sbd_context *st, const char *name) + } + } + +-out: free(s_node); ++out: free(s_mbox); ++ free(s_node); + free(s_header); +- free(s_mbox); + return(rc); + } + +@@ -1279,11 +1279,10 @@ int servant_md(const char *diskname, int mode, const void* argp) + } + } + out: +- free(s_header); + free(s_node); + free(s_mbox); ++ free(s_header); + close_device(st); + exit(rc); + } + +- +-- +2.39.0 + diff --git a/0003-spec-convert-license-naming-to-SPDX.patch b/0003-spec-convert-license-naming-to-SPDX.patch new file mode 100644 index 0000000000000000000000000000000000000000..5d3eddc25a9b19c9833041a6f91b452350cd7cda --- /dev/null +++ b/0003-spec-convert-license-naming-to-SPDX.patch @@ -0,0 +1,34 @@ +From 0e4534ebdfe8d7a37beb0028e604e560a5674891 Mon Sep 17 00:00:00 2001 +From: Klaus Wenninger +Date: Fri, 3 Feb 2023 15:35:22 +0100 +Subject: [PATCH] spec: convert license naming to SPDX + +--- + sbd.spec | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/sbd.spec b/sbd.spec +index e9ff7bc..b9e7f72 100644 +--- a/sbd.spec ++++ b/sbd.spec +@@ -49,7 +49,7 @@ + + Name: sbd + Summary: Storage-based death +-License: GPLv2+ ++License: GPL-2.0-or-later + Group: System Environment/Daemons + Version: 1.5.2 + Release: 99.%{buildnum}.%{shortcommit}.%{modified}git%{?dist} +@@ -95,7 +95,7 @@ Available rpmbuild rebuild options: + + %package tests + Summary: Storage-based death environment for regression tests +-License: GPLv2+ ++License: GPL-2.0-or-later + Group: System Environment/Daemons + + %description tests +-- +2.39.0 + diff --git a/sbd-cf5c2208bad2db2dff9b09624b89b05415c3bc11.tar.gz b/sbd-cf5c2208bad2db2dff9b09624b89b05415c3bc11.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..cb8d3c3346e59670609e8a60417572bf779a1bfe Binary files /dev/null and b/sbd-cf5c2208bad2db2dff9b09624b89b05415c3bc11.tar.gz differ diff --git a/sbd.spec b/sbd.spec index 436d2e2012b1459deacc06cf06709324fd5e9a60..c2093cffe3e479e3d2f26836bf94a6371edcd2a5 100644 --- a/sbd.spec +++ b/sbd.spec @@ -1,4 +1,4 @@ -%global longcommit 6bb085f5704dd4c3841c79504f2aed2228e6d76a +%global longcommit cf5c2208bad2db2dff9b09624b89b05415c3bc11 %global shortcommit %(echo %{longcommit}|cut -c1-8) %global modified %(echo %{longcommit}-|cut -f2 -d-) %global github_owner Clusterlabs @@ -10,45 +10,46 @@ Name: sbd Summary: Storage-based death -License: GPLv2 and MIT -Group: System Environment/Daemons -Version: 1.5.1 -Release: %{buildnum} +License: GPL-2.0-or-later +Version: 1.5.2 +Release: 1 Url: https://github.com/%{github_owner}/%{name} Source0: https://github.com/%{github_owner}/%{name}/archive/%{longcommit}/%{name}-%{longcommit}.tar.gz -Patch0: 0001-Fix-the-problem-of-service-error-when-uninstalling.patch -BuildRoot: %{_tmppath}/%{name}-%{version}-build +Patch0: 0001-Fix-query-watchdog-avoid-issues-on-heap-allocation-f.patch +Patch1: 0002-Refactor-sbd-md-alloc-de-alloc-reverse-order.patch +Patch2: 0003-spec-convert-license-naming-to-SPDX.patch BuildRequires: autoconf BuildRequires: automake BuildRequires: libuuid-devel BuildRequires: glib2-devel BuildRequires: libaio-devel -BuildRequires: corosynclib-devel -BuildRequires: pacemaker-libs-devel > 1.1.12 +BuildRequires: corosync-devel +BuildRequires: pacemaker-libs-devel BuildRequires: libtool BuildRequires: libuuid-devel BuildRequires: libxml2-devel BuildRequires: pkgconfig -BuildRequires: systemd BuildRequires: make -Conflicts: fence-agents-sbd < 4.2.1 -Conflicts: pacemaker-libs < 2.0.5 +BuildRequires: systemd +Conflicts: fence-agents-sbd < 4.5.0 +Conflicts: pacemaker-libs < 2.1.0-5 -ExclusiveArch: x86_64 aarch64 riscv64 +ExclusiveArch: x86_64 aarch64 riscv64 %if %{defined systemd_requires} %systemd_requires %endif %description + This package contains the storage-based death functionality. + Available rpmbuild rebuild options: --with(out) : sync_resource_startup_default -%package tests +%package tests Summary: Storage-based death environment for regression tests -License: GPLv2 and MIT -Group: System Environment/Daemons +License: GPL-2.0-or-later %description tests This package provides an environment + testscripts for @@ -63,13 +64,14 @@ export CFLAGS="$RPM_OPT_FLAGS -Wall -Werror" %configure --with-watchdog-timeout-default=%{watchdog_timeout_default} \ --with-sync-resource-startup-default=%{?with_sync_resource_startup_default:yes}%{!?with_sync_resource_startup_default:no} \ --with-sync-resource-startup-sysconfig=%{sync_resource_startup_sysconfig} \ - --with-runstatedir=%{_rundir} + --runstatedir=%{_rundir} make %{?_smp_mflags} - %install + make DESTDIR=$RPM_BUILD_ROOT LIBDIR=%{_libdir} install rm -rf ${RPM_BUILD_ROOT}%{_libdir}/stonith + install -D -m 0755 tests/regressions.sh $RPM_BUILD_ROOT/usr/share/sbd/regressions.sh %if %{defined _unitdir} install -D -m 0644 src/sbd.service $RPM_BUILD_ROOT/%{_unitdir}/sbd.service @@ -83,10 +85,6 @@ install -m 644 src/sbd.sysconfig ${RPM_BUILD_ROOT}%{_sysconfdir}/sysconfig/sbd find %{buildroot} -name '*.a' -type f -print0 | xargs -0 rm -f find %{buildroot} -name '*.la' -type f -print0 | xargs -0 rm -f - -%clean -rm -rf %{buildroot} - %if %{defined _unitdir} %post %systemd_post sbd.service @@ -132,6 +130,9 @@ fi %{_libdir}/libsbdtestbed* %changelog +* Mon Jul 31 2023 zouzhimin - 1.5.2-1 +- Upgrade the sbd package version to 1.5.2-1 + * Mon Jun 05 2023 laokz - 1.5.1-2 - Add riscv64 to ExclusiveArch