Compare commits
10 Commits
82af14eac9
...
b1f91e93b0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b1f91e93b0 | ||
|
|
97b358018e | ||
|
|
acadf7106f | ||
|
|
be00ebc048 | ||
|
|
f859b721dd | ||
|
|
4c7f23b62d | ||
|
|
0b2098bd46 | ||
|
|
6c7d90e7a4 | ||
|
|
a3aa91130d | ||
|
|
da174e8330 |
1
.gitattributes
vendored
Normal file
1
.gitattributes
vendored
Normal file
@ -0,0 +1 @@
|
||||
*.gz filter=lfs diff=lfs merge=lfs -text
|
||||
2
.lfsconfig
Normal file
2
.lfsconfig
Normal file
@ -0,0 +1,2 @@
|
||||
[lfs]
|
||||
url = https://artlfs.openeuler.openatom.cn/src-openEuler/mariadb
|
||||
Binary file not shown.
3
mariadb-10.5.29.tar.gz
Normal file
3
mariadb-10.5.29.tar.gz
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:de49ed417f6fa90e8fee72a41e526e0983dc47f388caff9e703803cec263b826
|
||||
size 117805539
|
||||
100
mariadb-RISC-V-use-RDTIME-for-cycle-timer.patch
Normal file
100
mariadb-RISC-V-use-RDTIME-for-cycle-timer.patch
Normal file
@ -0,0 +1,100 @@
|
||||
From 841bfb4641f4cbad16a3aeb07fa462dcd4449cac Mon Sep 17 00:00:00 2001
|
||||
From: IZUMI-Zu <binshuo.oerv@isrc.iscas.ac.cn>
|
||||
Date: Fri, 23 Aug 2024 00:00:12 +0800
|
||||
Subject: [PATCH] RISC-V: use RDTIME for cycle timer and disable __builtin_readcyclecounter
|
||||
|
||||
This commit backports and extends the fixes from MariaDB/server PRs #1981
|
||||
and #2980 to address the RISC-V RDCYCLE privileged instruction issue.
|
||||
|
||||
Key changes:
|
||||
1. Use RDTIME instead of RDCYCLE for cycle timer on RISC-V
|
||||
2. Disable __builtin_readcyclecounter() for RISC-V as LLVM generates RDCYCLE
|
||||
|
||||
Starting with Linux 6.6 [1], RDCYCLE is a privileged instruction on RISC-V and can't be used directly from userland.
|
||||
There is a sysctl option to change that as a transition period, but it will eventually disappear.
|
||||
|
||||
Use RDTIME instead, which while less accurate has the advantage of being synchronized between CPU (and thus monotonic)
|
||||
and of constant frequency.
|
||||
|
||||
[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=cc4c07c89aada16229084eeb93895c95b7eabaa3
|
||||
|
||||
Backported-from: https://github.com/MariaDB/server/pull/1981
|
||||
https://github.com/MariaDB/server/pull/2980
|
||||
---
|
||||
include/my_rdtsc.h | 26 +++++++++++++++++++++++++-
|
||||
mysys/my_rdtsc.c | 2 ++
|
||||
2 files changed, 27 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/include/my_rdtsc.h b/include/my_rdtsc.h
|
||||
index e8101516..880625fa 100644
|
||||
--- a/include/my_rdtsc.h
|
||||
+++ b/include/my_rdtsc.h
|
||||
@@ -91,6 +91,7 @@ C_MODE_START
|
||||
On AARCH64, we use the generic timer base register. We override clang
|
||||
implementation for aarch64 as it access a PMU register which is not
|
||||
guaranteed to be active.
|
||||
+ On RISC-V, we use the rdtime instruction to read from mtime register.
|
||||
|
||||
Sadly, we have nothing for the Digital Alpha, MIPS, Motorola m68k,
|
||||
HP PA-RISC or other non-mainstream (or obsolete) processors.
|
||||
@@ -128,7 +129,7 @@ C_MODE_START
|
||||
*/
|
||||
static inline ulonglong my_timer_cycles(void)
|
||||
{
|
||||
-# if __has_builtin(__builtin_readcyclecounter) && !defined (__aarch64__)
|
||||
+# if __has_builtin(__builtin_readcyclecounter) && !defined(__aarch64__) && !defined(__riscv)
|
||||
return __builtin_readcyclecounter();
|
||||
# elif defined _WIN32 || defined __i386__ || defined __x86_64__
|
||||
return __rdtsc();
|
||||
@@ -173,6 +174,28 @@ static inline ulonglong my_timer_cycles(void)
|
||||
__asm __volatile("mrs %0, CNTVCT_EL0" : "=&r" (result));
|
||||
return result;
|
||||
}
|
||||
+#elif defined(__riscv)
|
||||
+ /* Use RDTIME (and RDTIMEH on riscv32) */
|
||||
+ {
|
||||
+# if __riscv_xlen == 32
|
||||
+ ulong result_lo, result_hi0, result_hi1;
|
||||
+ /* Implemented in assembly because Clang insisted on branching. */
|
||||
+ __asm __volatile__(
|
||||
+ "rdtimeh %0\n"
|
||||
+ "rdtime %1\n"
|
||||
+ "rdtimeh %2\n"
|
||||
+ "sub %0, %0, %2\n"
|
||||
+ "seqz %0, %0\n"
|
||||
+ "sub %0, zero, %0\n"
|
||||
+ "and %1, %1, %0\n"
|
||||
+ : "=r"(result_hi0), "=r"(result_lo), "=r"(result_hi1));
|
||||
+ return (static_cast<ulonglong>(result_hi1) << 32) | result_lo;
|
||||
+# else
|
||||
+ ulonglong result;
|
||||
+ __asm __volatile__("rdtime %0" : "=r"(result));
|
||||
+ return result;
|
||||
+ }
|
||||
+# endif
|
||||
#elif defined(HAVE_SYS_TIMES_H) && defined(HAVE_GETHRTIME)
|
||||
/* gethrtime may appear as either cycle or nanosecond counter */
|
||||
return (ulonglong) gethrtime();
|
||||
@@ -231,6 +254,7 @@ C_MODE_END
|
||||
#define MY_TIMER_ROUTINE_GETSYSTEMTIMEASFILETIME 26
|
||||
#define MY_TIMER_ROUTINE_ASM_S390 28
|
||||
#define MY_TIMER_ROUTINE_AARCH64 29
|
||||
+#define MY_TIMER_ROUTINE_RISCV 30
|
||||
|
||||
#endif
|
||||
|
||||
diff --git a/mysys/my_rdtsc.c b/mysys/my_rdtsc.c
|
||||
index 1503a5db..ffd81602 100644
|
||||
--- a/mysys/my_rdtsc.c
|
||||
+++ b/mysys/my_rdtsc.c
|
||||
@@ -384,6 +384,8 @@ void my_timer_init(MY_TIMER_INFO *mti)
|
||||
mti->cycles.routine= MY_TIMER_ROUTINE_ASM_S390;
|
||||
#elif defined(__GNUC__) && defined (__aarch64__)
|
||||
mti->cycles.routine= MY_TIMER_ROUTINE_AARCH64;
|
||||
+#elif defined(__GNUC__) && defined (__riscv)
|
||||
+ mti->cycles.routine= MY_TIMER_ROUTINE_RISCV;
|
||||
#elif defined(HAVE_SYS_TIMES_H) && defined(HAVE_GETHRTIME)
|
||||
mti->cycles.routine= MY_TIMER_ROUTINE_GETHRTIME;
|
||||
#else
|
||||
--
|
||||
2.46.0
|
||||
@ -1,30 +0,0 @@
|
||||
# Fixing conflict with groonga package
|
||||
# https://bugzilla.redhat.com/show_bug.cgi?id=1763287
|
||||
|
||||
--- mariadb-10.3.18/storage/mroonga/vendor/groonga/CMakeLists.txt.withoutoption 2019-11-11 14:01:07.762595716 +0100
|
||||
+++ mariadb-10.3.18/storage/mroonga/vendor/groonga/CMakeLists.txt 2019-11-11 14:33:05.224012458 +0100
|
||||
@@ -86,7 +86,9 @@
|
||||
set(INCLUDE_DIR "include")
|
||||
set(GRN_INCLUDE_DIR "include/groonga")
|
||||
set(DATA_DIR "share")
|
||||
-set(GRN_DATA_DIR "${DATA_DIR}/${GRN_PROJECT_NAME}")
|
||||
+if(NOT DEFINED GRN_DATA_DIR)
|
||||
+ set(GRN_DATA_DIR "${DATA_DIR}/${GRN_PROJECT_NAME}")
|
||||
+endif()
|
||||
set(CONFIG_DIR "etc")
|
||||
set(GRN_CONFIG_DIR "${CONFIG_DIR}/${GRN_PROJECT_NAME}")
|
||||
set(GRN_CONFIG_PATH "${CMAKE_INSTALL_PREFIX}/${GRN_CONFIG_DIR}/groonga.conf")
|
||||
|
||||
--- mariadb-10.3.18/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/CMakeLists.txt.withoutoption 2019-11-11 14:34:22.661005715 +0100
|
||||
+++ mariadb-10.3.18/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/CMakeLists.txt 2019-11-11 14:35:59.962244120 +0100
|
||||
@@ -16,7 +16,9 @@
|
||||
# MA 02110-1335 USA
|
||||
|
||||
cmake_minimum_required(VERSION 2.6)
|
||||
-set(GROONGA_NORMALIZER_MYSQL_PROJECT_NAME "groonga-normalizer-mysql")
|
||||
+if (NOT DEFINED GROONGA_NORMALIZER_MYSQL_PROJECT_NAME)
|
||||
+ set(GROONGA_NORMALIZER_MYSQL_PROJECT_NAME "groonga-normalizer-mysql")
|
||||
+endif()
|
||||
project("${GROONGA_NORMALIZER_MYSQL_PROJECT_NAME}")
|
||||
|
||||
if(DEFINED GROONGA_NORMALIZER_MYSQL_EMBED)
|
||||
@ -1,21 +0,0 @@
|
||||
diff -up mariadb-10.1.19/mysql-test/r/ssl_8k_key.result.sslbak mariadb-10.1.19/mysql-test/r/ssl_8k_key.result
|
||||
--- mariadb-10.1.19/mysql-test/r/ssl_8k_key.result.sslbak 2016-11-24 08:55:21.637000000 -0500
|
||||
+++ mariadb-10.1.19/mysql-test/r/ssl_8k_key.result 2016-11-24 08:55:55.853000000 -0500
|
||||
@@ -1,2 +1,2 @@
|
||||
-Variable_name Value
|
||||
-Ssl_cipher DHE-RSA-AES256-SHA
|
||||
+have_ssl
|
||||
+1
|
||||
diff -up mariadb-10.1.19/mysql-test/t/ssl_8k_key.test.sslbak mariadb-10.1.19/mysql-test/t/ssl_8k_key.test
|
||||
--- mariadb-10.1.19/mysql-test/t/ssl_8k_key.test.sslbak 2016-11-24 08:54:10.485000000 -0500
|
||||
+++ mariadb-10.1.19/mysql-test/t/ssl_8k_key.test 2016-11-24 08:54:35.724000000 -0500
|
||||
@@ -5,7 +5,7 @@
|
||||
#
|
||||
# Bug#29784 YaSSL assertion failure when reading 8k key.
|
||||
#
|
||||
---exec $MYSQL --ssl --ssl-key=$MYSQL_TEST_DIR/std_data/client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/client-cert.pem -e "SHOW STATUS LIKE 'ssl_Cipher'" 2>&1
|
||||
+--exec $MYSQL --ssl --ssl-key=$MYSQL_TEST_DIR/std_data/client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/client-cert.pem -e "SELECT (VARIABLE_VALUE <> '') AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher'" 2>&1
|
||||
|
||||
## This test file is for testing encrypted communication only, not other
|
||||
## encryption routines that the SSL library happens to provide!
|
||||
|
||||
32
mariadb.spec
32
mariadb.spec
@ -2,7 +2,7 @@
|
||||
%global pkgnamepatch mariadb
|
||||
%{!?runselftest:%global runselftest 0}
|
||||
%global ignore_testsuite_result 0
|
||||
%global last_tested_version 10.5.15
|
||||
%global last_tested_version 10.5.25
|
||||
%global force_run_testsuite 0
|
||||
%global require_mysql_selinux 1
|
||||
|
||||
@ -73,7 +73,7 @@
|
||||
%global sameevr %{epoch}:%{version}-%{release}
|
||||
|
||||
Name: mariadb
|
||||
Version: 10.5.24
|
||||
Version: 10.5.29
|
||||
Release: 1
|
||||
Epoch: 4
|
||||
|
||||
@ -112,6 +112,8 @@ Patch9: %{pkgnamepatch}-ownsetup.patch
|
||||
Patch10: %{pkgnamepatch}-ssl-cipher-tests.patch
|
||||
# Patch11: Use PCDIR CMake option, if configured
|
||||
Patch11: %{pkgnamepatch}-pcdir.patch
|
||||
# Patch12: RISC-V: use RDTIME for cycle timer
|
||||
Patch12: %{pkgnamepatch}-RISC-V-use-RDTIME-for-cycle-timer.patch
|
||||
|
||||
BuildRequires: make
|
||||
BuildRequires: cmake gcc-c++
|
||||
@ -252,6 +254,7 @@ to a MariaDB/MySQL server.
|
||||
%if %{with config}
|
||||
%package config
|
||||
Summary: The config files required by server and client
|
||||
%{?with_conflicts:Conflicts: greatsql-mysql-config}
|
||||
|
||||
%description config
|
||||
The package provides the config file my.cnf and my.cnf.d directory used by any
|
||||
@ -264,7 +267,7 @@ package itself.
|
||||
%if %{with common}
|
||||
%package common
|
||||
Summary: The shared files required by server and client
|
||||
Requires: %{_sysconfdir}/my.cnf
|
||||
Requires: %{name}-config%{?_isa} = %{sameevr}
|
||||
|
||||
|
||||
%if %{without clibrary}
|
||||
@ -337,8 +340,7 @@ Recommends: %{name}-backup%{?_isa} = %{sameevr}
|
||||
Suggests: mytop
|
||||
Suggests: logrotate
|
||||
|
||||
Requires: %{_sysconfdir}/my.cnf
|
||||
Requires: %{_sysconfdir}/my.cnf.d
|
||||
Requires: %{name}-config%{?_isa} = %{sameevr}
|
||||
|
||||
%if %require_mysql_selinux
|
||||
Requires: (mysql-selinux if selinux-policy-targeted)
|
||||
@ -623,6 +625,7 @@ sources.
|
||||
%patch -P9 -p1
|
||||
%patch -P10 -p1
|
||||
%patch -P11 -p1
|
||||
%patch -P12 -p1
|
||||
|
||||
# Remove JAR files that upstream puts into tarball
|
||||
find . -name "*.jar" -type f -exec rm --verbose -f {} \;
|
||||
@ -1474,6 +1477,24 @@ fi
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
* Fri May 09 2025 Funda Wang <fundawang@yeah.net> - 4:10.5.29-1
|
||||
- update to 10.5.29 for CVE-2025-30722, CVE-2025-30693, CVE-2023-52970, CVE-2023-52969
|
||||
|
||||
* Mon Mar 31 2025 Funda Wang <fundawang@yeah.net> - 4:10.5.28-1
|
||||
- update to 10.5.28 for CVE-2025-21490
|
||||
|
||||
* Thu Nov 21 2024 Funda Wang <fundawang@yeah.net> - 4:10.5.25-4
|
||||
- adopt to new cmake macro
|
||||
- sync with master codebase
|
||||
|
||||
* Sun Aug 18 2024 binshuo <binshuo.oerv@isrc.iscas.ac.cn> - 4:10.5.25-2
|
||||
- RISC-V: fix 'rdcycle' SIGILL
|
||||
|
||||
* Tue May 28 2024 xiejing <xiejing@kylinos.cn> - 4:10.5.25-1
|
||||
- Bump to 10.5.25 for resolving CVE-2024-21096
|
||||
- Fix version description in systemd service file
|
||||
- Add conflict with greatsql and change requires
|
||||
|
||||
* Tue Feb 27 2024 Zheng Zhenyu <zheng.zhenyu@outlook.com> - 4:10.5.24-1
|
||||
- upgrade to 10.5.24
|
||||
|
||||
@ -1564,4 +1585,3 @@ fi
|
||||
|
||||
* Wed Sep 11 2019 openEuler Buildteam <buildteam@openeuler.org> - 3:10.3.9-3
|
||||
- Package init
|
||||
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
#
|
||||
|
||||
[Unit]
|
||||
Description=MariaDB 10.5.15 database server
|
||||
Description=MariaDB 10.5.25 database server
|
||||
Documentation=man:mariadbd(8)
|
||||
Documentation=https://mariadb.com/kb/en/library/systemd/
|
||||
After=network.target
|
||||
|
||||
@ -39,7 +39,7 @@
|
||||
# LimitNOFILE=10000
|
||||
|
||||
[Unit]
|
||||
Description=MariaDB 10.5.15 database server (multi-instance %I)
|
||||
Description=MariaDB 10.5.25 database server (multi-instance %I)
|
||||
Documentation=man:mariadbd(8)
|
||||
Documentation=https://mariadb.com/kb/en/library/systemd/
|
||||
After=network.target
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user