Commit Graph

90 Commits

Author SHA1 Message Date
Rosen Penev 79ef554d7f mariadb: fix compilation with newer fmt
Upstream backport.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2024-02-18 15:39:04 -08:00
Michael Heimpold 357fa2930c mariadb: minor whitespace and typo fixes
Signed-off-by: Michael Heimpold <mhei@heimpold.de>
2023-12-22 14:09:27 +02:00
Rosen Penev 94fd89a609 mariadb: update to 10.9.8
Remove upstreamed patch.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Tested-by: Michael Heimpold <mhei@heimpold.de>
2023-12-19 15:43:35 -08:00
Oskari Rauta 3b14d25698 mariadb: fix gcc 13 building
fixes:
FAILED: tpool/CMakeFiles/tpool.dir/aio_liburing.cc.o
/usr/src/openwrt/staging_dir/toolchain-x86_64_gcc-13.1.0_musl/bin/x86_64-openwrt-linux-musl-g++ -DDBUG_TRACE -DHAVE_CONFIG_H -DHAVE_URING -D_FILE_OFFSET_BITS=64 -I/usr/src/openwrt/build_dir/target-x86_64_musl/mariadb-10.9.3/wsrep-lib/include -I/usr/src/openwrt/build_dir/target-x86_64_musl/mariadb-10.9.3/wsrep-lib/wsrep-API/v26 -I/usr/src/openwrt/build_dir/target-x86_64_musl/mariadb-10.9.3/include -I/usr/src/openwrt/build_dir/target-x86_64_musl/mariadb-10.9.3/include/providers -I/usr/src/openwrt/build_dir/target-x86_64_musl/mariadb-10.9.3/tpool -Os -pipe -fno-caller-saves -fno-plt -fhonour-copts -fmacro-prefix-map=/usr/src/openwrt/build_dir/target-x86_64_musl/mariadb-10.9.3=mariadb-10.9.3 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro   -I/usr/src/openwrt/staging_dir/toolchain-x86_64_gcc-13.1.0_musl/usr/include -I/usr/src/openwrt/staging_dir/toolchain-x86_64_gcc-13.1.0_musl/include/fortify -I/usr/src/openwrt/staging_dir/toolchain-x86_64_gcc-13.1.0_musl/include -DNDEBUG -DDBUG_OFF -std=gnu++11 -DHAVE_IO_URING_MLOCK_SIZE -MD -MT tpool/CMakeFiles/tpool.dir/aio_liburing.cc.o -MF tpool/CMakeFiles/tpool.dir/aio_liburing.cc.o.d -o tpool/CMakeFiles/tpool.dir/aio_liburing.cc.o -c /usr/src/openwrt/build_dir/target-x86_64_musl/mariadb-10.9.3/tpool/aio_liburing.cc
/usr/src/openwrt/build_dir/target-x86_64_musl/mariadb-10.9.3/tpool/aio_liburing.cc: In constructor '{anonymous}::aio_uring::aio_uring(tpool::thread_pool*, int)':
/usr/src/openwrt/build_dir/target-x86_64_musl/mariadb-10.9.3/tpool/aio_liburing.cc:64:18: error: 'runtime_error' is not a member of 'std'
   64 |       throw std::runtime_error("aio_uring()");

Signed-off-by: Oskari Rauta <oskari.rauta@gmail.com>
2023-05-20 13:06:47 +08:00
Tianling Shen f20ba7f6ed mariadb: fix compilation with musl 1.2.4
musl 1.2.4 deprecated legacy "LFS64" ("large file support") interfaces so
just having _GNU_SOURCE defined is not enough anymore.

Manually pass -D_LARGEFILE64_SOURCE to allow to keep using LFS64 definitions.

Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
2023-05-18 19:24:24 +08:00
Paul Fertser 0c10c224be treewide: remove AUTORELEASE
Automatically compute and substitute current values for all
$(AUTORELEASE) instances as this feature is deprecated and shouldn't be
used.

The following temporary change was made to the core:

diff --git a/rules.mk b/rules.mk
index 57d7995d4fa8..f16367de87a8 100644
--- a/rules.mk
+++ b/rules.mk
@@ -429,7 +429,7 @@ endef
 abi_version_str = $(subst -,,$(subst _,,$(subst .,,$(1))))

 COMMITCOUNT = $(if $(DUMP),0,$(call commitcount))
-AUTORELEASE = $(if $(DUMP),0,$(call commitcount,1))
+AUTORELEASE = $(if $(DUMP),0,$(shell sed -i "s/\$$(AUTORELEASE)/$(call commitcount,1)/" $(CURDIR)/Makefile))

 all:
 FORCE: ;

