From e1baeb4e5656300f4e5b812b435b95b5379bc79a Mon Sep 17 00:00:00 2001 From: Mingwei Samuel Date: Mon, 19 Aug 2024 22:00:49 -0700 Subject: [PATCH 1/2] Small cleanups and fixups - Moves bins into standard `src/bin` folder - Adds a basic test (TODO: doesn't work on gh-actions CI) - Reformat with new `rustfmt.toml`, rearrange some code, add some comments - Fix wrong error message for `GetVersionExA` - `cargo update` --- .github/workflows/blondie.yml | 5 +- .github/workflows/clippy.yml | 19 +- Cargo.lock | 1092 ++++++++++++++---------- Cargo.toml | 2 - rustfmt.toml | 10 + src/{blondie_bin.rs => bin/blondie.rs} | 0 src/{ => bin}/blondie_dtrace.rs | 0 src/lib.rs | 99 ++- tests/basic.rs | 9 + 9 files changed, 716 insertions(+), 520 deletions(-) create mode 100644 rustfmt.toml rename src/{blondie_bin.rs => bin/blondie.rs} (100%) rename src/{ => bin}/blondie_dtrace.rs (100%) create mode 100644 tests/basic.rs diff --git a/.github/workflows/blondie.yml b/.github/workflows/blondie.yml index 85d8c7e..4999971 100644 --- a/.github/workflows/blondie.yml +++ b/.github/workflows/blondie.yml @@ -43,8 +43,9 @@ jobs: - name: Build run: cargo build --release --all-features --verbose - - name: Run tests - run: cargo test --release --all-features --verbose -- --nocapture + # TODO: Doesn't record any tracing events on github-actions + # - name: Run tests + # run: cargo test --release --all-features --verbose -- --nocapture docs: runs-on: windows-latest diff --git a/.github/workflows/clippy.yml b/.github/workflows/clippy.yml index ffe5f59..b74791e 100644 --- a/.github/workflows/clippy.yml +++ b/.github/workflows/clippy.yml @@ -13,23 +13,6 @@ jobs: - uses: actions/checkout@v2 - run: rustup component add clippy - -# Workaround from https://github.com/actions-rs/clippy-check/issues/2#issuecomment-807878478 - # - name: Check workflow permissions - # id: check_permissions - # uses: scherermichael-oss/action-has-permission@1.0.6 - # with: - # required-permission: write - # env: - # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # - name: Run clippy action to produce annotations - # uses: actions-rs/clippy-check@v1 - # if: steps.check_permissions.outputs.has-permission - # with: - # args: --all-targets -- -D warnings - # token: ${{ secrets.GITHUB_TOKEN }} - # - name: Run clippy manually without annotations - # if: ${{ !steps.check_permissions.outputs.has-permission }} - # run: cargo clippy --all-targets -- -D warnings + - name: Run clippy manually without annotations run: cargo clippy --all-targets -- -D warnings \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index 94d5ad8..4b8eee4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,6 +2,15 @@ # It is not intended for manual editing. version = 3 +[[package]] +name = "addr2line" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e4503c46a5c0c7844e948c9a4d6acd9f50cccb4de1c48eb9e291ea17470c678" +dependencies = [ + "gimli", +] + [[package]] name = "adler" version = "1.0.2" @@ -10,14 +19,15 @@ checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" [[package]] name = "ahash" -version = "0.8.3" +version = "0.8.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" +checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" dependencies = [ "cfg-if", "getrandom", "once_cell", "version_check", + "zerocopy", ] [[package]] @@ -35,17 +45,66 @@ dependencies = [ "alloc-no-stdlib", ] +[[package]] +name = "anstream" +version = "0.6.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64e15c1ab1f89faffbf04a634d5e1962e9074f2741eef6d97f3c4e322426d526" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bec1de6f59aedf83baf9ff929c98f2ad654b97c9510f4e70cf6f661d49fd5b1" + +[[package]] +name = "anstyle-parse" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb47de1e80c2b463c735db5b217a0ddc39d612e7ac9e2e96a5aed1f57616c1cb" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d36fc52c7f6c869915e99412912f22093507da8d9e942ceaf66fe4b7c14422a" +dependencies = [ + "windows-sys 0.52.0", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5bf74e1b6e971609db8ca7a9ce79fd5768ab6ae46441c572e46cf596f59e57f8" +dependencies = [ + "anstyle", + "windows-sys 0.52.0", +] + [[package]] name = "arrayvec" -version = "0.7.2" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" +checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" [[package]] name = "async-compression" -version = "0.3.15" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "942c7cd7ae39e91bde4820d74132e9862e62c2f386c3aa90ccf55949f5bad63a" +checksum = "fec134f64e2bc57411226dfc4e52dec859ddfc7e711fc5e07b612584f000e4aa" dependencies = [ "brotli", "flate2", @@ -56,27 +115,31 @@ dependencies = [ ] [[package]] -name = "atty" -version = "0.2.14" +name = "autocfg" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" -dependencies = [ - "hermit-abi 0.1.19", - "libc", - "winapi", -] +checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" [[package]] -name = "autocfg" -version = "1.1.0" +name = "backtrace" +version = "0.3.73" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +checksum = "5cc23269a4f8976d0a4d2e7109211a419fe30e8d88d677cd60b6bc79c5732e0a" +dependencies = [ + "addr2line", + "cc", + "cfg-if", + "libc", + "miniz_oxide", + "object 0.36.3", + "rustc-demangle", +] [[package]] name = "base64" -version = "0.21.0" +version = "0.21.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4a4ddaa51a5bc52a6948f74c06d20aaaddb71924eab79b8c97a8c556e942d6a" +checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" [[package]] name = "binary-merge" @@ -90,13 +153,19 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" +[[package]] +name = "bitflags" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" + [[package]] name = "blondie" version = "0.5.2" dependencies = [ - "clap 4.1.4", + "clap", "inferno", - "object", + "object 0.30.4", "pdb-addr2line", "rustc-hash", "symsrv", @@ -106,9 +175,9 @@ dependencies = [ [[package]] name = "brotli" -version = "3.3.4" +version = "6.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1a0b1dbcc8ae29329621f8d4f0d835787c1c38bb1401979b49d13b0b305ff68" +checksum = "74f7971dbd9326d58187408ab83117d8ac1bb9c17b085fdacd1cf2f598719b6b" dependencies = [ "alloc-no-stdlib", "alloc-stdlib", @@ -117,9 +186,9 @@ dependencies = [ [[package]] name = "brotli-decompressor" -version = "2.3.4" +version = "4.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b6561fd3f895a11e8f72af2cb7d22e08366bebc2b6b57f7744c4bda27034744" +checksum = "9a45bd2e4095a8b518033b128020dd4a55aab1c0a381ba4404a472630f4bc362" dependencies = [ "alloc-no-stdlib", "alloc-stdlib", @@ -127,27 +196,27 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.12.0" +version = "3.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d261e256854913907f67ed06efbc3338dfe6179796deefc1ff763fc1aee5535" +checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" [[package]] name = "bytemuck" -version = "1.13.0" +version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c041d3eab048880cb0b86b256447da3f18859a163c3b8d8893f4e6368abe6393" +checksum = "6fd4c6dcc3b0aea2f5c0b4b82c2b15fe39ddbc76041a310848f4706edf76bb31" [[package]] name = "byteorder" -version = "1.4.3" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.4.0" +version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" +checksum = "8318a53db07bb3f8dca91a600466bdb3f2eaadeedfdbcf02e1accbad9271ba50" [[package]] name = "cab" @@ -163,9 +232,12 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.79" +version = "1.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" +checksum = "72db2f7947ecee9b03b510377e8bb9077afa27176fdbff55c51027e976fdcc48" +dependencies = [ + "shlex", +] [[package]] name = "cfg-if" @@ -175,121 +247,113 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "clap" -version = "3.2.23" +version = "4.5.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71655c45cb9845d3270c9d6df84ebe72b4dad3c2ba3f7023ad47c144e4e473a5" +checksum = "ed6719fffa43d0d87e5fd8caeab59be1554fb028cd30edc88fc4369b17971019" dependencies = [ - "atty", - "bitflags", - "clap_derive 3.2.18", - "clap_lex 0.2.4", - "indexmap", - "once_cell", - "strsim", - "termcolor", - "textwrap", + "clap_builder", + "clap_derive", ] [[package]] -name = "clap" -version = "4.1.4" +name = "clap_builder" +version = "4.5.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f13b9c79b5d1dd500d20ef541215a6423c75829ef43117e1b4d17fd8af0b5d76" +checksum = "216aec2b177652e3846684cbfe25c9964d18ec45234f0f5da5157b207ed1aab6" dependencies = [ - "bitflags", - "clap_derive 4.1.0", - "clap_lex 0.3.1", - "is-terminal", - "once_cell", + "anstream", + "anstyle", + "clap_lex", "strsim", - "termcolor", ] [[package]] name = "clap_derive" -version = "3.2.18" +version = "4.5.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea0c8bce528c4be4da13ea6fead8965e95b6073585a2f05204bd8f4119f82a65" +checksum = "501d359d5f3dcaf6ecdeee48833ae73ec6e42723a1e52419c79abf9507eec0a0" dependencies = [ "heck", - "proc-macro-error", "proc-macro2", "quote", "syn", ] [[package]] -name = "clap_derive" -version = "4.1.0" +name = "clap_lex" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "684a277d672e91966334af371f1a7b5833f9aa00b07c84e92fbce95e00208ce8" -dependencies = [ - "heck", - "proc-macro-error", - "proc-macro2", - "quote", - "syn", -] +checksum = "1462739cb27611015575c0c11df5df7601141071f07518d56fcc1be504cbec97" [[package]] -name = "clap_lex" -version = "0.2.4" +name = "colorchoice" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2850f2f5a82cbf437dd5af4d49848fbdfc27c157c3d010345776f952765261c5" -dependencies = [ - "os_str_bytes", -] +checksum = "d3fd119d74b830634cea2a0f58bbd0d54540518a14397557951e79340abc28c0" [[package]] -name = "clap_lex" -version = "0.3.1" +name = "core-foundation" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "783fe232adfca04f90f56201b26d79682d4cd2625e0bc7290b95123afe558ade" +checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" dependencies = [ - "os_str_bytes", + "core-foundation-sys", + "libc", ] +[[package]] +name = "core-foundation-sys" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" + [[package]] name = "crc32fast" -version = "1.3.2" +version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" +checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3" dependencies = [ "cfg-if", ] [[package]] name = "crossbeam-channel" -version = "0.5.6" +version = "0.5.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2dd04ddaf88237dc3b8d8f9a3c1004b506b54b3313403944054d23c0870c521" +checksum = "33480d6946193aa8033910124896ca395333cae7e2d1113d1fef6c3272217df2" dependencies = [ - "cfg-if", "crossbeam-utils", ] [[package]] name = "crossbeam-utils" -version = "0.8.14" +version = "0.8.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fb766fa798726286dbbb842f174001dab8abc7b627a1dd86e0b7222a95d929f" -dependencies = [ - "cfg-if", -] +checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80" [[package]] name = "dashmap" -version = "5.4.0" +version = "6.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "907076dfda823b0b36d2a1bb5f90c96660a5bbcd7729e10727f07858f22c4edc" +checksum = "804c8821570c3f8b70230c2ba75ffa5c0f9a4189b9a432b6656c536712acae28" dependencies = [ "cfg-if", + "crossbeam-utils", "hashbrown", "lock_api", "once_cell", "parking_lot_core", ] +[[package]] +name = "deranged" +version = "0.3.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" +dependencies = [ + "powerfmt", +] + [[package]] name = "dirs" version = "4.0.0" @@ -312,51 +376,46 @@ dependencies = [ [[package]] name = "elsa" -version = "1.7.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b4b5d23ed6b6948d68240aafa4ac98e568c9a020efd9d4201a6288bc3006e09" +checksum = "d98e71ae4df57d214182a2e5cb90230c0192c6ddfcaa05c36453d46a54713e10" dependencies = [ "stable_deref_trait", ] [[package]] name = "encoding_rs" -version = "0.8.32" +version = "0.8.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "071a31f4ee85403370b58aca746f01041ede6f0da2730960ad001edc2b71b394" +checksum = "b45de904aa0b010bce2ab45264d0631681847fa7b6f2eaa7dab7619943bc4f59" dependencies = [ "cfg-if", ] [[package]] -name = "env_logger" -version = "0.9.3" +name = "env_filter" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a12e6657c4c97ebab115a42dcee77225f7f482cdd841cf7088c657a42e9e00e7" +checksum = "4f2c92ceda6ceec50f43169f9ee8424fe2db276791afde7b2cd8bc084cb376ab" dependencies = [ "log", ] [[package]] -name = "errno" -version = "0.2.8" +name = "env_logger" +version = "0.11.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f639046355ee4f37944e44f60642c6f3a7efa3cf6b78c78a0d989a8ce6c396a1" +checksum = "e13fa619b91fb2381732789fc5de83b45675e882f66623b7d8cb4f643017018d" dependencies = [ - "errno-dragonfly", - "libc", - "winapi", + "env_filter", + "log", ] [[package]] -name = "errno-dragonfly" -version = "0.1.2" +name = "equivalent" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" -dependencies = [ - "cc", - "libc", -] +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "fallible-iterator" @@ -366,9 +425,9 @@ checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7" [[package]] name = "flate2" -version = "1.0.25" +version = "1.0.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8a2db397cb1c8772f31494cb8917e48cd1e64f0fa7efac59fbd741a0a8ce841" +checksum = "7f211bbe8e69bbd0cfdea405084f128ae8b4aaa6b0b522fc8f2b009084797920" dependencies = [ "crc32fast", "miniz_oxide", @@ -382,45 +441,45 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "form_urlencoded" -version = "1.1.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9c384f161156f5260c24a097c56119f9be8c798586aecc13afbcbe7b7e26bf8" +checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" dependencies = [ "percent-encoding", ] [[package]] name = "futures-channel" -version = "0.3.26" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e5317663a9089767a1ec00a487df42e0ca174b61b4483213ac24448e4664df5" +checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" dependencies = [ "futures-core", ] [[package]] name = "futures-core" -version = "0.3.26" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec90ff4d0fe1f57d600049061dc6bb68ed03c7d2fbd697274c41805dcb3f8608" +checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" [[package]] name = "futures-sink" -version = "0.3.26" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f310820bb3e8cfd46c80db4d7fb8353e15dfff853a127158425f31e0be6c8364" +checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" [[package]] name = "futures-task" -version = "0.3.26" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcf79a1bf610b10f42aea489289c5a2c478a786509693b80cd39c44ccd936366" +checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" [[package]] name = "futures-util" -version = "0.3.26" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c1d6de3acfef38d2be4b1f543f553131788603495be83da675e180c8d6b7bd1" +checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" dependencies = [ "futures-core", "futures-task", @@ -430,20 +489,26 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.8" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" dependencies = [ "cfg-if", "libc", "wasi", ] +[[package]] +name = "gimli" +version = "0.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd" + [[package]] name = "h2" -version = "0.3.15" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f9f29bc9dda355256b2916cf526ab02ce0aeaaaf2bad60d65ef3f12f11dd0f4" +checksum = "81fe527a889e1532da5c525686d96d4c2e74cdd345badf8dfef9f6b39dd5f5e8" dependencies = [ "bytes", "fnv", @@ -460,45 +525,33 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.12.3" +version = "0.14.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" [[package]] name = "heck" -version = "0.4.1" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" [[package]] name = "hermit-abi" -version = "0.1.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" -dependencies = [ - "libc", -] - -[[package]] -name = "hermit-abi" -version = "0.2.6" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7" -dependencies = [ - "libc", -] +checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" [[package]] name = "hermit-abi" -version = "0.3.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "856b5cb0902c2b6d65d5fd97dfa30f9b70c7538e770b98eab5ed52d8db923e01" +checksum = "fbf6a919d6cf397374f7dfeeea91d974c7c0a7221d0d0f4f20d859d329e53fcc" [[package]] name = "http" -version = "0.2.8" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75f43d41e26995c17e71ee126451dd3941010b0514a81a9d11f3b341debc2399" +checksum = "601cbb57e577e2f5ef5be8e7b83f0f63994f25aa94d673e54a92d5c516d101f1" dependencies = [ "bytes", "fnv", @@ -507,9 +560,9 @@ dependencies = [ [[package]] name = "http-body" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" +checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" dependencies = [ "bytes", "http", @@ -518,21 +571,21 @@ dependencies = [ [[package]] name = "httparse" -version = "1.8.0" +version = "1.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" +checksum = "0fcc0b4a115bf80b728eb8ea024ad5bd707b615bfed49e0665b6e0f86fd082d9" [[package]] name = "httpdate" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" +checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" [[package]] name = "hyper" -version = "0.14.24" +version = "0.14.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e011372fa0b68db8350aa7a248930ecc7839bf46d8485577d69f117a75f164c" +checksum = "a152ddd61dfaec7273fe8419ab357f33aee0d914c5f4efbf0d96fa749eea5ec9" dependencies = [ "bytes", "futures-channel", @@ -554,10 +607,11 @@ dependencies = [ [[package]] name = "hyper-rustls" -version = "0.23.2" +version = "0.24.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1788965e61b367cd03a62950836d5cd41560c3577d90e40e0819373194d1661c" +checksum = "ec3efd23720e2049821a693cbc7e65ea87c72f1c58ff2f9522ff332b1491e590" dependencies = [ + "futures-util", "http", "hyper", "rustls", @@ -567,9 +621,9 @@ dependencies = [ [[package]] name = "idna" -version = "0.3.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e14ddfc70884202db2244c223200c204c2bda1bc6e0998d11b5e024d657209e6" +checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" dependencies = [ "unicode-bidi", "unicode-normalization", @@ -577,32 +631,31 @@ dependencies = [ [[package]] name = "indexmap" -version = "1.9.2" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1885e79c1fc4b10f0e172c475f458b7f7b93061064d98c3293e98c5ba0c8b399" +checksum = "93ead53efc7ea8ed3cfb0c79fc8023fbb782a5432b52830b6518941cebe6505c" dependencies = [ - "autocfg", + "equivalent", "hashbrown", ] [[package]] name = "inferno" -version = "0.11.14" +version = "0.11.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6e66fa9bb3c52f40d05c11b78919ff2f18993c2305bd8a62556d20cb3e9606f" +checksum = "232929e1d75fe899576a3d5c7416ad0d88dbfbb3c3d6aa00873a7408a50ddb88" dependencies = [ "ahash", - "atty", - "clap 3.2.23", + "clap", "crossbeam-channel", "crossbeam-utils", "dashmap", "env_logger", "indexmap", + "is-terminal", "itoa", "log", "num-format", - "num_cpus", "once_cell", "quick-xml", "rgb", @@ -618,66 +671,65 @@ dependencies = [ "smallvec", ] -[[package]] -name = "io-lifetimes" -version = "1.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1abeb7a0dd0f8181267ff8adc397075586500b81b28a73e8a0208b00fc170fb3" -dependencies = [ - "libc", - "windows-sys 0.45.0", -] - [[package]] name = "ipnet" -version = "2.7.1" +version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30e22bd8629359895450b59ea7a776c850561b96a3b1d31321c1949d9e6c9146" +checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" [[package]] name = "is-terminal" -version = "0.4.3" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22e18b0a45d56fe973d6db23972bf5bc46f988a4a2385deac9cc29572f09daef" +checksum = "261f68e344040fbd0edea105bef17c66edf46f984ddb1115b775ce31be948f4b" dependencies = [ - "hermit-abi 0.3.0", - "io-lifetimes", - "rustix", - "windows-sys 0.45.0", + "hermit-abi 0.4.0", + "libc", + "windows-sys 0.52.0", ] +[[package]] +name = "is_terminal_polyfill" +version = "1.70.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" + [[package]] name = "itoa" -version = "1.0.5" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fad582f4b9e86b6caa621cabeb0963332d92eea04729ab12892c2533951e6440" +checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" [[package]] name = "js-sys" -version = "0.3.61" +version = "0.3.70" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "445dde2150c55e483f3d8416706b97ec8e8237c307e5b7b4b8dd15e6af2a0730" +checksum = "1868808506b929d7b0cfa8f75951347aa71bb21144b7791bae35d9bccfcfe37a" dependencies = [ "wasm-bindgen", ] [[package]] name = "libc" -version = "0.2.139" +version = "0.2.158" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79" +checksum = "d8adc4bb1803a324070e64a98ae98f38934d91957a99cfb3a43dcbc01bc56439" [[package]] -name = "linux-raw-sys" -version = "0.1.4" +name = "libredox" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f051f77a7c8e6957c0696eac88f26b0117e54f52d3fc682ab19397a8812846a4" +checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" +dependencies = [ + "bitflags 2.6.0", + "libc", +] [[package]] name = "lock_api" -version = "0.4.9" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "435011366fe56583b16cf956f9df0095b405b82d76425bc8981c0e22e60ec4df" +checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" dependencies = [ "autocfg", "scopeguard", @@ -685,12 +737,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.17" +version = "0.4.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" -dependencies = [ - "cfg-if", -] +checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" [[package]] name = "lzxd" @@ -706,46 +755,52 @@ checksum = "4facc753ae494aeb6e3c22f839b158aebd4f9270f55cd3c79906c45476c47ab4" [[package]] name = "memchr" -version = "2.5.0" +version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" [[package]] name = "memmap2" -version = "0.5.8" +version = "0.5.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b182332558b18d807c4ce1ca8ca983b34c3ee32765e47b3f0f69b90355cc1dc" +checksum = "83faa42c0a078c393f6b29d5db232d8be22776a891f8f56e5284faee4a20b327" dependencies = [ "libc", ] [[package]] name = "mime" -version = "0.3.16" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d" +checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" [[package]] name = "miniz_oxide" -version = "0.6.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b275950c28b37e794e8c55d88aeb5e139d0ce23fdbbeda68f8d7174abdf9e8fa" +checksum = "b8a240ddb74feaf34a79a7add65a741f3167852fba007066dcac1ca548d89c08" dependencies = [ "adler", ] [[package]] name = "mio" -version = "0.8.5" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5d732bc30207a6423068df043e3d02e0735b155ad7ce1a6f76fe2baa5b158de" +checksum = "80e04d1dcff3aae0704555fe5fee3bcfaf3d1fdf8a7e521d5b9d2b42acb52cec" dependencies = [ + "hermit-abi 0.3.9", "libc", - "log", "wasi", - "windows-sys 0.42.0", + "windows-sys 0.52.0", ] +[[package]] +name = "num-conv" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" + [[package]] name = "num-format" version = "0.4.4" @@ -757,48 +812,41 @@ dependencies = [ ] [[package]] -name = "num_cpus" -version = "1.15.0" +name = "object" +version = "0.30.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b" +checksum = "03b4680b86d9cfafba8fc491dc9b6df26b68cf40e9e6cd73909194759a63c385" dependencies = [ - "hermit-abi 0.2.6", - "libc", + "flate2", + "memchr", ] [[package]] name = "object" -version = "0.30.3" +version = "0.36.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea86265d3d3dcb6a27fc51bd29a4bf387fae9d2986b823079d4986af253eb439" +checksum = "27b64972346851a39438c60b341ebc01bba47464ae329e55cf343eb93964efd9" dependencies = [ - "flate2", "memchr", ] [[package]] name = "once_cell" -version = "1.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f61fba1741ea2b3d6a1e3178721804bb716a68a6aeba1149b5d52e3d464ea66" - -[[package]] -name = "os_str_bytes" -version = "6.4.1" +version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b7820b9daea5457c9f21c69448905d723fbd21136ccf521748f23fd49e723ee" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" [[package]] name = "parking_lot_core" -version = "0.9.7" +version = "0.9.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9069cbb9f99e3a5083476ccb29ceb1de18b9118cafa53e90c9551235de2b9521" +checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" dependencies = [ "cfg-if", "libc", "redox_syscall", "smallvec", - "windows-sys 0.45.0", + "windows-targets 0.52.6", ] [[package]] @@ -818,7 +866,7 @@ version = "0.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c4e89a9f2f40b2389ba6da0814c8044bf942bece03dffa1514f84e3b525f4f9a" dependencies = [ - "bitflags", + "bitflags 1.3.2", "elsa", "maybe-owned", "pdb", @@ -828,15 +876,15 @@ dependencies = [ [[package]] name = "percent-encoding" -version = "2.2.0" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e" +checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] name = "pin-project-lite" -version = "0.2.9" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116" +checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" [[package]] name = "pin-utils" @@ -845,34 +893,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] -name = "proc-macro-error" -version = "1.0.4" +name = "powerfmt" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" -dependencies = [ - "proc-macro-error-attr", - "proc-macro2", - "quote", - "syn", - "version_check", -] - -[[package]] -name = "proc-macro-error-attr" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" -dependencies = [ - "proc-macro2", - "quote", - "version_check", -] +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" [[package]] name = "proc-macro2" -version = "1.0.51" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d727cae5b39d21da60fa540906919ad737832fe0b1c165da3a34d6548c849d6" +checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" dependencies = [ "unicode-ident", ] @@ -888,9 +918,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.23" +version = "1.0.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8856d8364d252a14d474036ea1358d63c9e6965c8e5c1885c18f73d70bff9c7b" +checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" dependencies = [ "proc-macro2", ] @@ -908,29 +938,29 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.2.16" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" +checksum = "2a908a6e00f1fdd0dfd9c0eb08ce85126f6d8bbda50017e74bc4a4b7d4a926a4" dependencies = [ - "bitflags", + "bitflags 2.6.0", ] [[package]] name = "redox_users" -version = "0.4.3" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" +checksum = "ba009ff324d1fc1b900bd1fdb31564febe58a8ccc8a6fdbb93b543d33b13ca43" dependencies = [ "getrandom", - "redox_syscall", + "libredox", "thiserror", ] [[package]] name = "reqwest" -version = "0.11.14" +version = "0.11.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21eed90ec8570952d53b772ecf8f206aa1ec9a3d76b2521c56c42973f2d91ee9" +checksum = "dd67538700a17451e7cba03ac727fb961abb7607553461627b97de0b89cf4a62" dependencies = [ "async-compression", "base64", @@ -955,6 +985,8 @@ dependencies = [ "serde", "serde_json", "serde_urlencoded", + "sync_wrapper", + "system-configuration", "tokio", "tokio-rustls", "tokio-util", @@ -969,80 +1001,82 @@ dependencies = [ [[package]] name = "rgb" -version = "0.8.34" +version = "0.8.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3603b7d71ca82644f79b5a06d1220e9a58ede60bd32255f698cb1af8838b8db3" +checksum = "0f86ae463694029097b846d8f99fd5536740602ae00022c0c50c5600720b2f71" dependencies = [ "bytemuck", ] [[package]] name = "ring" -version = "0.16.20" +version = "0.17.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc" +checksum = "c17fa4cb658e3583423e915b9f3acc01cceaee1860e33d59ebae66adc3a2dc0d" dependencies = [ "cc", + "cfg-if", + "getrandom", "libc", - "once_cell", "spin", "untrusted", - "web-sys", - "winapi", + "windows-sys 0.52.0", ] [[package]] -name = "rustc-hash" -version = "1.1.0" +name = "rustc-demangle" +version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" +checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" [[package]] -name = "rustix" -version = "0.36.8" +name = "rustc-hash" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f43abb88211988493c1abb44a70efa56ff0ce98f233b7b276146f1f3f7ba9644" -dependencies = [ - "bitflags", - "errno", - "io-lifetimes", - "libc", - "linux-raw-sys", - "windows-sys 0.45.0", -] +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" [[package]] name = "rustls" -version = "0.20.8" +version = "0.21.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fff78fc74d175294f4e83b28343315ffcfb114b156f0185e9741cb5570f50e2f" +checksum = "3f56a14d1f48b391359b22f731fd4bd7e43c97f3c50eee276f3aa09c94784d3e" dependencies = [ "log", "ring", + "rustls-webpki", "sct", - "webpki", ] [[package]] name = "rustls-pemfile" -version = "1.0.2" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d194b56d58803a43635bdc398cd17e383d6f71f9182b9a192c127ca42494a59b" +checksum = "1c74cae0a4cf6ccbbf5f359f08efdf8ee7e1dc532573bf0db71968cb56b1448c" dependencies = [ "base64", ] +[[package]] +name = "rustls-webpki" +version = "0.101.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b6275d1ee7a1cd780b64aca7726599a1dbc893b1e64144529e55c3c2f745765" +dependencies = [ + "ring", + "untrusted", +] + [[package]] name = "ryu" -version = "1.0.12" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b4b9743ed687d4b4bcedf9ff5eaa7398495ae14e61cba0a295704edbc7decde" +checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" [[package]] name = "scopeguard" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "scroll" @@ -1052,9 +1086,9 @@ checksum = "04c565b551bafbef4157586fa379538366e4385d42082f255bfd96e4fe8519da" [[package]] name = "sct" -version = "0.7.0" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d53dcdb7c9f8158937a7981b48accfd39a43af418591a5d008c7b22b5e1b7ca4" +checksum = "da046153aa2352493d6cb7da4b6e5c0c057d8a1d0a9aa8560baffdd945acd414" dependencies = [ "ring", "untrusted", @@ -1062,17 +1096,32 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.152" +version = "1.0.208" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb7d1f0d3021d347a83e556fc4683dea2ea09d87bccdf88ff5c12545d89d5efb" +checksum = "cff085d2cb684faa248efb494c39b68e522822ac0de72ccf08109abde717cfb2" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.208" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24008e81ff7613ed8e5ba0cfaf24e2c2f1e5b8a0495711e44fcd4882fca62bcf" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] [[package]] name = "serde_json" -version = "1.0.92" +version = "1.0.125" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7434af0dc1cbd59268aa98b4c22c131c0584d2232f6fb166efb993e2832e896a" +checksum = "83c8e735a073ccf5be70aa8066aa984eaf2fa000db6c8d0100ae605b366d31ed" dependencies = [ "itoa", + "memchr", "ryu", "serde", ] @@ -1089,36 +1138,42 @@ dependencies = [ "serde", ] +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + [[package]] name = "slab" -version = "0.4.7" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4614a76b2a8be0058caa9dbbaf66d988527d86d003c11a94fbd335d7661edcef" +checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" dependencies = [ "autocfg", ] [[package]] name = "smallvec" -version = "1.10.0" +version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" +checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "socket2" -version = "0.4.7" +version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02e2d2db9033d13a1567121ddd7a095ee144db4e1ca1b1bda3419bc0da294ebd" +checksum = "ce305eb0b4296696835b71df73eb912e0f1ffd2556a501fcede6e0c50349191c" dependencies = [ "libc", - "winapi", + "windows-sys 0.52.0", ] [[package]] name = "spin" -version = "0.5.2" +version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" +checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" [[package]] name = "stable_deref_trait" @@ -1134,9 +1189,9 @@ checksum = "9091b6114800a5f2141aee1d1b9d6ca3592ac062dc5decb3764ec5895a47b4eb" [[package]] name = "strsim" -version = "0.10.0" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] name = "symsrv" @@ -1155,9 +1210,9 @@ dependencies = [ [[package]] name = "syn" -version = "1.0.107" +version = "2.0.75" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f4064b5b16e03ae50984a5a8ed5d4f8803e6bc1fd170a3cda91a1be4b18e3f5" +checksum = "f6af063034fc1935ede7be0122941bafa9bacb949334d090b77ca98b5817c7d9" dependencies = [ "proc-macro2", "quote", @@ -1165,34 +1220,46 @@ dependencies = [ ] [[package]] -name = "termcolor" -version = "1.2.0" +name = "sync_wrapper" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6" +checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" + +[[package]] +name = "system-configuration" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7" dependencies = [ - "winapi-util", + "bitflags 1.3.2", + "core-foundation", + "system-configuration-sys", ] [[package]] -name = "textwrap" -version = "0.16.0" +name = "system-configuration-sys" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "222a222a5bfe1bba4a77b45ec488a741b3cb8872e5e499451fd7d0129c9c7c3d" +checksum = "a75fb188eb626b924683e3b95e3a48e63551fcfb51949de2f06a9d91dbee93c9" +dependencies = [ + "core-foundation-sys", + "libc", +] [[package]] name = "thiserror" -version = "1.0.38" +version = "1.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a9cd18aa97d5c45c6603caea1da6628790b37f7a34b6ca89522331c5180fed0" +checksum = "c0342370b38b6a11b6cc11d6a805569958d54cfa061a29969c3b5ce2ea405724" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.38" +version = "1.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fb327af4685e4d03fa8cbcf1716380da910eeb2bb8be417e7f9fd3fb164f36f" +checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261" dependencies = [ "proc-macro2", "quote", @@ -1201,25 +1268,28 @@ dependencies = [ [[package]] name = "time" -version = "0.3.17" +version = "0.3.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a561bf4617eebd33bca6434b988f39ed798e527f51a1e797d0ee4f61c0a38376" +checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" dependencies = [ + "deranged", + "num-conv", + "powerfmt", "serde", "time-core", ] [[package]] name = "time-core" -version = "0.1.0" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e153e1f1acaef8acc537e68b44906d2db6436e2b35ac2c6b42640fff91f00fd" +checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" [[package]] name = "tinyvec" -version = "1.6.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" +checksum = "445e881f4f6d382d5f27c034e25eb92edd7c784ceab92a0937db7f2e9471b938" dependencies = [ "tinyvec_macros", ] @@ -1232,134 +1302,135 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.25.0" +version = "1.39.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8e00990ebabbe4c14c08aca901caed183ecd5c09562a12c824bb53d3c3fd3af" +checksum = "9babc99b9923bfa4804bd74722ff02c0381021eafa4db9949217e3be8e84fff5" dependencies = [ - "autocfg", + "backtrace", "bytes", "libc", - "memchr", "mio", "pin-project-lite", "socket2", - "windows-sys 0.42.0", + "windows-sys 0.52.0", ] [[package]] name = "tokio-rustls" -version = "0.23.4" +version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c43ee83903113e03984cb9e5cebe6c04a5116269e900e3ddba8f068a62adda59" +checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081" dependencies = [ "rustls", "tokio", - "webpki", ] [[package]] name = "tokio-util" -version = "0.7.4" +version = "0.7.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bb2e075f03b3d66d8d8785356224ba688d2906a371015e225beeb65ca92c740" +checksum = "9cf6b47b3771c49ac75ad09a6162f53ad4b8088b76ac60e8ec1455b31a189fe1" dependencies = [ "bytes", "futures-core", "futures-sink", "pin-project-lite", "tokio", - "tracing", ] [[package]] name = "tower-service" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" +checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" [[package]] name = "tracing" -version = "0.1.37" +version = "0.1.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" +checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" dependencies = [ - "cfg-if", "pin-project-lite", "tracing-core", ] [[package]] name = "tracing-core" -version = "0.1.30" +version = "0.1.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24eb03ba0eab1fd845050058ce5e616558e8f8d8fca633e6b163fe25c797213a" +checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" dependencies = [ "once_cell", ] [[package]] name = "try-lock" -version = "0.2.4" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" [[package]] name = "unicode-bidi" -version = "0.3.10" +version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d54675592c1dbefd78cbd98db9bacd89886e1ca50692a0692baefffdeb92dd58" +checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" [[package]] name = "unicode-ident" -version = "1.0.6" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" [[package]] name = "unicode-normalization" -version = "0.1.22" +version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" +checksum = "a56d1686db2308d901306f92a263857ef59ea39678a5458e7cb17f01415101f5" dependencies = [ "tinyvec", ] [[package]] name = "untrusted" -version = "0.7.1" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" [[package]] name = "url" -version = "2.3.1" +version = "2.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d68c799ae75762b8c3fe375feb6600ef5602c883c5d21eb51c09f22b83c4643" +checksum = "22784dbdf76fdde8af1aeda5622b546b422b6fc585325248a2bf9f5e41e94d6c" dependencies = [ "form_urlencoded", "idna", "percent-encoding", ] +[[package]] +name = "utf8parse" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" + [[package]] name = "uuid" -version = "1.3.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1674845326ee10d37ca60470760d4288a6f80f304007d92e5c53bab78c9cfd79" +checksum = "81dfa00651efa65069b0b6b651f4aaa31ba9e3c3ce0137aaad053604ee7e0314" [[package]] name = "version_check" -version = "0.9.4" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" [[package]] name = "want" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" +checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" dependencies = [ - "log", "try-lock", ] @@ -1371,19 +1442,20 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.84" +version = "0.2.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31f8dcbc21f30d9b8f2ea926ecb58f6b91192c17e9d33594b3df58b2007ca53b" +checksum = "a82edfc16a6c469f5f44dc7b571814045d60404b55a0ee849f9bcfa2e63dd9b5" dependencies = [ "cfg-if", + "once_cell", "wasm-bindgen-macro", ] [[package]] name = "wasm-bindgen-backend" -version = "0.2.84" +version = "0.2.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95ce90fd5bcc06af55a641a86428ee4229e44e07033963a2290a8e241607ccb9" +checksum = "9de396da306523044d3302746f1208fa71d7532227f15e347e2d93e4145dd77b" dependencies = [ "bumpalo", "log", @@ -1396,9 +1468,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.34" +version = "0.4.43" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f219e0d211ba40266969f6dbdd90636da12f75bee4fc9d6c23d1260dadb51454" +checksum = "61e9300f63a621e96ed275155c108eb6f843b6a26d053f122ab69724559dc8ed" dependencies = [ "cfg-if", "js-sys", @@ -1408,9 +1480,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.84" +version = "0.2.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c21f77c0bedc37fd5dc21f897894a5ca01e7bb159884559461862ae90c0b4c5" +checksum = "585c4c91a46b072c92e908d99cb1dcdf95c5218eeb6f3bf1efa991ee7a68cccf" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -1418,9 +1490,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.84" +version = "0.2.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2aff81306fcac3c7515ad4e177f521b5c9a15f2b08f4e32d823066102f35a5f6" +checksum = "afc340c74d9005395cf9dd098506f7f44e38f2b4a21c6aaacf9a105ea5e1e836" dependencies = [ "proc-macro2", "quote", @@ -1431,38 +1503,25 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.84" +version = "0.2.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0046fef7e28c3804e5e38bfa31ea2a0f73905319b677e57ebe37e49358989b5d" +checksum = "c62a0a307cb4a311d3a07867860911ca130c3494e8c2719593806c08bc5d0484" [[package]] name = "web-sys" -version = "0.3.61" +version = "0.3.70" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e33b99f4b23ba3eec1a53ac264e35a755f00e966e0065077d6027c0f575b0b97" +checksum = "26fdeaafd9bd129f65e7c031593c24d62186301e0c72c8978fa1678be7d532c0" dependencies = [ "js-sys", "wasm-bindgen", ] -[[package]] -name = "webpki" -version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f095d78192e208183081cc07bc5515ef55216397af48b873e5edcd72637fa1bd" -dependencies = [ - "ring", - "untrusted", -] - [[package]] name = "webpki-roots" -version = "0.22.6" +version = "0.25.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6c71e40d7d2c34a5106301fb632274ca37242cd0c9d3e64dbece371a40a2d87" -dependencies = [ - "webpki", -] +checksum = "5f20c57d8d7db6d3b86154206ae5d8fba62dd39573114de97c2cb0578251f8e1" [[package]] name = "winapi" @@ -1480,15 +1539,6 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" -[[package]] -name = "winapi-util" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" -dependencies = [ - "winapi", -] - [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" @@ -1501,95 +1551,231 @@ version = "0.44.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e745dab35a0c4c77aa3ce42d595e13d2003d6902d6b08c9ef5fc326d08da12b" dependencies = [ - "windows-targets", + "windows-targets 0.42.2", ] [[package]] name = "windows-sys" -version = "0.42.0" +version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", + "windows-targets 0.48.5", ] [[package]] name = "windows-sys" -version = "0.45.0" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-targets" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" +checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" dependencies = [ - "windows-targets", + "windows_aarch64_gnullvm 0.42.2", + "windows_aarch64_msvc 0.42.2", + "windows_i686_gnu 0.42.2", + "windows_i686_msvc 0.42.2", + "windows_x86_64_gnu 0.42.2", + "windows_x86_64_gnullvm 0.42.2", + "windows_x86_64_msvc 0.42.2", ] [[package]] name = "windows-targets" -version = "0.42.1" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e2522491fbfcd58cc84d47aeb2958948c4b8982e9a2d8a2a35bbaed431390e7" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", ] +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", + "windows_i686_gnullvm", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" + [[package]] name = "windows_aarch64_gnullvm" -version = "0.42.1" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c9864e83243fdec7fc9c5444389dcbbfd258f745e7853198f365e3c4968a608" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" [[package]] name = "windows_aarch64_msvc" -version = "0.42.1" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c8b1b673ffc16c47a9ff48570a9d85e25d265735c503681332589af6253c6c7" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" [[package]] name = "windows_i686_gnu" -version = "0.42.1" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" + +[[package]] +name = "windows_i686_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" + +[[package]] +name = "windows_i686_msvc" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de3887528ad530ba7bdbb1faa8275ec7a1155a45ffa57c37993960277145d640" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" [[package]] name = "windows_i686_msvc" -version = "0.42.1" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf4d1122317eddd6ff351aa852118a2418ad4214e6613a50e0191f7004372605" +checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" [[package]] name = "windows_x86_64_gnu" -version = "0.42.1" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1040f221285e17ebccbc2591ffdc2d44ee1f9186324dd3e84e99ac68d699c45" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" [[package]] name = "windows_x86_64_gnullvm" -version = "0.42.1" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "628bfdf232daa22b0d64fdb62b09fcc36bb01f05a3939e20ab73aaf9470d0463" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" [[package]] name = "windows_x86_64_msvc" -version = "0.42.1" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd" +checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "winreg" -version = "0.10.1" +version = "0.50.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80d0f4e272c85def139476380b12f9ac60926689dd2e01d4923222f40580869d" +checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1" dependencies = [ - "winapi", + "cfg-if", + "windows-sys 0.48.0", +] + +[[package]] +name = "zerocopy" +version = "0.7.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.7.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" +dependencies = [ + "proc-macro2", + "quote", + "syn", ] diff --git a/Cargo.toml b/Cargo.toml index b0f3f2b..14b91bc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -50,9 +50,7 @@ debug = true [[bin]] name = "blondie" -path = "src/blondie_bin.rs" required-features = ["inferno", "clap"] [[bin]] name = "blondie_dtrace" -path = "src/blondie_dtrace.rs" diff --git a/rustfmt.toml b/rustfmt.toml new file mode 100644 index 0000000..3e47d99 --- /dev/null +++ b/rustfmt.toml @@ -0,0 +1,10 @@ +format_code_in_doc_comments = true +format_macro_matchers = true +group_imports = "StdExternalCrate" +hex_literal_case = "Lower" +imports_granularity = "Module" +newline_style = "Unix" +normalize_comments = true +normalize_doc_attributes = true +use_field_init_shorthand = true +use_try_shorthand = true diff --git a/src/blondie_bin.rs b/src/bin/blondie.rs similarity index 100% rename from src/blondie_bin.rs rename to src/bin/blondie.rs diff --git a/src/blondie_dtrace.rs b/src/bin/blondie_dtrace.rs similarity index 100% rename from src/blondie_dtrace.rs rename to src/bin/blondie_dtrace.rs diff --git a/src/lib.rs b/src/lib.rs index 66f22a1..1779b6e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -5,9 +5,20 @@ //! Or you can use [`trace_child`] to start tracing an [`std::process::Child`]. //! You can also trace an arbitrary process using [`trace_pid`]. +#![warn(missing_docs)] #![allow(clippy::field_reassign_with_default)] +use std::ffi::OsString; +use std::io::{Read, Write}; +use std::mem::size_of; +use std::os::windows::ffi::OsStringExt; +use std::path::PathBuf; +use std::ptr::{addr_of, addr_of_mut}; +use std::sync::atomic::{AtomicBool, Ordering}; + use object::Object; +use pdb_addr2line::pdb::PDB; +use pdb_addr2line::ContextPdbData; use windows::core::{GUID, PCSTR, PSTR}; use windows::Win32::Foundation::{ CloseHandle, GetLastError, ERROR_SUCCESS, ERROR_WMI_INSTANCE_NOT_FOUND, HANDLE, @@ -36,18 +47,15 @@ use windows::Win32::System::Threading::{ WaitForSingleObject, CREATE_SUSPENDED, PROCESS_ALL_ACCESS, THREAD_PRIORITY_TIME_CRITICAL, }; -use pdb_addr2line::{pdb::PDB, ContextPdbData}; - -use std::ffi::OsString; -use std::io::{Read, Write}; -use std::mem::size_of; -use std::os::windows::ffi::OsStringExt; -use std::path::PathBuf; -use std::ptr::{addr_of, addr_of_mut}; -use std::sync::atomic::{AtomicBool, Ordering}; +/// Maximum stack depth/height of traces. +// msdn says 192 but I got some that were bigger +// const MAX_STACK_DEPTH: usize = 192; +const MAX_STACK_DEPTH: usize = 200; /// map[array_of_stacktrace_addrs] = sample_count type StackMap = rustc_hash::FxHashMap<[u64; MAX_STACK_DEPTH], u64>; + +/// Stateful context provided to `event_record_callback`. struct TraceContext { target_process_handle: HANDLE, stack_counts_hashmap: StackMap, @@ -60,9 +68,11 @@ struct TraceContext { } impl TraceContext { /// The Context takes ownership of the handle. - /// SAFETY: - /// - target_process_handle must be a valid process handle. - /// - target_proc_id must be the id of the process. + /// + /// # Safety + /// + /// - `target_process_handle` must be a valid process handle. + /// - `target_proc_id` must be the id of the same process as the handle. unsafe fn new( target_process_handle: HANDLE, target_proc_pid: u32, @@ -94,10 +104,8 @@ impl Drop for TraceContext { } } } -// msdn says 192 but I got some that were bigger -//const MAX_STACK_DEPTH: usize = 192; -const MAX_STACK_DEPTH: usize = 200; +/// The errors that may occur in blondie. #[derive(Debug)] pub enum Error { /// Blondie requires administrator privileges @@ -117,12 +125,8 @@ pub enum Error { /// This should never happen UnknownError, } -type Result = std::result::Result; -impl From for Error { - fn from(err: std::io::Error) -> Self { - Error::Write(err) - } -} +/// A [`std::result::Result`] alias where the `Err` case is [`blondie::Error`](Error). +pub type Result = std::result::Result; fn get_last_error(extra: &'static str) -> Error { const BUF_LEN: usize = 1024; @@ -140,11 +144,10 @@ fn get_last_error(extra: &'static str) -> Error { ) }; assert!(chars_written != 0); - let code_str = unsafe { - std::ffi::CStr::from_ptr(buf.as_ptr().cast()) - .to_str() - .unwrap_or("Invalid utf8 in error") - }; + let code_str = std::ffi::CStr::from_bytes_until_nul(&buf) + .unwrap() + .to_str() + .unwrap_or("Invalid utf8 in error"); Error::Other(code, code_str.to_string(), extra) } @@ -157,7 +160,7 @@ unsafe fn handle_from_process_id(process_id: u32) -> Result { } unsafe fn wait_for_process_by_handle(handle: HANDLE) -> Result<()> { - let ret = WaitForSingleObject(handle, 0xFFFFFFFF); + let ret = WaitForSingleObject(handle, 0xffffffff); match ret.0 { 0 => Ok(()), 0x00000080 => Err(Error::WaitOnChildErrAbandoned), @@ -197,7 +200,12 @@ fn acquire_privileges() -> Result<()> { } Ok(()) } -/// SAFETY: is_suspended must only be true if `target_process` is suspended + +/// The main tracing logic. Traces the process with the given `target_process_id`. +/// +/// # Safety +/// +/// `is_suspended` may only be true if `target_process` is suspended unsafe fn trace_from_process_id( target_process_id: u32, is_suspended: bool, @@ -207,7 +215,7 @@ unsafe fn trace_from_process_id( winver_info.dwOSVersionInfoSize = size_of::() as u32; let ret = GetVersionExA(&mut winver_info); if ret.0 == 0 { - return Err(get_last_error("TraceSetInformation interval")); + return Err(get_last_error("GetVersionExA")); } // If we're not win7 or more, return unsupported // https://docs.microsoft.com/en-us/windows/win32/sysinfo/operating-system-version @@ -347,7 +355,7 @@ unsafe fn trace_from_process_id( let target_proc_handle = handle_from_process_id(target_process_id)?; let mut context = TraceContext::new(target_proc_handle, target_process_id, kernel_stacks)?; - //TODO: Do we need to Box the context? + // TODO: Do we need to Box the context? let mut log = EVENT_TRACE_LOGFILEA::default(); log.LoggerName = PSTR(kernel_logger_name_with_nul.as_mut_ptr()); @@ -487,17 +495,16 @@ unsafe fn trace_from_process_id( return Err(get_last_error("OpenTraceA processing")); } - let (sender, recvr) = std::sync::mpsc::channel(); - std::thread::spawn(move || { - // This blocks + let processing_thread = std::thread::spawn(move || { SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_TIME_CRITICAL); + // This blocks ProcessTrace(&[trace_processing_handle], None, None); let ret = CloseTrace(trace_processing_handle); if ret != ERROR_SUCCESS { - panic!("Error closing trace"); + return Err(get_last_error("Error closing trace")); } - sender.send(()).unwrap(); + Ok(()) }); // Wait until we know for sure the trace is running @@ -537,11 +544,12 @@ unsafe fn trace_from_process_id( if ret != ERROR_SUCCESS { return Err(get_last_error("ControlTraceA STOP ProcessTrace")); } + // Block until processing thread is done // (Safeguard to make sure we don't deallocate the context before the other thread finishes using it) - if recvr.recv().is_err() { - return Err(Error::UnknownError); - } + processing_thread + .join() + .map_err(|_err_any| Error::UnknownError)??; if context.show_kernel_samples { let kernel_module_paths = list_kernel_modules(); @@ -724,7 +732,7 @@ impl<'a> CallStack<'a> { /// /// This also performs symbol resolution if possible, and tries to find the image (DLL/EXE) it comes from fn iter_resolved_addresses< - F: for<'b> FnMut(u64, u64, &'b [&'b str], Option<&'b str>) -> Result<()>, + F: for<'b> FnMut(u64, u64, &'b [&'b str], Option<&'b str>) -> std::io::Result<()>, >( &'a self, pdb_db: &'a PdbDb, @@ -750,7 +758,7 @@ impl<'a> CallStack<'a> { let module = pdb_db.range(..addr).next_back(); let module = match module { None => { - f(addr, 0, &[], None)?; + (f)(addr, 0, &[], None).map_err(Error::Write)?; symbol_names_storage = reuse_vec(symbol_names); continue; } @@ -762,7 +770,7 @@ impl<'a> CallStack<'a> { let procedure_frames = match module.3.find_frames(addr_in_module as u32) { Ok(Some(x)) => x, _ => { - f(addr, 0, &[], image_name)?; + (f)(addr, 0, &[], image_name).map_err(Error::Write)?; symbol_names_storage = reuse_vec(symbol_names); continue; } @@ -770,7 +778,7 @@ impl<'a> CallStack<'a> { for frame in &procedure_frames.frames { symbol_names.push(frame.function.as_deref().unwrap_or("Unknown")); } - f(addr, displacement, &symbol_names, image_name)?; + (f)(addr, displacement, &symbol_names, image_name).map_err(Error::Write)?; symbol_names_storage = reuse_vec(symbol_names); } *v = symbol_names_storage; @@ -837,7 +845,7 @@ impl CollectionResults { if !empty_callstack { let count = callstack.sample_count; - write!(w, "\t\t{count}\n\n")?; + write!(w, "\t\t{count}\n\n").map_err(Error::Write)?; } } Ok(()) @@ -888,7 +896,7 @@ fn list_kernel_modules() -> Vec<(OsString, u64, u64)> { ) }; if retcode < 0 { - //println!("Failed to load kernel modules"); + // println!("Failed to load kernel modules"); return vec![]; } let number_of_modules = unsafe { out_buf.as_ptr().cast::().read_unaligned() as usize }; @@ -920,7 +928,8 @@ fn list_kernel_modules() -> Vec<(OsString, u64, u64)> { let kernel_module_paths = modules .iter() .filter_map(|module| { - unsafe { std::ffi::CStr::from_ptr(module.FullPathName.as_ptr().cast()) } + std::ffi::CStr::from_bytes_until_nul(&module.FullPathName) + .unwrap() .to_str() .ok() .map(|mod_str_filepath| { diff --git a/tests/basic.rs b/tests/basic.rs new file mode 100644 index 0000000..eec8f58 --- /dev/null +++ b/tests/basic.rs @@ -0,0 +1,9 @@ +use std::process::Command; + +#[test] +fn test_basic() { + let mut cmd = Command::new("ping"); + cmd.arg("localhost"); + let result = blondie::trace_command(cmd, false).unwrap(); + assert!(0 < result.iter_callstacks().count()); +} From 4e1223e308336f1dd04d131c2f9db9f6d9d93282 Mon Sep 17 00:00:00 2001 From: Mingwei Samuel Date: Tue, 20 Aug 2024 14:14:17 -0700 Subject: [PATCH 2/2] Rearrange some code into modules --- src/error.rs | 51 +++++++++++++ src/lib.rs | 209 ++++----------------------------------------------- src/util.rs | 147 ++++++++++++++++++++++++++++++++++++ 3 files changed, 212 insertions(+), 195 deletions(-) create mode 100644 src/error.rs create mode 100644 src/util.rs diff --git a/src/error.rs b/src/error.rs new file mode 100644 index 0000000..5b5e090 --- /dev/null +++ b/src/error.rs @@ -0,0 +1,51 @@ +use windows::core::PSTR; +use windows::Win32::Foundation::{GetLastError, WIN32_ERROR}; +use windows::Win32::System::Diagnostics::Debug::{ + FormatMessageA, FORMAT_MESSAGE_FROM_SYSTEM, FORMAT_MESSAGE_IGNORE_INSERTS, +}; + +/// The errors that may occur in blondie. +#[derive(Debug)] +pub enum Error { + /// Blondie requires administrator privileges + NotAnAdmin, + /// Error writing to the provided Writer + Write(std::io::Error), + /// Error spawning a suspended process + SpawnErr(std::io::Error), + /// Error waiting for child, abandoned + WaitOnChildErrAbandoned, + /// Error waiting for child, timed out + WaitOnChildErrTimeout, + /// A call to a windows API function returned an error and we didn't know how to handle it + Other(WIN32_ERROR, String, &'static str), + /// We require Windows 7 or greater + UnsupportedOsVersion, + /// This should never happen + UnknownError, +} +/// A [`std::result::Result`] alias where the `Err` case is [`blondie::Error`](Error). +pub type Result = std::result::Result; + +pub(crate) fn get_last_error(extra: &'static str) -> Error { + const BUF_LEN: usize = 1024; + let mut buf = [0u8; BUF_LEN]; + let code = unsafe { GetLastError() }; + let chars_written = unsafe { + FormatMessageA( + FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, + None, + code.0, + 0, + PSTR(buf.as_mut_ptr()), + BUF_LEN as u32, + None, + ) + }; + assert!(chars_written != 0); + let code_str = std::ffi::CStr::from_bytes_until_nul(&buf) + .unwrap() + .to_str() + .unwrap_or("Invalid utf8 in error"); + Error::Other(code, code_str.to_string(), extra) +} diff --git a/src/lib.rs b/src/lib.rs index 1779b6e..4953b1e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -8,6 +8,9 @@ #![warn(missing_docs)] #![allow(clippy::field_reassign_with_default)] +mod error; +mod util; + use std::ffi::OsString; use std::io::{Read, Write}; use std::mem::size_of; @@ -21,15 +24,7 @@ use pdb_addr2line::pdb::PDB; use pdb_addr2line::ContextPdbData; use windows::core::{GUID, PCSTR, PSTR}; use windows::Win32::Foundation::{ - CloseHandle, GetLastError, ERROR_SUCCESS, ERROR_WMI_INSTANCE_NOT_FOUND, HANDLE, - INVALID_HANDLE_VALUE, WIN32_ERROR, -}; -use windows::Win32::Security::{ - AdjustTokenPrivileges, LookupPrivilegeValueW, SE_PRIVILEGE_ENABLED, TOKEN_ADJUST_PRIVILEGES, - TOKEN_PRIVILEGES, -}; -use windows::Win32::System::Diagnostics::Debug::{ - FormatMessageA, FORMAT_MESSAGE_FROM_SYSTEM, FORMAT_MESSAGE_IGNORE_INSERTS, + CloseHandle, ERROR_SUCCESS, ERROR_WMI_INSTANCE_NOT_FOUND, HANDLE, INVALID_HANDLE_VALUE, }; use windows::Win32::System::Diagnostics::Etw::{ CloseTrace, ControlTraceA, OpenTraceA, ProcessTrace, StartTraceA, SystemTraceControlGuid, @@ -41,12 +36,13 @@ use windows::Win32::System::Diagnostics::Etw::{ WNODE_FLAG_TRACED_GUID, }; use windows::Win32::System::SystemInformation::{GetVersionExA, OSVERSIONINFOA}; -use windows::Win32::System::SystemServices::SE_SYSTEM_PROFILE_NAME; use windows::Win32::System::Threading::{ - GetCurrentProcess, GetCurrentThread, OpenProcess, OpenProcessToken, SetThreadPriority, - WaitForSingleObject, CREATE_SUSPENDED, PROCESS_ALL_ACCESS, THREAD_PRIORITY_TIME_CRITICAL, + GetCurrentThread, SetThreadPriority, CREATE_SUSPENDED, THREAD_PRIORITY_TIME_CRITICAL, }; +use crate::error::get_last_error; +pub use crate::error::{Error, Result}; + /// Maximum stack depth/height of traces. // msdn says 192 but I got some that were bigger // const MAX_STACK_DEPTH: usize = 192; @@ -105,102 +101,6 @@ impl Drop for TraceContext { } } -/// The errors that may occur in blondie. -#[derive(Debug)] -pub enum Error { - /// Blondie requires administrator privileges - NotAnAdmin, - /// Error writing to the provided Writer - Write(std::io::Error), - /// Error spawning a suspended process - SpawnErr(std::io::Error), - /// Error waiting for child, abandoned - WaitOnChildErrAbandoned, - /// Error waiting for child, timed out - WaitOnChildErrTimeout, - /// A call to a windows API function returned an error and we didn't know how to handle it - Other(WIN32_ERROR, String, &'static str), - /// We require Windows 7 or greater - UnsupportedOsVersion, - /// This should never happen - UnknownError, -} -/// A [`std::result::Result`] alias where the `Err` case is [`blondie::Error`](Error). -pub type Result = std::result::Result; - -fn get_last_error(extra: &'static str) -> Error { - const BUF_LEN: usize = 1024; - let mut buf = [0u8; BUF_LEN]; - let code = unsafe { GetLastError() }; - let chars_written = unsafe { - FormatMessageA( - FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, - None, - code.0, - 0, - PSTR(buf.as_mut_ptr()), - BUF_LEN as u32, - None, - ) - }; - assert!(chars_written != 0); - let code_str = std::ffi::CStr::from_bytes_until_nul(&buf) - .unwrap() - .to_str() - .unwrap_or("Invalid utf8 in error"); - Error::Other(code, code_str.to_string(), extra) -} - -/// A wrapper around `OpenProcess` that returns a handle with all access rights -unsafe fn handle_from_process_id(process_id: u32) -> Result { - match OpenProcess(PROCESS_ALL_ACCESS, false, process_id) { - Ok(handle) => Ok(handle), - Err(_) => Err(get_last_error("handle_from_process_id")), - } -} - -unsafe fn wait_for_process_by_handle(handle: HANDLE) -> Result<()> { - let ret = WaitForSingleObject(handle, 0xffffffff); - match ret.0 { - 0 => Ok(()), - 0x00000080 => Err(Error::WaitOnChildErrAbandoned), - 0x00000102 => Err(Error::WaitOnChildErrTimeout), - _ => Err(get_last_error("wait_for_process_by_handle")), - } -} - -fn acquire_privileges() -> Result<()> { - let mut privs = TOKEN_PRIVILEGES::default(); - privs.PrivilegeCount = 1; - privs.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED; - if unsafe { - LookupPrivilegeValueW(None, SE_SYSTEM_PROFILE_NAME, &mut privs.Privileges[0].Luid).0 == 0 - } { - return Err(get_last_error("acquire_privileges LookupPrivilegeValueA")); - } - let mut pt = HANDLE::default(); - if unsafe { OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES, &mut pt).0 == 0 } { - return Err(get_last_error("OpenProcessToken")); - } - let adjust = unsafe { AdjustTokenPrivileges(pt, false, Some(addr_of!(privs)), 0, None, None) }; - if adjust.0 == 0 { - let err = Err(get_last_error("AdjustTokenPrivileges")); - unsafe { - CloseHandle(pt); - } - return err; - } - let ret = unsafe { CloseHandle(pt) }; - if ret.0 == 0 { - return Err(get_last_error("acquire_privileges CloseHandle")); - } - let status = unsafe { GetLastError() }; - if status != ERROR_SUCCESS { - return Err(Error::NotAnAdmin); - } - Ok(()) -} - /// The main tracing logic. Traces the process with the given `target_process_id`. /// /// # Safety @@ -224,7 +124,7 @@ unsafe fn trace_from_process_id( { return Err(Error::UnsupportedOsVersion); } - acquire_privileges()?; + util::acquire_privileges()?; // Set the sampling interval // Only for Win8 or more @@ -246,12 +146,8 @@ unsafe fn trace_from_process_id( } } - let mut kernel_logger_name_with_nul = KERNEL_LOGGER_NAMEA - .as_bytes() - .iter() - .cloned() - .chain(Some(0)) - .collect::>(); + let mut kernel_logger_name_with_nul = KERNEL_LOGGER_NAMEA.as_bytes().to_vec(); + kernel_logger_name_with_nul.push(b'\0'); // Build the trace properties, we want EVENT_TRACE_FLAG_PROFILE for the "SampledProfile" event // https://docs.microsoft.com/en-us/windows/win32/etw/sampledprofile // In https://docs.microsoft.com/en-us/windows/win32/etw/event-tracing-mof-classes that event is listed as a "kernel event" @@ -353,7 +249,7 @@ unsafe fn trace_from_process_id( } } - let target_proc_handle = handle_from_process_id(target_process_id)?; + let target_proc_handle = util::handle_from_process_id(target_process_id)?; let mut context = TraceContext::new(target_proc_handle, target_process_id, kernel_stacks)?; // TODO: Do we need to Box the context? @@ -533,7 +429,7 @@ unsafe fn trace_from_process_id( } // Wait for it to end - wait_for_process_by_handle(target_proc_handle)?; + util::wait_for_process_by_handle(target_proc_handle)?; // This unblocks ProcessTrace let ret = ControlTraceA( ::default(), @@ -552,7 +448,7 @@ unsafe fn trace_from_process_id( .map_err(|_err_any| Error::UnknownError)??; if context.show_kernel_samples { - let kernel_module_paths = list_kernel_modules(); + let kernel_module_paths = util::list_kernel_modules(); context.image_paths.extend(kernel_module_paths); } @@ -869,80 +765,3 @@ struct ImageLoadEvent { Reserved3: u32, Reserved4: u32, } - -/// Returns a sequence of (image_file_path, image_base) -fn list_kernel_modules() -> Vec<(OsString, u64, u64)> { - // kernel module enumeration code based on http://www.rohitab.com/discuss/topic/40696-list-loaded-drivers-with-ntquerysysteminformation/ - #[link(name = "ntdll")] - extern "system" { - fn NtQuerySystemInformation( - SystemInformationClass: u32, - SystemInformation: *mut (), - SystemInformationLength: u32, - ReturnLength: *mut u32, - ) -> i32; - } - - const BUF_LEN: usize = 1024 * 1024; - let mut out_buf = vec![0u8; BUF_LEN]; - let mut out_size = 0u32; - // 11 = SystemModuleInformation - let retcode = unsafe { - NtQuerySystemInformation( - 11, - out_buf.as_mut_ptr().cast(), - BUF_LEN as u32, - &mut out_size, - ) - }; - if retcode < 0 { - // println!("Failed to load kernel modules"); - return vec![]; - } - let number_of_modules = unsafe { out_buf.as_ptr().cast::().read_unaligned() as usize }; - #[repr(C)] - #[derive(Debug)] - #[allow(non_snake_case)] - #[allow(non_camel_case_types)] - struct _RTL_PROCESS_MODULE_INFORMATION { - Section: *mut std::ffi::c_void, - MappedBase: *mut std::ffi::c_void, - ImageBase: *mut std::ffi::c_void, - ImageSize: u32, - Flags: u32, - LoadOrderIndex: u16, - InitOrderIndex: u16, - LoadCount: u16, - OffsetToFileName: u16, - FullPathName: [u8; 256], - } - let modules = unsafe { - let modules_ptr = out_buf - .as_ptr() - .cast::() - .offset(2) - .cast::<_RTL_PROCESS_MODULE_INFORMATION>(); - std::slice::from_raw_parts(modules_ptr, number_of_modules) - }; - - let kernel_module_paths = modules - .iter() - .filter_map(|module| { - std::ffi::CStr::from_bytes_until_nul(&module.FullPathName) - .unwrap() - .to_str() - .ok() - .map(|mod_str_filepath| { - let verbatim_path_osstring: OsString = mod_str_filepath - .replacen("\\SystemRoot\\", "\\\\?\\C:\\Windows\\", 1) - .into(); - ( - verbatim_path_osstring, - module.ImageBase as u64, - module.ImageSize as u64, - ) - }) - }) - .collect(); - kernel_module_paths -} diff --git a/src/util.rs b/src/util.rs new file mode 100644 index 0000000..7a5272f --- /dev/null +++ b/src/util.rs @@ -0,0 +1,147 @@ +use std::ffi::OsString; +use std::ptr::addr_of; + +use windows::Win32::Foundation::{CloseHandle, GetLastError, ERROR_SUCCESS, HANDLE}; +use windows::Win32::Security::{ + AdjustTokenPrivileges, LookupPrivilegeValueW, SE_PRIVILEGE_ENABLED, TOKEN_ADJUST_PRIVILEGES, + TOKEN_PRIVILEGES, +}; +use windows::Win32::System::SystemServices::SE_SYSTEM_PROFILE_NAME; +use windows::Win32::System::Threading::{ + GetCurrentProcess, OpenProcess, OpenProcessToken, WaitForSingleObject, PROCESS_ALL_ACCESS, +}; + +use crate::{get_last_error, Error, Result}; + +/// A wrapper around `OpenProcess` that returns a handle with all access rights +pub(crate) fn handle_from_process_id(process_id: u32) -> Result { + match unsafe { OpenProcess(PROCESS_ALL_ACCESS, false, process_id) } { + Ok(handle) => Ok(handle), + Err(_) => Err(get_last_error("handle_from_process_id")), + } +} + +/// Waits for the process for `handle` to end. +/// +/// # Safety +/// +/// `handle` must not be closed, before or during execution. +pub(crate) unsafe fn wait_for_process_by_handle(handle: HANDLE) -> Result<()> { + // https://learn.microsoft.com/en-us/windows/win32/api/synchapi/nf-synchapi-waitforsingleobject + let ret = WaitForSingleObject(handle, 0xffffffff); + match ret.0 { + 0 => Ok(()), + 0x00000080 => Err(Error::WaitOnChildErrAbandoned), + 0x00000102 => Err(Error::WaitOnChildErrTimeout), + _ => Err(get_last_error("wait_for_process_by_handle")), + } +} + +pub(crate) fn acquire_privileges() -> Result<()> { + let mut privs = TOKEN_PRIVILEGES::default(); + privs.PrivilegeCount = 1; + privs.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED; + if unsafe { + LookupPrivilegeValueW(None, SE_SYSTEM_PROFILE_NAME, &mut privs.Privileges[0].Luid).0 == 0 + } { + return Err(get_last_error("acquire_privileges LookupPrivilegeValueA")); + } + let mut pt = HANDLE::default(); + if unsafe { OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES, &mut pt).0 == 0 } { + return Err(get_last_error("OpenProcessToken")); + } + let adjust = unsafe { AdjustTokenPrivileges(pt, false, Some(addr_of!(privs)), 0, None, None) }; + if adjust.0 == 0 { + let err = Err(get_last_error("AdjustTokenPrivileges")); + unsafe { + CloseHandle(pt); + } + return err; + } + let ret = unsafe { CloseHandle(pt) }; + if ret.0 == 0 { + return Err(get_last_error("acquire_privileges CloseHandle")); + } + let status = unsafe { GetLastError() }; + if status != ERROR_SUCCESS { + return Err(Error::NotAnAdmin); + } + Ok(()) +} + +/// Returns a sequence of (image_file_path, image_base, image_size) +pub(crate) fn list_kernel_modules() -> Vec<(OsString, u64, u64)> { + // kernel module enumeration code based on http://www.rohitab.com/discuss/topic/40696-list-loaded-drivers-with-ntquerysysteminformation/ + #[link(name = "ntdll")] + extern "system" { + fn NtQuerySystemInformation( + SystemInformationClass: u32, + SystemInformation: *mut (), + SystemInformationLength: u32, + ReturnLength: *mut u32, + ) -> i32; + } + + const BUF_LEN: usize = 1024 * 1024; + let mut out_buf = vec![0u8; BUF_LEN]; + let mut out_size = 0u32; + // 11 = SystemModuleInformation + let retcode = unsafe { + NtQuerySystemInformation( + 11, + out_buf.as_mut_ptr().cast(), + BUF_LEN as u32, + &mut out_size, + ) + }; + if retcode < 0 { + // println!("Failed to load kernel modules"); + return vec![]; + } + let number_of_modules = unsafe { out_buf.as_ptr().cast::().read_unaligned() as usize }; + #[repr(C)] + #[derive(Debug)] + #[allow(non_snake_case)] + #[allow(non_camel_case_types)] + struct _RTL_PROCESS_MODULE_INFORMATION { + Section: *mut std::ffi::c_void, + MappedBase: *mut std::ffi::c_void, + ImageBase: *mut std::ffi::c_void, + ImageSize: u32, + Flags: u32, + LoadOrderIndex: u16, + InitOrderIndex: u16, + LoadCount: u16, + OffsetToFileName: u16, + FullPathName: [u8; 256], + } + let modules = unsafe { + let modules_ptr = out_buf + .as_ptr() + .cast::() + .offset(2) + .cast::<_RTL_PROCESS_MODULE_INFORMATION>(); + std::slice::from_raw_parts(modules_ptr, number_of_modules) + }; + + let kernel_module_paths = modules + .iter() + .filter_map(|module| { + std::ffi::CStr::from_bytes_until_nul(&module.FullPathName) + .unwrap() + .to_str() + .ok() + .map(|mod_str_filepath| { + let verbatim_path_osstring: OsString = mod_str_filepath + .replacen("\\SystemRoot\\", "\\\\?\\C:\\Windows\\", 1) + .into(); + ( + verbatim_path_osstring, + module.ImageBase as u64, + module.ImageSize as u64, + ) + }) + }) + .collect(); + kernel_module_paths +}