diff --git a/0004-enable-unaligned-access-optimizations-for-RISC-V.patch b/0004-enable-unaligned-access-optimizations-for-RISC-V.patch new file mode 100644 index 0000000000000000000000000000000000000000..9cea91ddfd486a16eef9dcda1f4e7a7b81501e91 --- /dev/null +++ b/0004-enable-unaligned-access-optimizations-for-RISC-V.patch @@ -0,0 +1,83 @@ +From 3b7f83faf6f597cfd14a0d2ff43a74450604d586 Mon Sep 17 00:00:00 2001 +From: huangshangcheng +Date: Thu, 18 Sep 2025 19:47:49 +0800 +Subject: [PATCH] enable unaligned access optimizations for RISC-V with Zicclsm +While reviewing the Redis code, we discovered that optimizations +for unaligned memory accesses are not enabled on RISC-V. After +testing siphash separately, we found some performance improvements +in this area and hope to add them. + +The zicclsm extension, which includes unaligned memory accesses, +is required on RISC-V, as specified in the RVA20U64 specification. +GCC also provides the macro zicclsm to detect the zicclsm extension. + +Supported versions: GCC 14.1.0 and above + +Test data +Test Configuration​​ +​​Test Iterations:​​ 10,000,000 hashes per run +Test Runs:​​ 10 consecutive runs + +Improvement +6482733.40 --> 10732524.90 (​​+65.5%​) + +Disable UNALIGNED_LE_CPU + +Running performance test (10 runs)... +Run 1: 6491958.63 hashes/sec +Run 2: 6487366.83 hashes/sec +Run 3: 6481576.94 hashes/sec +Run 4: 6484129.18 hashes/sec +Run 5: 6486451.34 hashes/sec +Run 6: 6476159.22 hashes/sec +Run 7: 6479075.32 hashes/sec +Run 8: 6476821.02 hashes/sec +Run 9: 6482822.05 hashes/sec +Run 10: 6480973.47 hashes/sec + +Average performance: 6482733.40 hashes/sec + +Enable UNALIGNED_LE_CPU + +Running performance test (10 runs)... +Run 1: 10724141.20 hashes/sec +Run 2: 10736134.67 hashes/sec +Run 3: 10733149.45 hashes/sec +Run 4: 10732901.09 hashes/sec +Run 5: 10731710.56 hashes/sec +Run 6: 10734029.89 hashes/sec +Run 7: 10733342.07 hashes/sec +Run 8: 10732782.90 hashes/sec +Run 9: 10733797.15 hashes/sec +Run 10: 10733260.05 hashes/sec + +Average performance: 10732524.90 hashes/sec + +Signed-off-by: liuqingtao + +--- + src/siphash.c | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/src/siphash.c b/src/siphash.c +index 2713d89..721b34b 100644 +--- a/src/siphash.c ++++ b/src/siphash.c +@@ -67,9 +67,12 @@ int siptlw(int c) { + + /* Test of the CPU is Little Endian and supports not aligned accesses. + * Two interesting conditions to speedup the function that happen to be +- * in most of x86 servers. */ ++ * in most of x86 servers. ++ * Additionally supports RISC-V CPUs implementing the Zicclsm extension ++ * for unaligned access. */ + #if defined(__X86_64__) || defined(__x86_64__) || defined (__i386__) \ +- || defined (__aarch64__) || defined (__arm64__) ++ || defined (__aarch64__) || defined (__arm64__) \ ++ || (defined(__riscv) && defined(__riscv_zicclsm)) + #define UNALIGNED_LE_CPU + #endif + +-- +2.45.2.windows.1 + diff --git a/CVE-2025-49112.patch b/CVE-2025-49112.patch deleted file mode 100644 index 6ef2a573853b1d6f0a30d70b13b7448127f92aa6..0000000000000000000000000000000000000000 --- a/CVE-2025-49112.patch +++ /dev/null @@ -1,50 +0,0 @@ -From 374718b2a365ca69f715d542709b7d71540b1387 Mon Sep 17 00:00:00 2001 -From: Zeroday BYTE -Date: Mon, 26 May 2025 18:57:00 +0700 -Subject: [PATCH] Fix unsigned difference expression compared to zero (#2101) - -Origin: https://github.com/valkey-io/valkey/commit/374718b2a365ca69f715d542709b7d71540b1387 - -https://github.com/valkey-io/valkey/blob/daea05b1e26db29bfd1c033e27f9d519a2f8ccbb/src/networking.c#L886-L886 - -Fix the issue need to ensure that the subtraction `prev->size - -prev->used` does not underflow. This can be achieved by explicitly -checking that `prev->used` is less than `prev->size` before performing -the subtraction. This approach avoids relying on unsigned arithmetic and -ensures the logic is clear and robust. - -The specific changes are: -1. Replace the condition `prev->size - prev->used > 0` with `prev->used -< prev->size`. -2. This change ensures that the logic checks whether there is remaining -space in the buffer without risking underflow. - -**References** -[INT02-C. Understand integer conversion -rules](https://wiki.sei.cmu.edu/confluence/display/c/INT02-C.+Understand+integer+conversion+rules) -[CWE-191](https://cwe.mitre.org/data/definitions/191.html) - - ---- - -Signed-off-by: Zeroday BYTE ---- - src/networking.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/networking.c b/src/networking.c -index eb0b389..860fd89 100644 ---- a/src/networking.c -+++ b/src/networking.c -@@ -780,7 +780,7 @@ void setDeferredReply(client *c, void *node, const char *s, size_t length) { - * - It has enough room already allocated - * - And not too large (avoid large memmove) */ - if (ln->prev != NULL && (prev = listNodeValue(ln->prev)) && -- prev->size - prev->used > 0) -+ prev->used < prev->size) - { - size_t len_to_copy = prev->size - prev->used; - if (len_to_copy > length) --- -2.49.0 - diff --git a/redis-8.2.1.tar.gz b/redis-8.2.2.tar.gz similarity index 32% rename from redis-8.2.1.tar.gz rename to redis-8.2.2.tar.gz index bc9b03aefc3eddd30394d481d42639c13e1af368..bfdf2980f27d402880ff36fcc83c6221599ec38a 100644 --- a/redis-8.2.1.tar.gz +++ b/redis-8.2.2.tar.gz @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e2c1cb9dd4180a35b943b85dfc7dcdd42566cdbceca37d0d0b14c21731582d3e -size 3897326 +oid sha256:4e340e8e822a82114b6fb0f7ca581b749fa876e31e36e9fbcb75416bec9d0608 +size 3901854 diff --git a/redis.spec b/redis.spec index 6fd98f25508573d0bb34092890d60f0360d30c80..e9083050840a4218040d7fbb10df10bfdcd99e41 100644 --- a/redis.spec +++ b/redis.spec @@ -4,8 +4,8 @@ %global short_doc_commit %(c=%{doc_commit}; echo ${c:0:7}) Name: redis -Version: 8.2.1 -Release: 2 +Version: 8.2.2 +Release: 1 Summary: A persistent key-value database License: AGPL-3.0-only AND BSD-3-Clause AND BSD-2-Clause AND MIT AND BSL-1.0 URL: https://redis.io @@ -22,7 +22,8 @@ Patch0000: redis-conf.patch # https://github.com/redis/redis/pull/3491 - man pages Patch0001: 0001-1st-man-pageis-for-redis-cli-redis-benchmark-redis-c.patch Patch0002: 0002-add-sw_64-support.patch -Patch0003: CVE-2025-49112.patch +# https://github.com/redis/redis/pull/14342 +Patch0004: 0004-enable-unaligned-access-optimizations-for-RISC-V.patch BuildRequires: systemd BuildRequires: systemd-devel @@ -203,6 +204,10 @@ install -p -D -m 0644 %{S:8} %{buildroot}%{_tmpfilesdir}/%{name}.conf %{_docdir}/%{name} %changelog +* Wed Oct 08 2025 Funda Wang - 8.2.2-1 +- update to 8.2.2 +- enable unaligned access optimizations for RISC-V with Zicclsm + * Thu Sep 11 2025 Funda Wang - 8.2.1-2 - include rundir in package