And this command used to fix affected packages:

for i in $(cd feeds/packages; git grep -l PKG_RELEASE:=.*AUTORELEASE | \
                              sed 's^.*/\([^/]*\)/Makefile^\1^';);
do
  make package/$i/download
done

Signed-off-by: Paul Fertser <fercerpav@gmail.com>
2023-04-21 22:46:58 +02:00
Andre Heider 565866a472 treewide: refactor to use PKG_BUILD_FLAGS:=no-mips16
See commit 5c545bdb "treewide: replace PKG_USE_MIPS16:=0 with
PKG_BUILD_FLAGS:=no-mips16" on the main repository.

Signed-off-by: Andre Heider <a.heider@gmail.com>
2023-04-08 08:38:54 +02:00
Michal Hrusecky 6328e3e9fe mariadb: Update to the latest version 10.9.3
Update to the latest upstream version. For more details, see:

https://mariadb.com/kb/en/changes-improvements-in-mariadb-109/

Added new dependency on libfmt.

Following two patches dropped as the issues were fixed in upstream.

 * 130-c11_atomics.patch
 * 140-mips-connect-unaligned.patch

The rest of the patches were refreshed.

Don't need to disable cassandra and tokudb anymore as they were dropped
from upstream tarball.

Signed-off-by: Michal Hrusecky <michal@hrusecky.net>
2022-10-25 18:02:11 -07:00
Michal Hrusecky 8f6831b64b mariadb: Drop unused rundir fix socket dir perms
We had been creating "rundir" but it was never used, probably leftover
from some removed function. At the same time, we were setting quite
strict rights to the socket directory (while comments sugested
otherwise).

Signed-off-by: Michal Hrusecky <michal@hrusecky.net>
2022-10-24 11:15:36 -07:00
Rosen Penev 9b65b9cb95 mariadb: fix compilation with ppc64
MariaDB's PPC64 CRC32 support requires AltiVec, which QoriQ does not
support. Disable it.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2022-09-04 15:58:55 -07:00
Michal Hrusecky 0ffec9bd4b
mariadb: Add sudo dependency
During update we use sudo to start an instance. It probably could be
workarounded, but given the MariaDB size, dependency on sudo shouldn't
be an issue.

Signed-off-by: Michal Hrusecky <michal.hrusecky@turris.com>
2022-01-14 15:32:48 +01:00
Michal Hrusecky b41525cef4
mariadb: Check and fix datadir owner issues during upgrade
If you are migrating to MariaDB package, you might have old datadir
stored somewhere using different setup with different users. If you
trust us enough to enable autoupgrade, you probably trust us enough to
chown your datadir as well. This can prevent some potential issues.

Signed-off-by: Michal Hrusecky <michal.hrusecky@turris.com>
2022-01-14 15:32:48 +01:00
Michal Hrusecky 2295c351ed mariadb: Create compatibility symlinks
For every mysql* binary create corresponding mariadb binary and vice
versa.

Signed-off-by: Michal Hrusecky <michal.hrusecky@turris.com>
2021-11-29 01:47:45 -08:00
Michal Hrusecky 4653d83048 mariadb: Install all supporting sql files
Do not pick just few random SQL files to install, install all of them.

Signed-off-by: Michal Hrusecky <michal.hrusecky@turris.com>
2021-11-29 01:47:45 -08:00
Michal Hrusecky a2c1a57282 mariadb: Tweak default configuration
Remove from default configuration options that are compiled in like
default paths and character set. On the other hand add few examples of
tweak options that might be handy.

Signed-off-by: Michal Hrusecky <michal.hrusecky@turris.com>
2021-11-29 01:47:45 -08:00
Michal Hrusecky 1be35284bb mariadb: Init script improvements
Update init script so other user/group can be used. Also make sure that
init script can actually create an empty database instead of forcing the
user to do it by hand. Other new feature is taking care of migration
of the database when upgrading the database.

Signed-off-by: Michal Hrusecky <michal.hrusecky@turris.com>
2021-11-29 01:47:45 -08:00
Michal Hrusecky d8ecded02d mariadb-common: Drop package and adjust configuration
The raison d'être of package mariadb-common was to provide common my.cnf
config file that was being used to include subdirectories and then to
push utf-8 as default everywhere. Let's make this file part of the
server package as there we actually set other options as well and drop
it from all clients. Instead let's set utf-8 as default in server,
client and client libraries. While at it also set socket to the more
common path and drop mysqld_safe script from the list of configuration
files and do other minor tweaks.

