Patch librocksdb-sys to never enable jemalloc, which conflicts with mimalloc

Allows us to update mimalloc and enable the newly added guard pages.

Conflict identified by @PlasmaPower.
This commit is contained in:
Luke Parker
2025-11-11 23:00:48 -05:00
parent 21eaa5793d
commit c52f7634de
4 changed files with 51 additions and 13 deletions

View File

@@ -171,10 +171,6 @@ ark-ff-4 = { package = "ark-ff", path = "patches/ethereum/ark-ff-0.4" }
c-kzg = { path = "patches/ethereum/c-kzg" } c-kzg = { path = "patches/ethereum/c-kzg" }
secp256k1-30 = { package = "secp256k1", path = "patches/ethereum/secp256k1-30" } secp256k1-30 = { package = "secp256k1", path = "patches/ethereum/secp256k1-30" }
# Updates to the latest version
darling = { path = "patches/darling" }
thiserror = { path = "patches/thiserror" }
# Dependencies from monero-oxide which originate from within our own tree # Dependencies from monero-oxide which originate from within our own tree
std-shims = { path = "patches/std-shims" } std-shims = { path = "patches/std-shims" }
simple-request = { path = "patches/simple-request" } simple-request = { path = "patches/simple-request" }
@@ -185,12 +181,18 @@ dalek-ff-group = { path = "crypto/dalek-ff-group" }
minimal-ed448 = { path = "crypto/ed448" } minimal-ed448 = { path = "crypto/ed448" }
modular-frost = { path = "crypto/frost" } modular-frost = { path = "crypto/frost" }
# Patch due to `std` now including the required functionality
is_terminal_polyfill = { path = "./patches/is_terminal_polyfill" }
# This has a non-deprecated `std` alternative since Rust's 2024 edition
home = { path = "patches/home" }
# Updates to the latest version
darling = { path = "patches/darling" }
thiserror = { path = "patches/thiserror" }
# https://github.com/rust-lang-nursery/lazy-static.rs/issues/201 # https://github.com/rust-lang-nursery/lazy-static.rs/issues/201
lazy_static = { git = "https://github.com/rust-lang-nursery/lazy-static.rs", rev = "5735630d46572f1e5377c8f2ba0f79d18f53b10c" } lazy_static = { git = "https://github.com/rust-lang-nursery/lazy-static.rs", rev = "5735630d46572f1e5377c8f2ba0f79d18f53b10c" }
# These has an `std` alternative since Rust's 2024 edition
home = { path = "patches/home" }
# directories-next was created because directories was unmaintained # directories-next was created because directories was unmaintained
# directories-next is now unmaintained while directories is maintained # directories-next is now unmaintained while directories is maintained
# The directories author pulls in ridiculously pointless crates and prefers # The directories author pulls in ridiculously pointless crates and prefers
@@ -203,8 +205,8 @@ directories-next = { path = "patches/directories-next" }
k256 = { git = "https://github.com/kayabaNerve/elliptic-curves", rev = "4994c9ab163781a88cd4a49beae812a89a44e8c3" } k256 = { git = "https://github.com/kayabaNerve/elliptic-curves", rev = "4994c9ab163781a88cd4a49beae812a89a44e8c3" }
p256 = { git = "https://github.com/kayabaNerve/elliptic-curves", rev = "4994c9ab163781a88cd4a49beae812a89a44e8c3" } p256 = { git = "https://github.com/kayabaNerve/elliptic-curves", rev = "4994c9ab163781a88cd4a49beae812a89a44e8c3" }
# Patch due to `std` now including the required functionality # `jemalloc` conflicts with `mimalloc`, so patch to a `rocksdb` which never uses `jemalloc`
is_terminal_polyfill = { path = "./patches/is_terminal_polyfill" } librocksdb-sys = { path = "patches/librocksdb-sys" }
[workspace.lints.clippy] [workspace.lints.clippy]
incompatible_msrv = "allow" # Manually verified with a GitHub workflow incompatible_msrv = "allow" # Manually verified with a GitHub workflow

