From 32671b36a1105b73d7079a68668e01e9188d8dbe Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Fri, 17 May 2024 17:28:29 -0700 Subject: [PATCH] mdadm: update to 4.3 Backport three patches, add one for GCC14, and add Alpine time_t patch for musl. Signed-off-by: Rosen Penev --- package/utils/mdadm/Makefile | 6 ++-- package/utils/mdadm/patches/010-falloc.patch | 36 +++++++++++++++++++ .../utils/mdadm/patches/020-basename.patch | 30 ++++++++++++++++ .../patches/030-fix-monitor-tv_sec.patch | 14 ++++++++ package/utils/mdadm/patches/040-udev.patch | 26 ++++++++++++++ package/utils/mdadm/patches/050-pie.patch | 33 +++++++++++++++++ .../mdadm/patches/100-cross_compile.patch | 2 +- .../utils/mdadm/patches/200-reduce_size.patch | 4 +-- 8 files changed, 145 insertions(+), 6 deletions(-) create mode 100644 package/utils/mdadm/patches/010-falloc.patch create mode 100644 package/utils/mdadm/patches/020-basename.patch create mode 100644 package/utils/mdadm/patches/030-fix-monitor-tv_sec.patch create mode 100644 package/utils/mdadm/patches/040-udev.patch create mode 100644 package/utils/mdadm/patches/050-pie.patch diff --git a/package/utils/mdadm/Makefile b/package/utils/mdadm/Makefile index 8070003394..c2778fe351 100644 --- a/package/utils/mdadm/Makefile +++ b/package/utils/mdadm/Makefile @@ -8,12 +8,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=mdadm -PKG_VERSION:=4.2 -PKG_RELEASE:=2 +PKG_VERSION:=4.3 +PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@KERNEL/linux/utils/raid/mdadm -PKG_HASH:=461c215670864bb74a4d1a3620684aa2b2f8296dffa06743f26dda5557acf01d +PKG_HASH:=416727ae1f1080ea6e3090cea36dd076826fc369151e36ab736557ba92196f9f PKG_MAINTAINER:=Felix Fietkau PKG_CPE_ID:=cpe:/a:mdadm_project:mdadm diff --git a/package/utils/mdadm/patches/010-falloc.patch b/package/utils/mdadm/patches/010-falloc.patch new file mode 100644 index 0000000000..2f2a9b87e1 --- /dev/null +++ b/package/utils/mdadm/patches/010-falloc.patch @@ -0,0 +1,36 @@ +From 52bead95d2957437c691891fcdc49bd6afccdd49 Mon Sep 17 00:00:00 2001 +From: Fabrice Fontaine +Date: Fri, 12 Apr 2024 18:45:13 +0200 +Subject: Create.c: fix uclibc build + +Define FALLOC_FL_ZERO_RANGE if needed as FALLOC_FL_ZERO_RANGE is only +defined for aarch64 on uclibc-ng resulting in the following or1k build +failure since commit 577fd10486d8d1472a6b559066f344ac30a3a391: + +Create.c: In function 'write_zeroes_fork': +Create.c:155:35: error: 'FALLOC_FL_ZERO_RANGE' undeclared (first use in this function) + 155 | if (fallocate(fd, FALLOC_FL_ZERO_RANGE | FALLOC_FL_KEEP_SIZE, + | ^~~~~~~~~~~~~~~~~~~~ + +Fixes: + - http://autobuild.buildroot.org/results/0e04bcdb591ca5642053e1f7e31384f06581e989 + +Signed-off-by: Fabrice Fontaine +Signed-off-by: Mariusz Tkaczyk +--- + Create.c | 4 ++++ + 1 file changed, 4 insertions(+) + +--- a/Create.c ++++ b/Create.c +@@ -32,6 +32,10 @@ + #include + #include + ++#ifndef FALLOC_FL_ZERO_RANGE ++#define FALLOC_FL_ZERO_RANGE 16 ++#endif ++ + static int round_size_and_verify(unsigned long long *size, int chunk) + { + if (*size == 0) diff --git a/package/utils/mdadm/patches/020-basename.patch b/package/utils/mdadm/patches/020-basename.patch new file mode 100644 index 0000000000..d4f7aa5963 --- /dev/null +++ b/package/utils/mdadm/patches/020-basename.patch @@ -0,0 +1,30 @@ +--- a/Monitor.c ++++ b/Monitor.c +@@ -27,6 +27,7 @@ + #include "md_p.h" + #include "md_u.h" + #include ++#include + #include + #include + +--- a/platform-intel.c ++++ b/platform-intel.c +@@ -28,6 +28,7 @@ + #include + #include + #include ++#include + #include + + #define NVME_SUBSYS_PATH "/sys/devices/virtual/nvme-subsystem/" +--- a/super-intel.c ++++ b/super-intel.c +@@ -27,6 +27,7 @@ + #include + #include + #include ++#include + + /* MPB == Metadata Parameter Block */ + #define MPB_SIGNATURE "Intel Raid ISM Cfg Sig. " diff --git a/package/utils/mdadm/patches/030-fix-monitor-tv_sec.patch b/package/utils/mdadm/patches/030-fix-monitor-tv_sec.patch new file mode 100644 index 0000000000..a0fe9fd7c3 --- /dev/null +++ b/package/utils/mdadm/patches/030-fix-monitor-tv_sec.patch @@ -0,0 +1,14 @@ +--- a/monitor.c ++++ b/monitor.c +@@ -449,9 +449,9 @@ static int read_and_act(struct active_ar + } + + gettimeofday(&tv, NULL); +- dprintf("(%d): %ld.%06ld state:%s prev:%s action:%s prev: %s start:%llu\n", ++ dprintf("(%d): %lld.%06ld state:%s prev:%s action:%s prev: %s start:%llu\n", + a->info.container_member, +- tv.tv_sec, tv.tv_usec, ++ (long long)tv.tv_sec, (long)tv.tv_usec, + array_states[a->curr_state], + array_states[a->prev_state], + sync_actions[a->curr_action], diff --git a/package/utils/mdadm/patches/040-udev.patch b/package/utils/mdadm/patches/040-udev.patch new file mode 100644 index 0000000000..0d497aa016 --- /dev/null +++ b/package/utils/mdadm/patches/040-udev.patch @@ -0,0 +1,26 @@ +From 1750758c7ff526e3560433f6235e5cfa35cf646a Mon Sep 17 00:00:00 2001 +From: Mariusz Tkaczyk +Date: Wed, 6 Mar 2024 15:50:55 +0100 +Subject: udev.c: Do not require libudev.h if DNO_LIBUDEV + +libudev may not be presented at all, do not require it. + +Reported-by: Boian Bonev +Signed-off-by: Mariusz Tkaczyk +--- + udev.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/udev.c ++++ b/udev.c +@@ -26,7 +26,10 @@ + #include + #include + #include ++ ++#ifndef NO_LIBUDEV + #include ++#endif + + static char *unblock_path; + diff --git a/package/utils/mdadm/patches/050-pie.patch b/package/utils/mdadm/patches/050-pie.patch new file mode 100644 index 0000000000..59c96f51ba --- /dev/null +++ b/package/utils/mdadm/patches/050-pie.patch @@ -0,0 +1,33 @@ +From 893a55831e5abbcd15b171db66fa1f389fb61506 Mon Sep 17 00:00:00 2001 +From: Fabrice Fontaine +Date: Tue, 7 May 2024 19:32:16 +0200 +Subject: Makefile: Move -pie to LDFLAGS + +Move -pie from LDLIBS to LDFLAGS and make LDFLAGS configurable to allow +the user to drop it by setting their own LDFLAGS (e.g. PIE could be +enabled or disabled by the buildsystem such as buildroot). + +Suggested-by: Mariusz Tkaczyk +Signed-off-by: Fabrice Fontaine +Signed-off-by: Mariusz Tkaczyk +--- + Makefile | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/Makefile ++++ b/Makefile +@@ -132,12 +132,12 @@ CFLAGS += -DUSE_PTHREADS + MON_LDFLAGS += -pthread + endif + +-LDFLAGS = -Wl,-z,now,-z,noexecstack ++LDFLAGS ?= -pie -Wl,-z,now,-z,noexecstack + + # If you want a static binary, you might uncomment these + # LDFLAGS += -static + # STRIP = -s +-LDLIBS = -ldl -pie ++LDLIBS = -ldl + + # To explicitly disable libudev, set -DNO_LIBUDEV in CXFLAGS + ifeq (, $(findstring -DNO_LIBUDEV, $(CXFLAGS))) diff --git a/package/utils/mdadm/patches/100-cross_compile.patch b/package/utils/mdadm/patches/100-cross_compile.patch index 790d7755b0..bd71c083e5 100644 --- a/package/utils/mdadm/patches/100-cross_compile.patch +++ b/package/utils/mdadm/patches/100-cross_compile.patch @@ -1,6 +1,6 @@ --- a/Makefile +++ b/Makefile -@@ -99,7 +99,7 @@ DLM:=$(shell [ -f /usr/include/libdlm.h +@@ -115,7 +115,7 @@ DLM:=$(shell [ -f /usr/include/libdlm.h DIRFLAGS = -DMAP_DIR=\"$(MAP_DIR)\" -DMAP_FILE=\"$(MAP_FILE)\" DIRFLAGS += -DMDMON_DIR=\"$(MDMON_DIR)\" DIRFLAGS += -DFAILED_SLOTS_DIR=\"$(FAILED_SLOTS_DIR)\" diff --git a/package/utils/mdadm/patches/200-reduce_size.patch b/package/utils/mdadm/patches/200-reduce_size.patch index 163e125c22..d14fae716e 100644 --- a/package/utils/mdadm/patches/200-reduce_size.patch +++ b/package/utils/mdadm/patches/200-reduce_size.patch @@ -1,6 +1,6 @@ --- a/Incremental.c +++ b/Incremental.c -@@ -983,6 +983,10 @@ static int array_try_spare(char *devname +@@ -985,6 +985,10 @@ static int array_try_spare(char *devname goto next; } @@ -13,7 +13,7 @@ /* domain test fails */ --- a/util.c +++ b/util.c -@@ -1147,7 +1147,9 @@ void wait_for(char *dev, int fd) +@@ -1192,7 +1192,9 @@ void wait_for(char *dev, int fd) struct superswitch *superlist[] = { &super0, &super1, -- 2.30.2