Signed-off-by: Michal Hrusecky <michal.hrusecky@turris.com>
2021-11-29 01:47:45 -08:00
Eneas U de Queiroz a3cec3e410
mariadb: use liburing if kernel supports it
liburing is preferred over libaio.  So, if liburing has already been
built, mariadb will use it, instead of libaio, failing with a missed
dependency.  If it is not found, then libaio is used.

Since it depends on the kernel being built with io_uring support, and it
defaults to y unless SMALL_FLASH=y, then we should allow libaio as
fallback, checking the CONFIG_KERNEL_IO_URING symbol.

Signed-off-by: Eneas U de Queiroz <cotequeiroz@gmail.com>
2021-11-04 15:12:58 -03:00
Eneas U de Queiroz e448917ad2
mariadb: ensure columnstore engine is disabled
mariadb may detect boost libraries, if the latter has been built with
threads, date_time and chorno support, then it will enable the
columnstore engine, which fails to build.

Set PKG_RELEASE:=$(AUTORLEASE).

Signed-off-by: Eneas U de Queiroz <cotequeiroz@gmail.com>
2021-11-04 15:12:55 -03:00
Michal Hrusecky b86b4cd1b8 mariadb: Update to version 10.6.4
Update to the latest stable version of MariaDB. Dropped few no longer
needed patches.

Signed-off-by: Michal Hrusecky <michal.hrusecky@turris.com>
2021-10-30 01:03:31 -07:00
Sebastian Kemper 1c73bd8591 mariadb: fix cmake issue
Same fix that went into libmariadb package with commit fd13c12.

Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
2021-06-26 23:11:53 +02:00
Rosen Penev 2e654b19f3 treewide: back to cmake.mk
Ninja was merged to base and therefore we can now use normal cmake.mk

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2021-06-12 21:05:01 -07:00
Rosen Penev a31b732007 treewide: build CMake projects with Ninja
faster to compile.

A small selection of packages was tested going from:

Executed in  696.30 secs   fish           external
   usr time   82.98 mins  395.00 micros   82.98 mins
   sys time    9.02 mins    0.00 micros    9.02 mins

to:

Executed in  592.20 secs   fish           external
   usr time   84.84 mins  361.00 micros   84.84 mins
   sys time    8.85 mins   57.00 micros    8.85 mins

Tested by running make -j 12 and wiping staging/build_dir/target_x

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2021-03-27 21:51:50 -07:00
Rosen Penev 8a62f2ea6b mariadb: update to 10.4.18
Remove uClibc depends. It's gone now.

Remove CMAKE_INSTALL to avoid installing to InstallDev.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2021-02-22 15:12:04 -08:00
Ilya Lipnitskiy 5d8d4fbbcb
treewide: Run refresh on all packages
The crude loop I wrote to come up with this changeset:

  find -L package/feeds/packages/ -name patches | \
  sed 's/patches$/refresh/' | sort | xargs make

Signed-off-by: Ilya Lipnitskiy <ilya.lipnitskiy@gmail.com>
2021-02-20 16:02:15 -08:00
Michal Hrusecky 33e4899870
mariadb: Update to 10.4.17
Update to the latest version from 10.4 series

Signed-off-by: Michal Hrusecky <michal.hrusecky@turris.com>
2020-11-16 13:24:44 +01:00
Michal Hrusecky c11f3948b8
mariadb: Cleanup and bump
Remove few no longer needed bits - like checking that datadir is defined
or mysqld_safe from server package and bumping revision after all the
init script cleanups.

Signed-off-by: Michal Hrusecky <michal.hrusecky@turris.com>
2020-10-14 11:08:42 +02:00
Michal Hrusecky 595f0f1a2d
mariadb: Use procd and run as user
Drop mysqld_safe and use procd instead. Also run as a user.

Signed-off-by: Michal Hrusecky <michal.hrusecky@turris.com>
2020-10-14 09:47:53 +02:00
Michal Hrusecky a01637ddf0
mariadb: Do not use mysqladmin in init
Rewrite init script as mysqladmin requires access to the MySQL which is
hard to guarantee. Use standard signals instead.

Signed-off-by: Michal Hrusecky <michal.hrusecky@turris.com>
2020-10-13 08:58:29 +02:00
Michal Hrusecky 7c628580a6
mariadb: Use defaults and change default datadir
Use /srv/mysql as default datadir as /var/lib/mysql is in tmpfs. This
doesn't affect any existing setup as up till now it had to be always
specified in configuration. That is addressed in the second part of this
commit - init script now uses even defaults as compiled in MariaDB so
not everything has to be specified in configuration file.