View File

@@ -7,10 +7,10 @@ FROM alpine:latest AS mimalloc-alpine
RUN apk update && apk upgrade && apk --no-cache add gcc g++ libc-dev make cmake git RUN apk update && apk upgrade && apk --no-cache add gcc g++ libc-dev make cmake git
RUN git clone https://github.com/microsoft/mimalloc && \ RUN git clone https://github.com/microsoft/mimalloc && \
cd mimalloc && \ cd mimalloc && \
git checkout 43ce4bd7fd34bcc730c1c7471c99995597415488 && \ git checkout fbd8b99c2b828428947d70fdc046bb55609be93e && \
mkdir -p out/secure && \ mkdir -p out/secure && \
cd out/secure && \ cd out/secure && \
cmake -DMI_SECURE=ON ../.. && \ cmake -DMI_SECURE=ON -DMI_GUARDED=on ../.. && \
make && \ make && \
cp ./libmimalloc-secure.so ../../../libmimalloc.so cp ./libmimalloc-secure.so ../../../libmimalloc.so
"#; "#;
@@ -21,10 +21,10 @@ FROM debian:trixie-slim AS mimalloc-debian
RUN apt update && apt upgrade -y && apt install -y gcc g++ make cmake git RUN apt update && apt upgrade -y && apt install -y gcc g++ make cmake git
RUN git clone https://github.com/microsoft/mimalloc && \ RUN git clone https://github.com/microsoft/mimalloc && \
cd mimalloc && \ cd mimalloc && \
git checkout 43ce4bd7fd34bcc730c1c7471c99995597415488 && \ git checkout fbd8b99c2b828428947d70fdc046bb55609be93e && \
mkdir -p out/secure && \ mkdir -p out/secure && \
cd out/secure && \ cd out/secure && \
cmake -DMI_SECURE=ON ../.. && \ cmake -DMI_SECURE=ON -DMI_GUARDED=on ../.. && \
make && \ make && \
cp ./libmimalloc-secure.so ../../../libmimalloc.so cp ./libmimalloc-secure.so ../../../libmimalloc.so
"#; "#;

View File

@@ -0,0 +1,35 @@
[package]
name = "librocksdb-sys"
version = "0.17.99"
description = "Replacement for `librocksdb-sys` which removes the `jemalloc` feature"
license = "MIT"
repository = "https://github.com/serai-dex/serai/tree/develop/patches/librocksdb-sys"
authors = ["Luke Parker <lukeparker5132@gmail.com>"]
keywords = []
edition = "2018"
[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]
[workspace]
[dependencies]
# librocksdb-sys 0.17.3+10.4.2, with the commit provided by crates.io in `cargo_vcs_info.json`
librocksdb-sys = { git = "https://github.com/rust-rocksdb/rust-rocksdb", commit = "bb7d2168eab1bc7849f23adbcb825e3aba1bd2f4", default-features = false }
[features]
default = ["librocksdb-sys/default"]
jemalloc = []
static = ["librocksdb-sys/static"]
bindgen-runtime = ["librocksdb-sys/bindgen-runtime"]
bindgen-static = ["librocksdb-sys/bindgen-static"]
mt_static = ["librocksdb-sys/mt_static"]
io-uring = ["librocksdb-sys/io-uring"]
snappy = ["librocksdb-sys/snappy"]
lz4 = ["librocksdb-sys/lz4"]
zstd = ["librocksdb-sys/zstd"]
zlib = ["librocksdb-sys/zlib"]
bzip2 = ["librocksdb-sys/bzip2"]
rtti = ["librocksdb-sys/rtti"]
lto = ["librocksdb-sys/lto"]

View File

@@ -0,0 +1 @@
pub use librocksdb_sys::*;