diff --git a/Cargo.lock b/Cargo.lock index 70d09219..638b0c43 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1596,12 +1596,6 @@ dependencies = [ "crunchy", ] -[[package]] -name = "hardened_malloc-rs" -version = "0.1.2+12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "647deb1583b14d160f85f3ff626f20b6edd366e3852c9843b06077388f794cb6" - [[package]] name = "hashbrown" version = "0.15.5" @@ -4907,7 +4901,6 @@ dependencies = [ "clap", "const-str", "ctor", - "hardened_malloc-rs", "log", "opentelemetry", "opentelemetry_sdk", @@ -5006,7 +4999,6 @@ dependencies = [ "either", "figment", "futures", - "hardened_malloc-rs", "http", "http-body-util", "insta", diff --git a/Cargo.toml b/Cargo.toml index 99522fa6..849076fa 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -163,15 +163,6 @@ version = "0.3" default-features = false features = ["std", "async-await"] -[workspace.dependencies.hardened_malloc-rs] -version = "0.1.2" -default-features = false -features = [ - "static", - "gcc", - "light", -] - [workspace.dependencies.hickory-resolver] version = "0.25" default-features = false diff --git a/docker/bake.hcl b/docker/bake.hcl index 80c8afb7..a547a6d1 100644 --- a/docker/bake.hcl +++ b/docker/bake.hcl @@ -32,9 +32,9 @@ cargo_feat_sets = { # Default features default = "brotli_compression,element_hacks,gzip_compression,io_uring,jemalloc,jemalloc_conf,media_thumbnail,release_max_log_level,systemd,url_preview,zstd_compression" # All features sans release_max_log_level - logging = "blurhashing,brotli_compression,bzip2_compression,console,direct_tls,element_hacks,gzip_compression,hardened_malloc,io_uring,jemalloc,jemalloc_conf,jemalloc_prof,jemalloc_stats,ldap,lz4_compression,media_thumbnail,perf_measurements,sentry_telemetry,systemd,tokio_console,tuwunel_mods,url_preview,zstd_compression" + logging = "blurhashing,brotli_compression,bzip2_compression,console,direct_tls,element_hacks,gzip_compression,io_uring,jemalloc,jemalloc_conf,jemalloc_prof,jemalloc_stats,ldap,lz4_compression,media_thumbnail,perf_measurements,sentry_telemetry,systemd,tokio_console,tuwunel_mods,url_preview,zstd_compression" # All features - all = "blurhashing,brotli_compression,bzip2_compression,console,direct_tls,element_hacks,gzip_compression,hardened_malloc,io_uring,jemalloc,jemalloc_conf,jemalloc_prof,jemalloc_stats,ldap,lz4_compression,media_thumbnail,perf_measurements,release_max_log_level,sentry_telemetry,systemd,tokio_console,tuwunel_mods,url_preview,zstd_compression" + all = "blurhashing,brotli_compression,bzip2_compression,console,direct_tls,element_hacks,gzip_compression,io_uring,jemalloc,jemalloc_conf,jemalloc_prof,jemalloc_stats,ldap,lz4_compression,media_thumbnail,perf_measurements,release_max_log_level,sentry_telemetry,systemd,tokio_console,tuwunel_mods,url_preview,zstd_compression" } variable "cargo_features_always" { default = "direct_tls" @@ -1637,7 +1637,6 @@ target "kitchen" { args = { packages = join(" ", [ contains(split(",", cargo_feat_sets[feat_set]), "bzip2_compression")? "libbz2-dev": "", - contains(split(",", cargo_feat_sets[feat_set]), "hardened_malloc")? "g++": "", contains(split(",", cargo_feat_sets[feat_set]), "io_uring")? "liburing-dev": "", contains(split(",", cargo_feat_sets[feat_set]), "jemalloc")? "libjemalloc-dev": "", contains(split(",", cargo_feat_sets[feat_set]), "lz4_compression")? "liblz4-dev": "", diff --git a/flake.nix b/flake.nix index 857dabb0..0a3e954b 100644 --- a/flake.nix +++ b/flake.nix @@ -204,8 +204,6 @@ # be expected on non-debug builds. "jemalloc_prof" "jemalloc_stats" - # this is non-functional on nix for some reason - "hardened_malloc" # tuwunel_mods is a development-only hot reload feature "tuwunel_mods" ]; @@ -218,8 +216,6 @@ # dont include experimental features "experimental" # this is non-functional on nix for some reason - "hardened_malloc" - # tuwunel_mods is a development-only hot reload feature "tuwunel_mods" ]; }; @@ -231,8 +227,6 @@ # dont include experimental features "experimental" # this is non-functional on nix for some reason - "hardened_malloc" - # tuwunel_mods is a development-only hot reload feature "tuwunel_mods" ]; }; @@ -246,8 +240,6 @@ "jemalloc_prof" "jemalloc_stats" # this is non-functional on nix for some reason - "hardened_malloc" - # tuwunel_mods is a development-only hot reload feature "tuwunel_mods" ]; }; @@ -260,12 +252,9 @@ # dont include experimental features "experimental" # this is non-functional on nix for some reason - "hardened_malloc" - # tuwunel_mods is a development-only hot reload feature "tuwunel_mods" ]; }; - hmalloc = scopeHost.main.override { features = ["hardened_malloc"]; }; oci-image = scopeHost.oci-image; oci-image-all-features = scopeHost.oci-image.override { @@ -278,8 +267,6 @@ # be expected on non-debug builds. "jemalloc_prof" "jemalloc_stats" - # this is non-functional on nix for some reason - "hardened_malloc" # tuwunel_mods is a development-only hot reload feature "tuwunel_mods" ]; @@ -294,18 +281,11 @@ disable_features = [ # dont include experimental features "experimental" - # this is non-functional on nix for some reason - "hardened_malloc" # tuwunel_mods is a development-only hot reload feature "tuwunel_mods" ]; }; }; - oci-image-hmalloc = scopeHost.oci-image.override { - main = scopeHost.main.override { - features = ["hardened_malloc"]; - }; - }; book = scopeHost.book; @@ -359,8 +339,6 @@ disable_features = [ # dont include experimental features "experimental" - # this is non-functional on nix for some reason - "hardened_malloc" # tuwunel_mods is a development-only hot reload feature "tuwunel_mods" ]; @@ -379,8 +357,6 @@ # be expected on non-debug builds. "jemalloc_prof" "jemalloc_stats" - # this is non-functional on nix for some reason - "hardened_malloc" # tuwunel_mods is a development-only hot reload feature "tuwunel_mods" ]; @@ -400,8 +376,6 @@ # be expected on non-debug builds. "jemalloc_prof" "jemalloc_stats" - # this is non-functional on nix for some reason - "hardened_malloc" # tuwunel_mods is a development-only hot reload feature "tuwunel_mods" ]; @@ -420,22 +394,12 @@ disable_features = [ # dont include experimental features "experimental" - # this is non-functional on nix for some reason - "hardened_malloc" # tuwunel_mods is a development-only hot reload feature "tuwunel_mods" ]; }; } - # An output for a statically-linked binary with hardened_malloc - { - name = "${binaryName}-hmalloc"; - value = scopeCrossStatic.main.override { - features = ["hardened_malloc"]; - }; - } - # An output for an OCI image based on that binary { name = "oci-image-${crossSystem}"; @@ -478,8 +442,6 @@ # be expected on non-debug builds. "jemalloc_prof" "jemalloc_stats" - # this is non-functional on nix for some reason - "hardened_malloc" # tuwunel_mods is a development-only hot reload feature "tuwunel_mods" ]; @@ -501,8 +463,6 @@ # be expected on non-debug builds. "jemalloc_prof" "jemalloc_stats" - # this is non-functional on nix for some reason - "hardened_malloc" # tuwunel_mods is a development-only hot reload feature "tuwunel_mods" ]; @@ -523,8 +483,6 @@ disable_features = [ # dont include experimental features "experimental" - # this is non-functional on nix for some reason - "hardened_malloc" # tuwunel_mods is a development-only hot reload feature "tuwunel_mods" ]; @@ -532,16 +490,6 @@ }; } - # An output for an OCI image based on that binary with hardened_malloc - { - name = "oci-image-${crossSystem}-hmalloc"; - value = scopeCrossStatic.oci-image.override { - main = scopeCrossStatic.main.override { - features = ["hardened_malloc"]; - }; - }; - } - # An output for a complement OCI image for the specified platform { name = "complement-${crossSystem}"; @@ -571,8 +519,6 @@ # be expected on non-debug builds. "jemalloc_prof" "jemalloc_stats" - # this is non-functional on nix for some reason - "hardened_malloc" # tuwunel_mods is a development-only hot reload feature "tuwunel_mods" ]; diff --git a/nix/pkgs/main/default.nix b/nix/pkgs/main/default.nix index efeba0d5..651c525a 100644 --- a/nix/pkgs/main/default.nix +++ b/nix/pkgs/main/default.nix @@ -23,8 +23,6 @@ # be expected on non-debug builds. "jemalloc_prof" "jemalloc_stats" - # this is non-functional on nix for some reason - "hardened_malloc" # tuwunel_mods is a development-only hot reload feature "tuwunel_mods" ] diff --git a/src/core/Cargo.toml b/src/core/Cargo.toml index 72e545fc..5f563fef 100644 --- a/src/core/Cargo.toml +++ b/src/core/Cargo.toml @@ -26,9 +26,6 @@ tuwunel_mods = [ gzip_compression = [ "reqwest/gzip", ] -hardened_malloc = [ - "dep:hardened_malloc-rs" -] jemalloc = [ "dep:tikv-jemalloc-sys", "dep:tikv-jemalloc-ctl", @@ -114,10 +111,6 @@ url.workspace = true [target.'cfg(unix)'.dependencies] nix.workspace = true -[target.'cfg(all(not(target_env = "msvc"), target_os = "linux"))'.dependencies] -hardened_malloc-rs.workspace = true -hardened_malloc-rs.optional = true - [dev-dependencies] insta.workspace = true maplit.workspace = true diff --git a/src/core/alloc/hardened.rs b/src/core/alloc/hardened.rs deleted file mode 100644 index 5f850673..00000000 --- a/src/core/alloc/hardened.rs +++ /dev/null @@ -1,15 +0,0 @@ -//! hmalloc allocator - -#[global_allocator] -static HMALLOC: hardened_malloc_rs::HardenedMalloc = hardened_malloc_rs::HardenedMalloc; - -pub fn trim>>(_: I) -> crate::Result { Ok(()) } - -#[must_use] -//TODO: get usage -pub fn memory_usage() -> Option { None } - -#[must_use] -pub fn memory_stats(_opts: &str) -> Option { - Some("Extended statistics are not available from hardened_malloc.".to_owned()) -} diff --git a/src/core/alloc/mod.rs b/src/core/alloc/mod.rs index 4af6ddb0..ae8bdc98 100644 --- a/src/core/alloc/mod.rs +++ b/src/core/alloc/mod.rs @@ -6,26 +6,7 @@ pub mod je; #[cfg(all(not(target_env = "msvc"), feature = "jemalloc"))] pub use je::{memory_stats, memory_usage, trim}; -#[cfg(all( - not(target_env = "msvc"), - feature = "hardened_malloc", - not(feature = "jemalloc") -))] -pub mod hardened; -#[cfg(all( - not(target_env = "msvc"), - feature = "hardened_malloc", - not(feature = "jemalloc") -))] -pub use hardened::{memory_stats, memory_usage, trim}; - -#[cfg(any( - target_env = "msvc", - all(not(feature = "hardened_malloc"), not(feature = "jemalloc")) -))] +#[cfg(any(target_env = "msvc", not(feature = "jemalloc")))] pub mod default; -#[cfg(any( - target_env = "msvc", - all(not(feature = "hardened_malloc"), not(feature = "jemalloc")) -))] +#[cfg(any(target_env = "msvc", not(feature = "jemalloc")))] pub use default::{memory_stats, memory_usage, trim}; diff --git a/src/main/Cargo.toml b/src/main/Cargo.toml index 3c3f7084..ca884ed0 100644 --- a/src/main/Cargo.toml +++ b/src/main/Cargo.toml @@ -100,9 +100,6 @@ gzip_compression = [ "tuwunel-router/gzip_compression", "tuwunel-service/gzip_compression", ] -hardened_malloc = [ - "tuwunel-core/hardened_malloc", -] io_uring = [ "tuwunel-admin/io_uring", "tuwunel-api/io_uring", @@ -236,10 +233,6 @@ tracing-opentelemetry.workspace = true tracing-subscriber.workspace = true tracing.workspace = true -[target.'cfg(all(not(target_env = "msvc"), target_os = "linux"))'.dependencies] -hardened_malloc-rs.workspace = true -hardened_malloc-rs.optional = true - [lints] workspace = true