Signed-off-by: Michal Hrusecky <michal.hrusecky@turris.com>
2020-10-13 08:58:29 +02:00
Michal Hrusecky aa62c4c157 mariadb: Add basic test
Add simple to test to try to run MariaDB and get the version.

Signed-off-by: Michal Hrusecky <michal.hrusecky@turris.com>
2020-10-12 07:51:48 -10:00
Rosen Penev 8fa42fe787
mariadb: fix compilation when selinux is present
Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-10-11 22:14:02 -07:00
Michal Hrusecky 59a9d8dba8
mariadb: Update to version 10.4.14
Signed-off-by: Michal Hrusecky <michal.hrusecky@turris.com>
2020-10-02 10:36:47 +02:00
Michal Hrusecky c35bd3aa8e
mariadb: Add shellcheck disable into init script
On few places, shellcheck gets confused by how some OpenWrt functions
work - especially load ones. Also on few places there are $options
variables that need not to be globbed. Could be rewritten better not to
need them, but I'll do major rewrites later in separate pull request.

Signed-off-by: Michal Hrusecky <michal.hrusecky@turris.com>
2020-10-02 10:36:47 +02:00
Michal Hrusecky bb6e0d799c
mariadb: Use double quotes where possible
Just to make sure, add double quotes around strings and various
variables. In some cases it could prevent some issues, in other cases it
is just a good practice.

Signed-off-by: Michal Hrusecky <michal.hrusecky@turris.com>
2020-10-02 10:06:38 +02:00
Michal Hrusecky 173314eb8f
mariadb: Handle non-existent logger in init
Make sure init script has a fallback when logger is not available.

Signed-off-by: Michal Hrusecky <michal.hrusecky@turris.com>
2020-10-01 16:02:42 +02:00
Sebastian Kemper 14f90f72f8 mariadb: use fakeroot instead of postinst script
fakeroot support was recently added to OpenWrt. Let's make use of it.

Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
2020-09-17 19:24:09 +02:00
Michal Hrusecky 68bf6c95ec mariadb/libmariadb: Take over as a maintainer
Signed-off-by: Michal Hrusecky <michal@hrusecky.net>
2020-07-09 14:39:43 +02:00
Sebastian Kemper 70dcf9aa84 mariadb: remove maintainer
Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
2020-07-08 18:29:07 +02:00
Sebastian Kemper c6f6d1d71d mariadb: move some binaries
Even though I think that mysql_upgrade is a client package (it depends
on the mysql client and it's in the "client" directory in the source
tree, for instance), upstream laid it out differently. Since upstream
commit ec586f5 mysql_upgrade is to be considered a part of the server,
because the COMPONENT argument in the MYSQL_ADD_EXECUTABLE macro is set
to "Server".

That means that mysql_upgrade is only installed when the server is. So
we need to move it back to the server package, otherwise we will have a
build failure when mariadb-client is selected while mariadb-server is
not. This particular build failure was recently a topic on
openwrt-devel.

Some more binaries are moved, following the layout visible in
"man/CMakeLists.txt", to make sure we follow upstream's vision with
regards to how the binaries are packaged.

Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
2020-06-13 20:05:08 +02:00
Sebastian Kemper 0e1a289613 mariadb: bump to 10.4.13
Upstream added define INSTALL_PAMDATADIR, so hardcoded path is gone.

Fixes:

  CVE-2020-2752
  CVE-2020-2812
  CVE-2020-2814
  CVE-2020-2760

Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
2020-05-17 22:18:25 +02:00
Sebastian Kemper fa6ea0b137 mariadb: switch init to mysqld_safe and mysqladmin
mysqld_safe is the recommended way to start the server on non-systemd
systems ([1]). For instance, it has a crash detection with auto-restart
function, can update ulimits, setup core files, set the niceness of the
server etc. It looks like it could also be helpful when trying to set up
clusters. It's maintained upstream and adding it means we don't need to
add these features into our init script.

mysqld_safe is a script itself, so it's added to conffiles in case users
want to edit it.

It can't be run under procd, so the init script is converted to a normal
System V type. To stop the server and to reload the privileges tables
mysqladmin is used. To that end mysqladmin is moved into the server
package.

While changing the init script, the Debian init script was used for
ideas. It wasn't copied verbatim and adapted a bit here and there.
Thanks to whoever wrote it!

This commit removes the support for starting the service as a user other
than "mariadb". This makes the init script simpler. If anybody wants to
play around with the user then it's up to them to fix the permissions.

