summaryrefslogtreecommitdiff
path: root/crates/arti
diff options
context:
space:
mode:
Diffstat (limited to 'crates/arti')
-rw-r--r--crates/arti/Cargo.toml6
-rw-r--r--crates/arti/README.md11
-rw-r--r--crates/arti/build.rs4
-rw-r--r--crates/arti/src/arti-example-config.toml21
-rw-r--r--crates/arti/src/cfg.rs48
5 files changed, 51 insertions, 39 deletions
diff --git a/crates/arti/Cargo.toml b/crates/arti/Cargo.toml
index 942962569..cddbbc823 100644
--- a/crates/arti/Cargo.toml
+++ b/crates/arti/Cargo.toml
@@ -28,7 +28,6 @@ default = [
full = [
"default-runtime",
- "memquota",
"onion-service-client",
"onion-service-service",
"vanguards",
@@ -74,7 +73,10 @@ dns-proxy = ["hickory-proto"]
experimental-api = ["arti-client/experimental-api", "visibility", "__is_experimental"]
harden = ["secmem-proc"]
keymgr = ["arti-client/keymgr", "__is_experimental"]
-memquota = ["arti-client/memquota"]
+# the "memquota" feature is now a no-op as the functionality is always-enabled,
+# but the feature is kept for backwards compatibility
+# https://gitlab.torproject.org/tpo/core/arti/-/issues/2030
+memquota = []
tokio = ["tokio-crate", "arti-client/tokio", "tor-rtcompat/tokio", "tokio-util"]
native-tls = ["arti-client/native-tls", "tor-rtcompat/native-tls"]
onion-service-client = ["arti-client/onion-service-client"]
diff --git a/crates/arti/README.md b/crates/arti/README.md
index dfcf8f8c2..5830e41c9 100644
--- a/crates/arti/README.md
+++ b/crates/arti/README.md
@@ -121,7 +121,6 @@ work.
DNS queries over the Tor network.
* `harden` (default) -- Build with support for hardening the Arti process by
disabling debugger attachment and other local memory-inspection vectors.
-* `memquota` -- Build with support for memory use tracking and limiting.
* `compression` (default) -- Build support for downloading compressed
documents. Requires a C compiler.
* `bridge-client` (default) -- Build with support for bridges.
@@ -191,6 +190,16 @@ implementation with another.
work reliably. To be explicit, if you want `cargo update` to _only_ make
correct changes, then you cannot enable these features.
+### Deprecated features
+
+These features are either not recommended, or are no-op features.
+They are included for backwards compatibility.
+Note that these features will still be enabled if you build with the
+`--all-features` cargo flag.
+
+* `memquota` -- Memory quota tracking is now always supported,
+ regardless of if this feature is enabled.
+
[#1795]: https://gitlab.torproject.org/tpo/core/arti/-/issues/1795
## Limitations
diff --git a/crates/arti/build.rs b/crates/arti/build.rs
index 00e8d611d..aeb11b5dc 100644
--- a/crates/arti/build.rs
+++ b/crates/arti/build.rs
@@ -11,5 +11,9 @@ fn main() {
//
// (We don't want this to be a normal cargo feature because then it would be enabled
// with --workspace --all-features, defeating the point.)
+ //
+ // NOTE: This was previously used by memquota which was behind a feature flag. Now that we
+ // always build arti with support for memquota, this is unused. But leaving it in place for now
+ // anyways in case we want it again in the future.
println!(r#"cargo:rustc-check-cfg=cfg(arti_features_precise)"#);
}
diff --git a/crates/arti/src/arti-example-config.toml b/crates/arti/src/arti-example-config.toml
index 4d80738c7..1ce4770ed 100644
--- a/crates/arti/src/arti-example-config.toml
+++ b/crates/arti/src/arti-example-config.toml
@@ -473,15 +473,26 @@
#max_files = 16384
# Are we limiting memory use and if so to how much?
-# The default is unlimited.
#
-# Maximum memory use, after which reclamation starts:
+# Maximum memory use, after which reclamation starts.
+#
+# The default is "auto", which uses a value derived from the total system
+# memory. It should not be assumed that the value used for "auto" will remain
+# stable across different versions of arti. The value used for "auto" may also
+# take into account other OS-specific features, such as cgroups on Linux.
+#
+# If `system.memory.low_water` is given as an explicit value,
+# `system.memory.max` must also be given as an explicit value.
+#
# memory.max = "8 GiB"
-# (If anything is specified in `[system.memory]`, this value is mandatory.)
#
-# When reclaiming memory, we stop when we reach this amount:
+# When reclaiming memory, we stop when we reach this amount.
+#
+# The default is "auto", which uses 3/4 of `system.memory.max`. It should not be
+# assumed that the value used for "auto" will remain stable across different
+# versions of arti.
+#
# memory.low_water = "6 GiB"
-# (The default is 3/4 of `system.memory.max`.)
##### ONION SERVICES
#
diff --git a/crates/arti/src/cfg.rs b/crates/arti/src/cfg.rs
index 5454e7532..b67a4a814 100644
--- a/crates/arti/src/cfg.rs
+++ b/crates/arti/src/cfg.rs
@@ -1261,37 +1261,23 @@ example config file {which:?}, uncommented={uncommented:?}
let result = file.resolve_return_results::<(TorClientConfig, ArtiConfig)>();
- cfg_if::cfg_if! {
- if #[cfg(feature = "memquota")] {
- let result = result.unwrap();
-
- // Test that the example config doesn't have any unrecognised keys
- assert_eq!(result.unrecognized, []);
- assert_eq!(result.deprecated, []);
-
- let inner: &tor_memquota::testing::ConfigInner =
- result.value.0.system_memory().inner().unwrap();
-
- // Test that the example low_water is the default
- // value for the example max.
- let defaulted_low = tor_memquota::Config::builder()
- .max(*inner.max)
- .build()
- .unwrap();
- let inner_defaulted_low = defaulted_low.inner().unwrap();
- assert_eq!(inner, inner_defaulted_low);
- } else if #[cfg(arti_features_precise)] {
- // Test that requesting memory quota tracking generates a config error
- // if support is compiled out.
- let m = result.unwrap_err().report().to_string();
- assert!(m.contains("cargo feature `memquota` disabled"), "{m:?}");
- } else {
- // The `tor-memquota/memquota` feature is enabled by default in tor-memquota,
- // but the corresponding `memquota` feature is but not enabled here in `arti`.
- // so cargo --workspace enables it in a way we can't tell. See arti/build.rs.
- println!("not testing memquota config, cannot figure out if it's enabled");
- }
- }
+ let result = result.unwrap();
+
+ // Test that the example config doesn't have any unrecognised keys
+ assert_eq!(result.unrecognized, []);
+ assert_eq!(result.deprecated, []);
+
+ let inner: &tor_memquota::testing::ConfigInner =
+ result.value.0.system_memory().inner().unwrap();
+
+ // Test that the example low_water is the default
+ // value for the example max.
+ let defaulted_low = tor_memquota::Config::builder()
+ .max(*inner.max)
+ .build()
+ .unwrap();
+ let inner_defaulted_low = defaulted_low.inner().unwrap();
+ assert_eq!(inner, inner_defaulted_low);
}
#[test]