[1] https://mariadb.com/kb/en/mysqld_safe/

Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
2020-05-12 00:13:11 +02:00
Sebastian Kemper a61c97203f mariadb: move mysql_upgrade to the client package
It's really a client. It connects to the running server as a client, to
upgrade the DBs. And it depends on both mysql and mysqlcheck.

Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
2020-05-11 22:38:55 +02:00
Sebastian Kemper b16e9c1e2d mariadb: update auth_pam handling
With INSTALL_PAMDIR undefined some items necessary for the auth_pam
module aren't built. This adds the define so that configuration and
shared object become available.

This commit also tightens up the installation of the SUID tool. The
directory it is copied into gets created on the build host already with
u=rwx,g=rx,o=, so it cannot be accessed on target, except by root. The
post-install script then changes group ownership of the directory to the
"mariadb" group only if the directory is really a directory and owned by
"root:root".

Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
2020-05-11 22:30:13 +02:00
Sebastian Kemper 19de52a044 mariadb: install config files readable for all
Until now $(INSTALL_CONF) is used for configuration files that go into
/etc/mysql. This commit replaces that with $(INSTALL_DATA). The
configuration files are not only parsed by the server, but also by the
clients (which can be anybody).

This also removes a comment about a cron job from one of the
configuration files. There is no cron job.

Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
2020-05-11 22:15:01 +02:00
Sebastian Kemper 9f5fb8034c mariadb: follow up on CVE-2020-7221
Today CVE-2020-7221 was publicly discussed on oss-sec [1]. MariaDB
upstream had not mentioned this CVE in their last release notes. The CVE
is related to auth-pam and the possibility of a local mariadb to root
user exploit in the mysql_install_db script.

Upstream has made amendments to the script, but according to the oss-sec
posts the folder permissions were not updated as they should have been.

In OpenWrt the script mysql_install_db is actually patched to never run
the commands in question. This has been this way since MariaDB 10.4 was
made available.

Still, the directory permissions set by the postinstall script are too
lax. To quote the discoverer of the issue, Matthias Gerstner from Suse,
they exhibit "the dangerous situation of a setuid-root binary residing
in a directory owned by an unprivileged user".

This commit fixes this by changing the permissions to the following:

root:mariadb  0750 /usr/lib/mariadb/plugin/auth_pam_tool_dir

This way the setuid-root binary is only available to root and the
mariadb user, while at the same time the mariadb user has no ownership
of the directory.

[1] https://seclists.org/oss-sec/2020/q1/55

Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
2020-02-04 20:14:09 +01:00
Sebastian Kemper 4de12edd85 mariadb: security bump to 10.4.12
Fixes CVE-2020-2574.

Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
2020-01-30 21:25:06 +01:00
Sebastian Kemper d792174804 mariadb: prevent building against uClibc
MariaDB 10.4 includes some changes in sql/sql_statistics.cc that require
std::fmin and std::fmax. But these functions aren't available when
libstdc++ is compiled against uClibc, because uClibc doesn't pass the
test when libstdc++ checks for C99 math that supports "TR1" facilities
(macro: GLIBCXX_CHECK_C99_TR1).

Hence compilation fails:

[ 90%] Building CXX object sql/CMakeFiles/sql.dir/sql_table.cc.o
/builder/shared-workdir/build/sdk/build_dir/target-arc_archs_uClibc/mariadb-10.4.10/sql/sql_statistics.cc: In member function 'void Column_statistics_collected::finish(ha_rows, double)':
/builder/shared-workdir/build/sdk/build_dir/target-arc_archs_uClibc/mariadb-10.4.10/sql/sql_statistics.cc:2533:20: error: 'fmax' is not a member of 'std'
         val = std::fmax(estimate_total_distincts * (rows - nulls) / rows, 1.0);

This commit updates package dependencies to prevent a build against
uClibc. There is no reason to waste CPU cycles on the build bots.

The dependencies are also tidied up. In the past it made sense to define
MARIADB_COMMON_DEPENDS and MARIADB_COMMON_DEPENDS_EXE, because the
server had different dependencies compared to the library. But since the
library is now in its own package we can remove the differentiation.

Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
2019-11-20 20:51:23 +01:00
Sebastian Kemper 4a67c844db mariadb: small plugins fixes
This adds a few lines to the BuildPlugin routine to install some missing
files for auth_pam as well as ha_spider.

It also adds a postinstall script that updates the ownership of a
directory used by auth_pam.

Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
2019-11-17 17:17:04 +01:00
Sebastian Kemper c1964dd8d2 mariadb: move libmariadb into its own package
This way when only wanting the library nobody needs to download and
compile the server package, saving space and time. Also this way we can
avoid sudden SONAME bumps during a server upgrade.

Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
2019-11-17 16:05:29 +01:00