From 3f4ce3d9a0433301afc457ef7a19b92cb3a5ef2f Mon Sep 17 00:00:00 2001 From: Mrmaxmeier Date: Thu, 27 Mar 2025 14:44:15 +0100 Subject: [PATCH 1/6] pin to last known good-ish wasabi release --- wasm_instrumenter/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wasm_instrumenter/Cargo.toml b/wasm_instrumenter/Cargo.toml index 067b4a062..4c005d826 100644 --- a/wasm_instrumenter/Cargo.toml +++ b/wasm_instrumenter/Cargo.toml @@ -7,7 +7,7 @@ edition = "2018" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -wasm = { git = "https://github.com/danleh/wasabi" } +wasm = { git = "https://github.com/danleh/wasabi", rev="519da3ced4e1ae11daeea39f3588bb89643bb7bb" } rand = "0.7.3" rand_distr = "0.3.0" clap = "2.33.3" From d96f72a1760590d0a7f648a8fc7bf338af7372c9 Mon Sep 17 00:00:00 2001 From: Mrmaxmeier Date: Thu, 27 Mar 2025 14:44:17 +0100 Subject: [PATCH 2/6] bump to wasabi ed35db --- wasm_instrumenter/Cargo.lock | 776 +++++++++++++++++++++++----- wasm_instrumenter/Cargo.toml | 2 +- wasm_instrumenter/src/afl_branch.rs | 23 +- wasm_instrumenter/src/canaries.rs | 95 ++-- 4 files changed, 707 insertions(+), 189 deletions(-) diff --git a/wasm_instrumenter/Cargo.lock b/wasm_instrumenter/Cargo.lock index 3eb5313c9..b5531afe6 100644 --- a/wasm_instrumenter/Cargo.lock +++ b/wasm_instrumenter/Cargo.lock @@ -1,35 +1,84 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. +version = 4 + +[[package]] +name = "ahash" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8fd72866655d1904d6b0997d0b07ba561047d070fbe29de039031c641b61217" +dependencies = [ + "const-random", +] + +[[package]] +name = "ahash" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "891477e0c6a8957309ee5c45a6368af3ae14bb510732d2684ffa19af310920f9" +dependencies = [ + "getrandom 0.2.15", + "once_cell", + "version_check", +] + +[[package]] +name = "aho-corasick" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" +dependencies = [ + "memchr", +] + [[package]] name = "ansi_term" -version = "0.11.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" +checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" dependencies = [ "winapi", ] +[[package]] +name = "anyhow" +version = "1.0.97" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dcfed56ad506cb2c684a14971b8861fdc3baaaae314b9e5f9bb532cbe3ba7a4f" + +[[package]] +name = "arc-interner" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "655ae79d4a7661f2f9a8f6daf95af32897eafdea938df06aeb127cea02b5f4ac" +dependencies = [ + "ahash 0.3.8", + "dashmap", + "once_cell", + "serde", +] + [[package]] name = "atty" version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" dependencies = [ - "hermit-abi", + "hermit-abi 0.1.19", "libc", "winapi", ] [[package]] name = "autocfg" -version = "1.0.1" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "binary_derive" version = "0.2.0" -source = "git+https://github.com/danleh/wasabi#e3f968f3db984621ecc34269918570bbee61a037" +source = "git+https://github.com/danleh/wasabi?rev=ed35db618c67a912dc9218bc4aa03239a1eb6e47#ed35db618c67a912dc9218bc4aa03239a1eb6e47" dependencies = [ "quote 0.4.2", "syn 0.12.15", @@ -37,31 +86,37 @@ dependencies = [ [[package]] name = "bitflags" -version = "1.2.1" +version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "bitflags" +version = "2.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c8214115b7bf84099f1309324e63141d4c5d7cc26862f97a0a857dbefe165bd" [[package]] name = "byteorder" -version = "1.3.4" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "cfg-if" -version = "0.1.10" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "clap" -version = "2.33.3" +version = "2.34.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002" +checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c" dependencies = [ "ansi_term", "atty", - "bitflags", + "bitflags 1.3.2", "strsim", "textwrap", "unicode-width", @@ -69,134 +124,309 @@ dependencies = [ ] [[package]] -name = "cloudabi" -version = "0.0.3" +name = "const-random" +version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" +checksum = "87e00182fe74b066627d63b85fd550ac2998d4b0bd86bfed477a0ae4c7c71359" dependencies = [ - "bitflags", + "const-random-macro", ] [[package]] -name = "crossbeam-channel" -version = "0.4.4" +name = "const-random-macro" +version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b153fe7cbef478c567df0f972e02e6d736db11affe43dfc9c56a9374d1adfb87" +checksum = "f9d839f2a20b0aee515dc581a6172f2321f96cab76c1a38a4c584a194955390e" dependencies = [ - "crossbeam-utils", - "maybe-uninit", + "getrandom 0.2.15", + "once_cell", + "tiny-keccak", ] [[package]] name = "crossbeam-deque" -version = "0.7.3" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f02af974daeee82218205558e51ec8768b48cf524bd01d550abe5573a608285" +checksum = "9dd111b7b7f7d55b72c0a6ae361660ee5853c9af73f70c3c2ef6858b950e2e51" dependencies = [ "crossbeam-epoch", "crossbeam-utils", - "maybe-uninit", ] [[package]] name = "crossbeam-epoch" -version = "0.8.2" +version = "0.9.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "058ed274caafc1f60c4997b5fc07bf7dc7cca454af7c6e81edffe5f33f70dace" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" dependencies = [ - "autocfg", - "cfg-if", "crossbeam-utils", - "lazy_static", - "maybe-uninit", - "memoffset", - "scopeguard", ] [[package]] name = "crossbeam-utils" -version = "0.7.2" +version = "0.8.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" + +[[package]] +name = "crunchy" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3c7c73a2d1e9fc0886a08b93e98eb643461230d5f1925e4036204d5f2e261a8" +checksum = "43da5946c66ffcc7745f48db692ffbb10a83bfe0afd96235c5c2a4fb23994929" + +[[package]] +name = "csv" +version = "1.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "acdc4883a9c96732e4733212c01447ebd805833b7275a73ca3ee080fd77afdaf" +dependencies = [ + "csv-core", + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "csv-core" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d02f3b0da4c6504f86e9cd789d8dbafab48c2321be74e9987593de5a894d93d" +dependencies = [ + "memchr", +] + +[[package]] +name = "dashmap" +version = "4.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e77a43b28d0668df09411cb0bc9a8c2adc40f9a048afe863e05fd43251e8e39c" dependencies = [ - "autocfg", "cfg-if", - "lazy_static", + "num_cpus", ] [[package]] name = "either" -version = "1.6.1" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" + +[[package]] +name = "futures" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876" +dependencies = [ + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-channel" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" + +[[package]] +name = "futures-executor" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" +checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-io" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" + +[[package]] +name = "futures-sink" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" + +[[package]] +name = "futures-task" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" + +[[package]] +name = "futures-util" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "pin-utils", + "slab", +] + +[[package]] +name = "getrandom" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" +dependencies = [ + "cfg-if", + "libc", + "wasi 0.9.0+wasi-snapshot-preview1", +] [[package]] name = "getrandom" -version = "0.1.15" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc587bc0ec293155d5bfa6b9891ec18a1e330c234f896ea47fbada4cadbe47e6" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" dependencies = [ "cfg-if", "libc", - "wasi", + "wasi 0.11.0+wasi-snapshot-preview1", +] + +[[package]] +name = "hashbrown" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" +dependencies = [ + "ahash 0.7.8", ] [[package]] name = "hermit-abi" -version = "0.1.16" +version = "0.1.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c30f6d0bc6b00693347368a67d41b58f2fb851215ff1da49e90fe2c5c667151" +checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" dependencies = [ "libc", ] +[[package]] +name = "hermit-abi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" + +[[package]] +name = "indexmap" +version = "1.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" +dependencies = [ + "autocfg", + "hashbrown", +] + +[[package]] +name = "internment" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73bd1419c48e9f496d5830cc2f7fff35cab112193f289fd7266ab0679bb97237" +dependencies = [ + "hashbrown", + "parking_lot", +] + +[[package]] +name = "itoa" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" + [[package]] name = "lazy_static" -version = "1.4.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" + +[[package]] +name = "leb128" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "884e2677b40cc8c339eaefcb701c32ef1fd2493d71118dc0ca4b6a736c93bd67" [[package]] name = "libc" -version = "0.2.79" +version = "0.2.171" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2448f6066e80e3bfc792e9c98bf705b4b0fc6e8ef5b43e5889aff0eaa9c58743" +checksum = "c19937216e9d3aa9956d9bb8dfc0b0c8beb6058fc4f7a4dc4d850edf86a237d6" [[package]] name = "libm" -version = "0.2.1" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7d73b3f436185384286bd8098d17ec07c9a7d2388a6599f824d8502b529702a" +checksum = "8355be11b20d696c8f18f6cc018c4e372165b1fa8126cef092399c9951984ffa" [[package]] name = "lock_api" -version = "0.3.4" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4da24a77a3d8a6d4862d95f72e6fdb9c09a643ecdb402d754004a557f2bec75" +checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" dependencies = [ + "autocfg", "scopeguard", ] [[package]] -name = "maybe-uninit" -version = "2.0.0" +name = "log" +version = "0.4.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00" +checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94" [[package]] -name = "memoffset" -version = "0.5.6" +name = "memchr" +version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "043175f069eda7b85febe4a74abbaeff828d9f8b448515d3151a14a3542811aa" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" + +[[package]] +name = "minimal-lexical" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" + +[[package]] +name = "nom" +version = "7.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" dependencies = [ - "autocfg", + "memchr", + "minimal-lexical", ] [[package]] name = "num-traits" -version = "0.2.12" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac267bcc07f48ee5f8935ab0d24f316fb722d7a1292e2913f0cc196b29ffd611" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" dependencies = [ "autocfg", "libm", @@ -204,28 +434,34 @@ dependencies = [ [[package]] name = "num_cpus" -version = "1.13.0" +version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3" +checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" dependencies = [ - "hermit-abi", + "hermit-abi 0.3.9", "libc", ] +[[package]] +name = "once_cell" +version = "1.21.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d75b0bedcc4fe52caa0e03d9f1151a323e4aa5e2d78ba3580400cd3c9e2bc4bc" + [[package]] name = "ordered-float" -version = "1.1.0" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3741934be594d77de1c8461ebcbbe866f585ea616a9753aa78f2bdc69f0e4579" +checksum = "3305af35278dd29f46fcdd139e0b1fbfae2153f0e5928b39b035542dd31e37b7" dependencies = [ "num-traits", ] [[package]] name = "parking_lot" -version = "0.10.2" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3a704eb390aafdc107b0e392f56a82b668e3a71366993b5340f5833fd62505e" +checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27" dependencies = [ "lock_api", "parking_lot_core", @@ -233,23 +469,37 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.7.2" +version = "0.9.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d58c7c768d4ba344e3e8d72518ac13e259d7c7ade24167003b8488e10b6740a3" +checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" dependencies = [ "cfg-if", - "cloudabi", "libc", "redox_syscall", "smallvec", - "winapi", + "windows-targets", ] +[[package]] +name = "pin-project-lite" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + [[package]] name = "ppv-lite86" -version = "0.2.9" +version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c36fa947111f5c62a733b652544dd0016a43ce89619538a8ef92724a6f501a20" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy", +] [[package]] name = "proc-macro2" @@ -257,16 +507,16 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cd07deb3c6d1d9ff827999c7f9b04cdfd66b1b17ae508e14fe47b620f2282ae0" dependencies = [ - "unicode-xid 0.1.0", + "unicode-xid", ] [[package]] name = "proc-macro2" -version = "1.0.24" +version = "1.0.94" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71" +checksum = "a31971752e70b8b2686d7e46ec17fb38dad4051d94024c88df49b667caea9c84" dependencies = [ - "unicode-xid 0.2.1", + "unicode-ident", ] [[package]] @@ -280,11 +530,11 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.7" +version = "1.0.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa563d17ecb180e500da1cfd2b028310ac758de548efdd203e18f283af693f37" +checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d" dependencies = [ - "proc-macro2 1.0.24", + "proc-macro2 1.0.94", ] [[package]] @@ -293,7 +543,7 @@ version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" dependencies = [ - "getrandom", + "getrandom 0.1.16", "libc", "rand_chacha", "rand_core", @@ -316,7 +566,7 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" dependencies = [ - "getrandom", + "getrandom 0.1.16", ] [[package]] @@ -340,88 +590,163 @@ dependencies = [ [[package]] name = "rayon" -version = "1.4.1" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcf6960dc9a5b4ee8d3e4c5787b4a112a8818e0290a42ff664ad60692fdf2032" +checksum = "b418a60154510ca1a002a752ca9714984e21e4241e804d32555251faf8b78ffa" dependencies = [ - "autocfg", - "crossbeam-deque", "either", "rayon-core", ] [[package]] name = "rayon-core" -version = "1.8.1" +version = "1.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8c4fec834fb6e6d2dd5eece3c7b432a52f0ba887cf40e595190c4107edc08bf" +checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2" dependencies = [ - "crossbeam-channel", "crossbeam-deque", "crossbeam-utils", - "lazy_static", - "num_cpus", ] [[package]] name = "redox_syscall" -version = "0.1.57" +version = "0.5.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" +checksum = "0b8c0c260b63a8219631167be35e6a988e9554dbd323f8bd08439c8ed1302bd1" +dependencies = [ + "bitflags 2.9.0", +] [[package]] -name = "scopeguard" +name = "regex" +version = "1.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" + +[[package]] +name = "rustc-hash" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" + +[[package]] +name = "ryu" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" + +[[package]] +name = "same-file" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "scc" +version = "2.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea091f6cac2595aa38993f04f4ee692ed43757035c36e67c180b6828356385b1" +dependencies = [ + "sdd", +] + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "sdd" +version = "3.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "584e070911c7017da6cb2eb0788d09f43d789029b5877d3e5ecc8acf86ceee21" [[package]] name = "serde" -version = "1.0.116" +version = "1.0.219" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96fe57af81d28386a513cbc6858332abc6117cfdb5999647c6444b8f43a370a5" +checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.116" +version = "1.0.219" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f630a6370fd8e457873b4bd2ffdae75408bc291ba72be773772a4c2a065d9ae8" +checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" dependencies = [ - "proc-macro2 1.0.24", - "quote 1.0.7", - "syn 1.0.42", + "proc-macro2 1.0.94", + "quote 1.0.40", + "syn 2.0.100", ] [[package]] name = "serial_test" -version = "0.5.0" +version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b15f74add9a9d4a3eb2bf739c9a427d266d3895b53d992c3a7c234fec2ff1f1" +checksum = "1b258109f244e1d6891bf1053a55d63a5cd4f8f4c30cf9a1280989f80e7a1fa9" dependencies = [ - "lazy_static", + "futures", + "log", + "once_cell", "parking_lot", + "scc", "serial_test_derive", ] [[package]] name = "serial_test_derive" -version = "0.5.0" +version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65f59259be9fc1bf677d06cc1456e97756004a1a5a577480f71430bd7c17ba33" +checksum = "5d69265a08751de7844521fd15003ae0a888e035773ba05695c5c759a6f89eef" dependencies = [ - "proc-macro2 1.0.24", - "quote 1.0.7", - "syn 1.0.42", + "proc-macro2 1.0.94", + "quote 1.0.40", + "syn 2.0.100", +] + +[[package]] +name = "slab" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" +dependencies = [ + "autocfg", ] [[package]] name = "smallvec" -version = "1.4.2" +version = "1.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbee7696b84bbf3d89a1c2eccff0850e3047ed46bfcd2e92c29a2d074d57e252" +checksum = "7fcf8323ef1faaee30a44a340193b1ac6814fd9b7b4e88e9d4519a3e4abe1cfd" [[package]] name = "strsim" @@ -437,18 +762,26 @@ checksum = "c97c05b8ebc34ddd6b967994d5c6e9852fa92f8b82b3858c39451f97346dcce5" dependencies = [ "proc-macro2 0.2.3", "quote 0.4.2", - "unicode-xid 0.1.0", + "unicode-xid", ] [[package]] name = "syn" -version = "1.0.42" +version = "2.0.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c51d92969d209b54a98397e1b91c8ae82d8c87a7bb87df0b29aa2ad81454228" +checksum = "b09a44accad81e1ba1cd74a32461ba89dee89095ba17b32f5d03683b1b1fc2a0" +dependencies = [ + "proc-macro2 1.0.94", + "quote 1.0.40", + "unicode-ident", +] + +[[package]] +name = "test_utilities" +version = "0.1.0" +source = "git+https://github.com/danleh/wasabi?rev=ed35db618c67a912dc9218bc4aa03239a1eb6e47#ed35db618c67a912dc9218bc4aa03239a1eb6e47" dependencies = [ - "proc-macro2 1.0.24", - "quote 1.0.7", - "unicode-xid 0.2.1", + "walkdir", ] [[package]] @@ -461,22 +794,51 @@ dependencies = [ ] [[package]] -name = "unicode-width" -version = "0.1.8" +name = "thiserror" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" +dependencies = [ + "thiserror-impl", +] [[package]] -name = "unicode-xid" -version = "0.1.0" +name = "thiserror-impl" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" +dependencies = [ + "proc-macro2 1.0.94", + "quote 1.0.40", + "syn 2.0.100", +] + +[[package]] +name = "tiny-keccak" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237" +dependencies = [ + "crunchy", +] + +[[package]] +name = "unicode-ident" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512" + +[[package]] +name = "unicode-width" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" [[package]] name = "unicode-xid" -version = "0.2.1" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" +checksum = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" [[package]] name = "vec_map" @@ -484,6 +846,22 @@ version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" +[[package]] +name = "version_check" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" + +[[package]] +name = "walkdir" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" +dependencies = [ + "same-file", + "winapi-util", +] + [[package]] name = "wasabi_leb128" version = "0.4.0" @@ -499,17 +877,44 @@ version = "0.9.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + [[package]] name = "wasm" version = "0.5.0" -source = "git+https://github.com/danleh/wasabi#e3f968f3db984621ecc34269918570bbee61a037" +source = "git+https://github.com/danleh/wasabi?rev=ed35db618c67a912dc9218bc4aa03239a1eb6e47#ed35db618c67a912dc9218bc4aa03239a1eb6e47" dependencies = [ + "anyhow", + "arc-interner", "binary_derive", "byteorder", + "csv", + "internment", + "lazy_static", + "nom", "ordered-float", "rayon", + "regex", + "rustc-hash", "serde", + "test_utilities", + "thiserror", "wasabi_leb128", + "wasm-encoder", + "wasmparser", +] + +[[package]] +name = "wasm-encoder" +version = "0.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e7ca71c70a6de5b10968ae4d298e548366d9cd9588176e6ff8866f3c49c96ee" +dependencies = [ + "leb128", ] [[package]] @@ -523,6 +928,15 @@ dependencies = [ "wasm", ] +[[package]] +name = "wasmparser" +version = "0.91.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "239cdca8b8f356af8118c522d5fea23da45b60832ed4e18ef90bb3c9d8dce24a" +dependencies = [ + "indexmap", +] + [[package]] name = "winapi" version = "0.3.9" @@ -539,8 +953,110 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" +[[package]] +name = "winapi-util" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" +dependencies = [ + "windows-sys", +] + [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_gnullvm", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[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.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[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.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "zerocopy" +version = "0.8.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2586fea28e186957ef732a5f8b3be2da217d65c5969d4b1e17f973ebbe876879" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a996a8f63c5c4448cd959ac1bab0aaa3306ccfd060472f85943ee0750f0169be" +dependencies = [ + "proc-macro2 1.0.94", + "quote 1.0.40", + "syn 2.0.100", +] diff --git a/wasm_instrumenter/Cargo.toml b/wasm_instrumenter/Cargo.toml index 4c005d826..e57c16413 100644 --- a/wasm_instrumenter/Cargo.toml +++ b/wasm_instrumenter/Cargo.toml @@ -7,7 +7,7 @@ edition = "2018" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -wasm = { git = "https://github.com/danleh/wasabi", rev="519da3ced4e1ae11daeea39f3588bb89643bb7bb" } +wasm = { git = "https://github.com/danleh/wasabi", rev="ed35db618c67a912dc9218bc4aa03239a1eb6e47" } rand = "0.7.3" rand_distr = "0.3.0" clap = "2.33.3" diff --git a/wasm_instrumenter/src/afl_branch.rs b/wasm_instrumenter/src/afl_branch.rs index 280358fb3..ed54bdf1c 100644 --- a/wasm_instrumenter/src/afl_branch.rs +++ b/wasm_instrumenter/src/afl_branch.rs @@ -4,9 +4,10 @@ use rand::rngs::ThreadRng; use std::error::Error; use std::ffi::OsStr; use wasm::highlevel::{ - Global, GlobalOp, ImportOrPresent, Instr, LoadOp, Local, LocalOp, Module, NumericOp, StoreOp, + BinaryOp, FunctionType, Global, GlobalOp, ImportOrPresent, Instr, LoadOp, Local, LocalOp, + Module, StoreOp, }; -use wasm::{FunctionType, Idx, Label, Memarg, Mutability, Val, ValType}; +use wasm::{Idx, Memarg, Mutability, Val, ValType}; /// must be kept up-to-date with the AFL implementation const MAP_SIZE_POW2: u32 = 16; @@ -161,11 +162,11 @@ pub fn instrument_with_afl_branch_coverage(m: &mut Module) { let mut jmp_to_depths: Vec = vec![]; for (idx, instr) in instrs.iter_mut().enumerate() { match instr { - Instr::BrIf(Label(lvl)) => { + Instr::BrIf(lvl) => { shim_idxs.push(idx); br_if_fallthrough_shims += 1; - jmp_to_depths.push(current_depth - (*lvl as i32)); + jmp_to_depths.push(current_depth - (lvl.to_u32() as i32)); } Instr::If(_) => { current_depth += 1; @@ -184,17 +185,17 @@ pub fn instrument_with_afl_branch_coverage(m: &mut Module) { Instr::BrTable { table, - default: Label(default_lvl), + default: default_lvl, } => { // No shim necessary, because execution always branches to a different block. // While technically allowed, no useful instructions follow br_table. // for every level which the br_table can jump to - for Label(lvl) in table { - jmp_to_depths.push(current_depth - (*lvl as i32)); + for lvl in table { + jmp_to_depths.push(current_depth - (lvl.to_u32() as i32)); } // also push the default level - jmp_to_depths.push(current_depth - (*default_lvl as i32)); + jmp_to_depths.push(current_depth - (default_lvl.to_u32() as i32)); br_table_shims += 1; } Instr::Block(_) => { @@ -295,9 +296,9 @@ impl ShimCreator { // compute and store address in the trace_bits_idx_local Instr::Const(Val::I32(cur_location as i32)), Instr::Global(GlobalOp::Get, self.prev_location), - Instr::Numeric(NumericOp::I32Xor), + Instr::Binary(BinaryOp::I32Xor), Instr::Global(GlobalOp::Get, self.trace_bits_ptr), - Instr::Numeric(NumericOp::I32Add), + Instr::Binary(BinaryOp::I32Add), Instr::Local(LocalOp::Tee, trace_bits_idx_local), // prepare the memory address for the store // TODO. There is no dup instruction, which is why we store @@ -313,7 +314,7 @@ impl ShimCreator { }, ), Instr::Const(Val::I32(1)), - Instr::Numeric(NumericOp::I32Add), + Instr::Binary(BinaryOp::I32Add), Instr::Store( StoreOp::I32Store8, Memarg { diff --git a/wasm_instrumenter/src/canaries.rs b/wasm_instrumenter/src/canaries.rs index f289baebd..9b18592b4 100644 --- a/wasm_instrumenter/src/canaries.rs +++ b/wasm_instrumenter/src/canaries.rs @@ -1,11 +1,12 @@ use crate::shared::{find_func_by_name, get_param_n_idx, insert_postfix, insert_prefix}; +use rand::distributions::{Distribution, Uniform}; use std::error::Error; use std::ffi::OsStr; use wasm::highlevel::{ - Function, Global, GlobalOp, Instr, LoadOp, Local, LocalOp, Module, NumericOp, StoreOp, + BinaryOp, Function, FunctionType, Global, GlobalOp, Instr, LoadOp, Local, LocalOp, Module, + StoreOp, UnaryOp, }; -use rand::distributions::{Distribution, Uniform}; -use wasm::{BlockType, FunctionType, Idx, Label, Memarg, Mutability, Val, ValType}; +use wasm::{BlockType, Idx, Label, Memarg, Mutability, Val, ValType}; pub fn instrument_file( input_file: &OsStr, @@ -81,13 +82,13 @@ pub fn instrument_with_heap_canary_check(m: &mut Module) { Instr::Block(BlockType(None)), Instr::Global(GlobalOp::Get, disable_canary_insertion_in_malloc), Instr::Const(Val::I32(1)), - Instr::Numeric(NumericOp::I32Eq), - Instr::BrIf(Label(0)), + Instr::Binary(BinaryOp::I32Eq), + Instr::BrIf(Label::from(0u32)), Instr::Local(LocalOp::Get, malloc_p0), //TODO do we also need to 16 byte align the heap values? //I don't think that is necessary, but it might be worth while to check. Instr::Const(Val::I32(20)), - Instr::Numeric(NumericOp::I32Add), + Instr::Binary(BinaryOp::I32Add), // store the size in a fresh local in case the first parameter gets overwritten Instr::Local(LocalOp::Tee, malloc_size), Instr::Local(LocalOp::Set, malloc_p0), @@ -108,8 +109,8 @@ pub fn instrument_with_heap_canary_check(m: &mut Module) { // if result is NULL, then don't attempt to insert canaries. Instr::Local(LocalOp::Get, tmp_result_local), Instr::Local(LocalOp::Get, tmp_result_local), - Instr::Numeric(NumericOp::I32Eqz), - Instr::BrIf(Label(0)), + Instr::Unary(UnaryOp::I32Eqz), + Instr::BrIf(Label::from(0u32)), ]; if disable_check.is_some() { postfix.append(&mut disable_check.unwrap()); @@ -140,10 +141,10 @@ pub fn instrument_with_heap_canary_check(m: &mut Module) { Instr::Local(LocalOp::Get, size_local), // add with x to get the index of the last data chunk Instr::Local(LocalOp::Get, tmp_result_local), - Instr::Numeric(NumericOp::I32Add), + Instr::Binary(BinaryOp::I32Add), // index (ptr + size - 8) where we want to place the canary Instr::Const(Val::I32(8)), - Instr::Numeric(NumericOp::I32Sub), + Instr::Binary(BinaryOp::I32Sub), // store post data canary Instr::Const(Val::I64(0)), Instr::Store( @@ -156,7 +157,7 @@ pub fn instrument_with_heap_canary_check(m: &mut Module) { // return ptr + 12, i.e., ptr to first element after the first canary. Instr::Local(LocalOp::Get, tmp_result_local), Instr::Const(Val::I32(12)), - Instr::Numeric(NumericOp::I32Add), + Instr::Binary(BinaryOp::I32Add), Instr::End, ]); postfix @@ -168,9 +169,9 @@ pub fn instrument_with_heap_canary_check(m: &mut Module) { // check if canary insertion is disabled Instr::Global(GlobalOp::Get, disable_canary_insertion_in_malloc), Instr::Const(Val::I32(1)), - Instr::Numeric(NumericOp::I32Eq), + Instr::Binary(BinaryOp::I32Eq), // returns tmp_result_local pushed in malloc postfix - Instr::BrIf(Label(0)), + Instr::BrIf(Label::from(0u32)), ]), ); insert_postfix(malloc, &mut post_fix); @@ -187,24 +188,24 @@ pub fn instrument_with_heap_canary_check(m: &mut Module) { Instr::Block(BlockType(None)), Instr::Global(GlobalOp::Get, disable_canary_glob), Instr::Const(Val::I32(1)), - Instr::Numeric(NumericOp::I32Eq), - Instr::BrIf(Label(0)), + Instr::Binary(BinaryOp::I32Eq), + Instr::BrIf(Label::from(0u32)), // if ptr == NULL, then skip the canary checks Instr::Block(BlockType(None)), Instr::Local(LocalOp::Get, chunk_data_ptr), - Instr::Numeric(NumericOp::I32Eqz), - Instr::BrIf(Label(0)), + Instr::Unary(UnaryOp::I32Eqz), + Instr::BrIf(Label::from(0u32)), // block to check first canary Instr::Block(BlockType(None)), // decrease ptr by 12 Instr::Local(LocalOp::Get, chunk_data_ptr), Instr::Const(Val::I32(12)), - Instr::Numeric(NumericOp::I32Sub), + Instr::Binary(BinaryOp::I32Sub), Instr::Local(LocalOp::Set, chunk_data_ptr), // retrieve ptr to first canary (param_0 - 8) Instr::Local(LocalOp::Get, chunk_data_ptr), Instr::Const(Val::I32(4)), - Instr::Numeric(NumericOp::I32Add), + Instr::Binary(BinaryOp::I32Add), // check first parameter Instr::Load( LoadOp::I64Load, @@ -213,8 +214,8 @@ pub fn instrument_with_heap_canary_check(m: &mut Module) { offset: 0, }, ), - Instr::Numeric(NumericOp::I64Eqz), - Instr::BrIf(Label(0)), + Instr::Unary(UnaryOp::I64Eqz), + Instr::BrIf(Label::from(0u32)), Instr::Unreachable, Instr::End, // block to check the second canary @@ -230,10 +231,10 @@ pub fn instrument_with_heap_canary_check(m: &mut Module) { ), // get the index of the last data item + 12 bytes (since param 0 is real data ptr + 12) Instr::Local(LocalOp::Get, chunk_data_ptr), - Instr::Numeric(NumericOp::I32Add), + Instr::Binary(BinaryOp::I32Add), // get the index of the post-chunk canary Instr::Const(Val::I32(8)), - Instr::Numeric(NumericOp::I32Sub), + Instr::Binary(BinaryOp::I32Sub), // check the canary value Instr::Load( LoadOp::I64Load, @@ -242,8 +243,8 @@ pub fn instrument_with_heap_canary_check(m: &mut Module) { offset: 0, }, ), - Instr::Numeric(NumericOp::I64Eqz), - Instr::BrIf(Label(0)), + Instr::Unary(UnaryOp::I64Eqz), + Instr::BrIf(Label::from(0u32)), Instr::Unreachable, Instr::End, Instr::End, @@ -276,7 +277,7 @@ pub fn instrument_with_heap_canary_check(m: &mut Module) { // reserve another 20 bytes for the two canaries and the size Instr::Local(LocalOp::Get, realloc_p1), Instr::Const(Val::I32(20)), - Instr::Numeric(NumericOp::I32Add), + Instr::Binary(BinaryOp::I32Add), Instr::Local(LocalOp::Tee, realloc_size), Instr::Local(LocalOp::Set, realloc_p1), // disable canary checking while the body of realloc is executing @@ -322,12 +323,12 @@ pub fn instrument_with_heap_canary_check(m: &mut Module) { // check if nitems * item_size overflows. // In that case, calloc should fail, so it's essential we don't modify the args. Instr::Local(LocalOp::Get, calloc_p0), - Instr::Numeric(NumericOp::I64ExtendI32U), + Instr::Unary(UnaryOp::I64ExtendI32U), Instr::Local(LocalOp::Get, calloc_p1), - Instr::Numeric(NumericOp::I64ExtendI32U), - Instr::Numeric(NumericOp::I64Mul), + Instr::Unary(UnaryOp::I64ExtendI32U), + Instr::Binary(BinaryOp::I64Mul), Instr::Const(Val::I64(0xFFFFFFFF)), - Instr::Numeric(NumericOp::I64GeU), + Instr::Binary(BinaryOp::I64GeU), Instr::If(BlockType(None)), Instr::Const(Val::I32(1)), Instr::Local(LocalOp::Set, calloc_overflow), @@ -337,14 +338,14 @@ pub fn instrument_with_heap_canary_check(m: &mut Module) { // calloc (nitems, item_size) = calloc (1, item_size * nitems) Instr::Local(LocalOp::Get, calloc_p0), Instr::Local(LocalOp::Get, calloc_p1), - Instr::Numeric(NumericOp::I32Mul), + Instr::Binary(BinaryOp::I32Mul), Instr::Local(LocalOp::Set, calloc_p1), Instr::Const(Val::I32(1)), Instr::Local(LocalOp::Set, calloc_p0), // reserve another 20 bytes for canaries and size Instr::Local(LocalOp::Get, calloc_p1), Instr::Const(Val::I32(20)), - Instr::Numeric(NumericOp::I32Add), + Instr::Binary(BinaryOp::I32Add), Instr::Local(LocalOp::Tee, calloc_size), Instr::Local(LocalOp::Set, calloc_p1), Instr::End, @@ -360,9 +361,9 @@ pub fn instrument_with_heap_canary_check(m: &mut Module) { Instr::Local(LocalOp::Get, calloc_overflow), // check for overflow Instr::Const(Val::I32(1)), - Instr::Numeric(NumericOp::I32Eq), + Instr::Binary(BinaryOp::I32Eq), // returns tmp_result_local pushed in malloc postfix - Instr::BrIf(Label(0)), + Instr::BrIf(Label::from(0u32)), ]), ); // re-enable the canary insertion in malloc @@ -400,7 +401,7 @@ pub fn instrument_with_stack_canary_check(m: &mut Module) { m.functions_mut().for_each(|(_, f)| { if requires_canary_check(f, &stack_ptr_idx) { let canary_value = distribution.sample(&mut rng); - + if f.code().is_some() { returns_to_outer_block_jmp(f); @@ -410,7 +411,7 @@ pub fn instrument_with_stack_canary_check(m: &mut Module) { vec![ Instr::Global(GlobalOp::Get, stack_ptr_idx), Instr::Const(Val::I32(CANARY_ALLOC_BLOCK_SIZE)), - Instr::Numeric(NumericOp::I32Sub), + Instr::Binary(BinaryOp::I32Sub), Instr::Global(GlobalOp::Set, stack_ptr_idx), Instr::Global(GlobalOp::Get, stack_ptr_idx), Instr::Const(Val::I64(canary_value)), @@ -441,13 +442,13 @@ pub fn instrument_with_stack_canary_check(m: &mut Module) { }, ), Instr::Const(Val::I64(canary_value)), - Instr::Numeric(NumericOp::I64Eq), - Instr::BrIf(Label(0)), + Instr::Binary(BinaryOp::I64Eq), + Instr::BrIf(Label::from(0u32)), Instr::Unreachable, Instr::End, Instr::Global(GlobalOp::Get, stack_ptr_idx), Instr::Const(Val::I32(CANARY_ALLOC_BLOCK_SIZE)), - Instr::Numeric(NumericOp::I32Add), + Instr::Binary(BinaryOp::I32Add), Instr::Global(GlobalOp::Set, stack_ptr_idx), ]); @@ -468,7 +469,7 @@ pub fn instrument_with_print_functions(m: &mut Module) { let mut printf_func = |name: &str, str_lit_bytes: i32| { let print32idx = m.add_function(FunctionType::new(&[ValType::I32], &[]), vec![], vec![]); - let mut print32 = m.function_mut(print32idx); + let print32 = m.function_mut(print32idx); print32.name = Some(String::from(name)); // unwrap safe, since we created function with 1 param let (p0, _) = print32.params().next().unwrap(); @@ -477,7 +478,7 @@ pub fn instrument_with_print_functions(m: &mut Module) { print32.instrs_mut().unwrap().append(&mut vec![ Instr::Global(GlobalOp::Get, stack_ptr_idx), //global.get 0 Instr::Const(Val::I32(16)), //i32.const 16 - Instr::Numeric(NumericOp::I32Sub), //i32.sub + Instr::Binary(BinaryOp::I32Sub), //i32.sub Instr::Local(LocalOp::Tee, l1), //local.tee 1 Instr::Global(GlobalOp::Set, stack_ptr_idx), //global.set 0 Instr::Const(Val::I32(6)), //i32.const 6 @@ -515,7 +516,7 @@ pub fn instrument_with_print_functions(m: &mut Module) { Instr::Drop, //drop Instr::Local(LocalOp::Get, l1), //local.get 1 Instr::Const(Val::I32(16)), //i32.const 16 - Instr::Numeric(NumericOp::I32Add), //i32.add + Instr::Binary(BinaryOp::I32Add), //i32.add Instr::Global(GlobalOp::Set, stack_ptr_idx), //global.set 0, Instr::End, ]); @@ -563,9 +564,9 @@ fn is_stack_alloc(f: &Function, stack_ptr: &Idx) -> bool { ( Instr::Global(GlobalOp::Get, sp1), Instr::Local(LocalOp::Get, _), - Instr::Numeric(NumericOp::I32Sub), + Instr::Binary(BinaryOp::I32Sub), Instr::Const(Val::I32(-16)), - Instr::Numeric(NumericOp::I32And), + Instr::Binary(BinaryOp::I32And), Instr::Local(LocalOp::Tee, l1), Instr::Global(GlobalOp::Set, sp2), Instr::Local(LocalOp::Get, l1_alt), @@ -593,9 +594,9 @@ fn is_stack_restore(f: &Function, stack_ptr: &Idx) -> bool { * Returns None for void functions */ fn get_return_type(f: &Function) -> Option { - if f.type_.results.len() > 0 { + if f.type_.results().len() > 0 { // There can always only be 1 return type. - Some(f.type_.results[0]) + Some(f.type_.results()[0]) } else { None } @@ -619,7 +620,7 @@ fn returns_to_outer_block_jmp(f: &mut Function) { let return_locs = get_return_instr_locs(&instrs); for r_loc in return_locs { - instrs[r_loc.idx] = Instr::Br(Label(r_loc.level as u32)); + instrs[r_loc.idx] = Instr::Br(Label::from(r_loc.level as u32)); } // insert the block wrapper around the function body. From a55614e46932c1dab25714f46d722c87f84779c3 Mon Sep 17 00:00:00 2001 From: Mrmaxmeier Date: Thu, 27 Mar 2025 14:44:18 +0100 Subject: [PATCH 3/6] bump to wasabi 50e1b5 --- wasm_instrumenter/Cargo.lock | 411 +++++----------------------- wasm_instrumenter/Cargo.toml | 2 +- wasm_instrumenter/src/afl_branch.rs | 4 +- wasm_instrumenter/src/canaries.rs | 4 +- wasm_instrumenter/src/shared/mod.rs | 2 +- 5 files changed, 69 insertions(+), 354 deletions(-) diff --git a/wasm_instrumenter/Cargo.lock b/wasm_instrumenter/Cargo.lock index b5531afe6..ee14c86c6 100644 --- a/wasm_instrumenter/Cargo.lock +++ b/wasm_instrumenter/Cargo.lock @@ -4,32 +4,21 @@ version = 4 [[package]] name = "ahash" -version = "0.3.8" +version = "0.8.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8fd72866655d1904d6b0997d0b07ba561047d070fbe29de039031c641b61217" +checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" dependencies = [ - "const-random", -] - -[[package]] -name = "ahash" -version = "0.7.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "891477e0c6a8957309ee5c45a6368af3ae14bb510732d2684ffa19af310920f9" -dependencies = [ - "getrandom 0.2.15", + "cfg-if", "once_cell", "version_check", + "zerocopy 0.7.35", ] [[package]] -name = "aho-corasick" -version = "1.1.3" +name = "allocator-api2" +version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" -dependencies = [ - "memchr", -] +checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" [[package]] name = "ansi_term" @@ -40,31 +29,13 @@ dependencies = [ "winapi", ] -[[package]] -name = "anyhow" -version = "1.0.97" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcfed56ad506cb2c684a14971b8861fdc3baaaae314b9e5f9bb532cbe3ba7a4f" - -[[package]] -name = "arc-interner" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "655ae79d4a7661f2f9a8f6daf95af32897eafdea938df06aeb127cea02b5f4ac" -dependencies = [ - "ahash 0.3.8", - "dashmap", - "once_cell", - "serde", -] - [[package]] name = "atty" version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" dependencies = [ - "hermit-abi 0.1.19", + "hermit-abi", "libc", "winapi", ] @@ -75,15 +46,6 @@ version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" -[[package]] -name = "binary_derive" -version = "0.2.0" -source = "git+https://github.com/danleh/wasabi?rev=ed35db618c67a912dc9218bc4aa03239a1eb6e47#ed35db618c67a912dc9218bc4aa03239a1eb6e47" -dependencies = [ - "quote 0.4.2", - "syn 0.12.15", -] - [[package]] name = "bitflags" version = "1.3.2" @@ -96,12 +58,6 @@ version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5c8214115b7bf84099f1309324e63141d4c5d7cc26862f97a0a857dbefe165bd" -[[package]] -name = "byteorder" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" - [[package]] name = "cfg-if" version = "1.0.0" @@ -123,26 +79,6 @@ dependencies = [ "vec_map", ] -[[package]] -name = "const-random" -version = "0.1.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87e00182fe74b066627d63b85fd550ac2998d4b0bd86bfed477a0ae4c7c71359" -dependencies = [ - "const-random-macro", -] - -[[package]] -name = "const-random-macro" -version = "0.1.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9d839f2a20b0aee515dc581a6172f2321f96cab76c1a38a4c584a194955390e" -dependencies = [ - "getrandom 0.2.15", - "once_cell", - "tiny-keccak", -] - [[package]] name = "crossbeam-deque" version = "0.8.6" @@ -168,43 +104,6 @@ version = "0.8.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" -[[package]] -name = "crunchy" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43da5946c66ffcc7745f48db692ffbb10a83bfe0afd96235c5c2a4fb23994929" - -[[package]] -name = "csv" -version = "1.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acdc4883a9c96732e4733212c01447ebd805833b7275a73ca3ee080fd77afdaf" -dependencies = [ - "csv-core", - "itoa", - "ryu", - "serde", -] - -[[package]] -name = "csv-core" -version = "0.1.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d02f3b0da4c6504f86e9cd789d8dbafab48c2321be74e9987593de5a894d93d" -dependencies = [ - "memchr", -] - -[[package]] -name = "dashmap" -version = "4.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e77a43b28d0668df09411cb0bc9a8c2adc40f9a048afe863e05fd43251e8e39c" -dependencies = [ - "cfg-if", - "num_cpus", -] - [[package]] name = "either" version = "1.15.0" @@ -296,27 +195,23 @@ checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" dependencies = [ "cfg-if", "libc", - "wasi 0.9.0+wasi-snapshot-preview1", + "wasi", ] [[package]] -name = "getrandom" -version = "0.2.15" +name = "hashbrown" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" -dependencies = [ - "cfg-if", - "libc", - "wasi 0.11.0+wasi-snapshot-preview1", -] +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" [[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" dependencies = [ - "ahash 0.7.8", + "ahash", + "allocator-api2", ] [[package]] @@ -328,12 +223,6 @@ dependencies = [ "libc", ] -[[package]] -name = "hermit-abi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" - [[package]] name = "indexmap" version = "1.9.3" @@ -341,31 +230,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" dependencies = [ "autocfg", - "hashbrown", + "hashbrown 0.12.3", ] [[package]] name = "internment" -version = "0.6.0" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73bd1419c48e9f496d5830cc2f7fff35cab112193f289fd7266ab0679bb97237" +checksum = "04e8e537b529b8674e97e9fb82c10ff168a290ac3867a0295f112061ffbca1ef" dependencies = [ - "hashbrown", + "hashbrown 0.14.5", "parking_lot", ] -[[package]] -name = "itoa" -version = "1.0.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" - -[[package]] -name = "lazy_static" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" - [[package]] name = "leb128" version = "0.2.5" @@ -406,22 +283,6 @@ version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" -[[package]] -name = "minimal-lexical" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" - -[[package]] -name = "nom" -version = "7.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" -dependencies = [ - "memchr", - "minimal-lexical", -] - [[package]] name = "num-traits" version = "0.2.19" @@ -432,16 +293,6 @@ dependencies = [ "libm", ] -[[package]] -name = "num_cpus" -version = "1.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" -dependencies = [ - "hermit-abi 0.3.9", - "libc", -] - [[package]] name = "once_cell" version = "1.21.1" @@ -450,9 +301,9 @@ checksum = "d75b0bedcc4fe52caa0e03d9f1151a323e4aa5e2d78ba3580400cd3c9e2bc4bc" [[package]] name = "ordered-float" -version = "1.1.1" +version = "3.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3305af35278dd29f46fcdd139e0b1fbfae2153f0e5928b39b035542dd31e37b7" +checksum = "f1e1c390732d15f1d48471625cd92d154e66db2c56645e29a9cd26f4699f72dc" dependencies = [ "num-traits", ] @@ -498,16 +349,7 @@ version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" dependencies = [ - "zerocopy", -] - -[[package]] -name = "proc-macro2" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd07deb3c6d1d9ff827999c7f9b04cdfd66b1b17ae508e14fe47b620f2282ae0" -dependencies = [ - "unicode-xid", + "zerocopy 0.8.24", ] [[package]] @@ -519,22 +361,13 @@ dependencies = [ "unicode-ident", ] -[[package]] -name = "quote" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1eca14c727ad12702eb4b6bfb5a232287dcf8385cb8ca83a3eeaf6519c44c408" -dependencies = [ - "proc-macro2 0.2.3", -] - [[package]] name = "quote" version = "1.0.40" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d" dependencies = [ - "proc-macro2 1.0.94", + "proc-macro2", ] [[package]] @@ -543,7 +376,7 @@ version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" dependencies = [ - "getrandom 0.1.16", + "getrandom", "libc", "rand_chacha", "rand_core", @@ -566,7 +399,7 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" dependencies = [ - "getrandom 0.1.16", + "getrandom", ] [[package]] @@ -617,56 +450,6 @@ dependencies = [ "bitflags 2.9.0", ] -[[package]] -name = "regex" -version = "1.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" -dependencies = [ - "aho-corasick", - "memchr", - "regex-automata", - "regex-syntax", -] - -[[package]] -name = "regex-automata" -version = "0.4.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" -dependencies = [ - "aho-corasick", - "memchr", - "regex-syntax", -] - -[[package]] -name = "regex-syntax" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" - -[[package]] -name = "rustc-hash" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" - -[[package]] -name = "ryu" -version = "1.0.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" - -[[package]] -name = "same-file" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" -dependencies = [ - "winapi-util", -] - [[package]] name = "scc" version = "2.3.3" @@ -703,9 +486,9 @@ version = "1.0.219" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" dependencies = [ - "proc-macro2 1.0.94", - "quote 1.0.40", - "syn 2.0.100", + "proc-macro2", + "quote", + "syn", ] [[package]] @@ -728,9 +511,9 @@ version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5d69265a08751de7844521fd15003ae0a888e035773ba05695c5c759a6f89eef" dependencies = [ - "proc-macro2 1.0.94", - "quote 1.0.40", - "syn 2.0.100", + "proc-macro2", + "quote", + "syn", ] [[package]] @@ -754,36 +537,17 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" -[[package]] -name = "syn" -version = "0.12.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c97c05b8ebc34ddd6b967994d5c6e9852fa92f8b82b3858c39451f97346dcce5" -dependencies = [ - "proc-macro2 0.2.3", - "quote 0.4.2", - "unicode-xid", -] - [[package]] name = "syn" version = "2.0.100" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b09a44accad81e1ba1cd74a32461ba89dee89095ba17b32f5d03683b1b1fc2a0" dependencies = [ - "proc-macro2 1.0.94", - "quote 1.0.40", + "proc-macro2", + "quote", "unicode-ident", ] -[[package]] -name = "test_utilities" -version = "0.1.0" -source = "git+https://github.com/danleh/wasabi?rev=ed35db618c67a912dc9218bc4aa03239a1eb6e47#ed35db618c67a912dc9218bc4aa03239a1eb6e47" -dependencies = [ - "walkdir", -] - [[package]] name = "textwrap" version = "0.11.0" @@ -808,18 +572,9 @@ version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" dependencies = [ - "proc-macro2 1.0.94", - "quote 1.0.40", - "syn 2.0.100", -] - -[[package]] -name = "tiny-keccak" -version = "2.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237" -dependencies = [ - "crunchy", + "proc-macro2", + "quote", + "syn", ] [[package]] @@ -834,12 +589,6 @@ version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" -[[package]] -name = "unicode-xid" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" - [[package]] name = "vec_map" version = "0.8.2" @@ -852,58 +601,22 @@ version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" -[[package]] -name = "walkdir" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" -dependencies = [ - "same-file", - "winapi-util", -] - -[[package]] -name = "wasabi_leb128" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ef95b2fc26dab4b706f4763b297aa7277a1660e83450fa39e6832e64aeeb637" -dependencies = [ - "num-traits", -] - [[package]] name = "wasi" version = "0.9.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" -[[package]] -name = "wasi" -version = "0.11.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" - [[package]] name = "wasm" -version = "0.5.0" -source = "git+https://github.com/danleh/wasabi?rev=ed35db618c67a912dc9218bc4aa03239a1eb6e47#ed35db618c67a912dc9218bc4aa03239a1eb6e47" +version = "0.6.0" +source = "git+https://github.com/danleh/wasabi?rev=50e1b5ea1b3de0555315db143ab16d88ff96ea20#50e1b5ea1b3de0555315db143ab16d88ff96ea20" dependencies = [ - "anyhow", - "arc-interner", - "binary_derive", - "byteorder", - "csv", "internment", - "lazy_static", - "nom", "ordered-float", "rayon", - "regex", - "rustc-hash", "serde", - "test_utilities", "thiserror", - "wasabi_leb128", "wasm-encoder", "wasmparser", ] @@ -953,30 +666,12 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" -[[package]] -name = "winapi-util" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" -dependencies = [ - "windows-sys", -] - [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" -[[package]] -name = "windows-sys" -version = "0.59.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" -dependencies = [ - "windows-targets", -] - [[package]] name = "windows-targets" version = "0.52.6" @@ -1041,13 +736,33 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" +[[package]] +name = "zerocopy" +version = "0.7.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" +dependencies = [ + "zerocopy-derive 0.7.35", +] + [[package]] name = "zerocopy" version = "0.8.24" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2586fea28e186957ef732a5f8b3be2da217d65c5969d4b1e17f973ebbe876879" dependencies = [ - "zerocopy-derive", + "zerocopy-derive 0.8.24", +] + +[[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", ] [[package]] @@ -1056,7 +771,7 @@ version = "0.8.24" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a996a8f63c5c4448cd959ac1bab0aaa3306ccfd060472f85943ee0750f0169be" dependencies = [ - "proc-macro2 1.0.94", - "quote 1.0.40", - "syn 2.0.100", + "proc-macro2", + "quote", + "syn", ] diff --git a/wasm_instrumenter/Cargo.toml b/wasm_instrumenter/Cargo.toml index e57c16413..9dfcfd68d 100644 --- a/wasm_instrumenter/Cargo.toml +++ b/wasm_instrumenter/Cargo.toml @@ -7,7 +7,7 @@ edition = "2018" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -wasm = { git = "https://github.com/danleh/wasabi", rev="ed35db618c67a912dc9218bc4aa03239a1eb6e47" } +wasm = { git = "https://github.com/danleh/wasabi", rev = "50e1b5ea1b3de0555315db143ab16d88ff96ea20" } rand = "0.7.3" rand_distr = "0.3.0" clap = "2.33.3" diff --git a/wasm_instrumenter/src/afl_branch.rs b/wasm_instrumenter/src/afl_branch.rs index ed54bdf1c..404e6a5eb 100644 --- a/wasm_instrumenter/src/afl_branch.rs +++ b/wasm_instrumenter/src/afl_branch.rs @@ -3,7 +3,7 @@ use rand::distributions::{Distribution, Uniform}; use rand::rngs::ThreadRng; use std::error::Error; use std::ffi::OsStr; -use wasm::highlevel::{ +use wasm::{ BinaryOp, FunctionType, Global, GlobalOp, ImportOrPresent, Instr, LoadOp, Local, LocalOp, Module, StoreOp, }; @@ -330,7 +330,7 @@ impl ShimCreator { } pub fn instrument_file(input_file: &OsStr, output_file: &OsStr) -> Result<(), Box> { - let mut module = Module::from_file(&input_file)?; + let mut module = Module::from_file(&input_file)?.0; self::instrument_with_afl_branch_coverage(&mut module); println!("trace_bits size {}", MAP_SIZE); diff --git a/wasm_instrumenter/src/canaries.rs b/wasm_instrumenter/src/canaries.rs index 9b18592b4..c751fe366 100644 --- a/wasm_instrumenter/src/canaries.rs +++ b/wasm_instrumenter/src/canaries.rs @@ -2,7 +2,7 @@ use crate::shared::{find_func_by_name, get_param_n_idx, insert_postfix, insert_p use rand::distributions::{Distribution, Uniform}; use std::error::Error; use std::ffi::OsStr; -use wasm::highlevel::{ +use wasm::{ BinaryOp, Function, FunctionType, Global, GlobalOp, Instr, LoadOp, Local, LocalOp, Module, StoreOp, UnaryOp, }; @@ -15,7 +15,7 @@ pub fn instrument_file( skip_stack: bool, skip_print: bool, ) -> Result<(), Box> { - let mut module = Module::from_file(&input_file)?; + let mut module = Module::from_file(&input_file)?.0; if !skip_heap { self::instrument_with_heap_canary_check(&mut module); diff --git a/wasm_instrumenter/src/shared/mod.rs b/wasm_instrumenter/src/shared/mod.rs index a0b630afe..cc8ec3472 100644 --- a/wasm_instrumenter/src/shared/mod.rs +++ b/wasm_instrumenter/src/shared/mod.rs @@ -1,5 +1,5 @@ -use wasm::highlevel::{Function, Instr, Local}; use wasm::Idx; +use wasm::{Function, Instr, Local}; pub fn find_func_by_name<'a>( name: &str, From 9d40b2064b07663d2bd7419f5dff08664d9d3a2a Mon Sep 17 00:00:00 2001 From: Mrmaxmeier Date: Thu, 27 Mar 2025 14:44:19 +0100 Subject: [PATCH 4/6] bump to wasabi d83e32 --- wasm_instrumenter/Cargo.lock | 18 +++++++++--------- wasm_instrumenter/Cargo.toml | 2 +- wasm_instrumenter/src/afl_branch.rs | 4 ++-- wasm_instrumenter/src/canaries.rs | 4 ++-- wasm_instrumenter/src/shared/mod.rs | 3 +-- 5 files changed, 15 insertions(+), 16 deletions(-) diff --git a/wasm_instrumenter/Cargo.lock b/wasm_instrumenter/Cargo.lock index ee14c86c6..14b0eab4b 100644 --- a/wasm_instrumenter/Cargo.lock +++ b/wasm_instrumenter/Cargo.lock @@ -602,15 +602,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" [[package]] -name = "wasi" -version = "0.9.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" - -[[package]] -name = "wasm" +name = "wasabi_wasm" version = "0.6.0" -source = "git+https://github.com/danleh/wasabi?rev=50e1b5ea1b3de0555315db143ab16d88ff96ea20#50e1b5ea1b3de0555315db143ab16d88ff96ea20" +source = "git+https://github.com/danleh/wasabi?rev=d83e3211774b7476e519995d750b853a93e930cb#d83e3211774b7476e519995d750b853a93e930cb" dependencies = [ "internment", "ordered-float", @@ -621,6 +615,12 @@ dependencies = [ "wasmparser", ] +[[package]] +name = "wasi" +version = "0.9.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" + [[package]] name = "wasm-encoder" version = "0.17.0" @@ -638,7 +638,7 @@ dependencies = [ "rand", "rand_distr", "serial_test", - "wasm", + "wasabi_wasm", ] [[package]] diff --git a/wasm_instrumenter/Cargo.toml b/wasm_instrumenter/Cargo.toml index 9dfcfd68d..597711328 100644 --- a/wasm_instrumenter/Cargo.toml +++ b/wasm_instrumenter/Cargo.toml @@ -7,7 +7,7 @@ edition = "2018" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -wasm = { git = "https://github.com/danleh/wasabi", rev = "50e1b5ea1b3de0555315db143ab16d88ff96ea20" } +wasabi_wasm = { git = "https://github.com/danleh/wasabi", rev = "d83e3211774b7476e519995d750b853a93e930cb" } rand = "0.7.3" rand_distr = "0.3.0" clap = "2.33.3" diff --git a/wasm_instrumenter/src/afl_branch.rs b/wasm_instrumenter/src/afl_branch.rs index 404e6a5eb..abf1518a1 100644 --- a/wasm_instrumenter/src/afl_branch.rs +++ b/wasm_instrumenter/src/afl_branch.rs @@ -3,11 +3,11 @@ use rand::distributions::{Distribution, Uniform}; use rand::rngs::ThreadRng; use std::error::Error; use std::ffi::OsStr; -use wasm::{ +use wasabi_wasm::{ BinaryOp, FunctionType, Global, GlobalOp, ImportOrPresent, Instr, LoadOp, Local, LocalOp, Module, StoreOp, }; -use wasm::{Idx, Memarg, Mutability, Val, ValType}; +use wasabi_wasm::{Idx, Memarg, Mutability, Val, ValType}; /// must be kept up-to-date with the AFL implementation const MAP_SIZE_POW2: u32 = 16; diff --git a/wasm_instrumenter/src/canaries.rs b/wasm_instrumenter/src/canaries.rs index c751fe366..077d1b6f6 100644 --- a/wasm_instrumenter/src/canaries.rs +++ b/wasm_instrumenter/src/canaries.rs @@ -2,11 +2,11 @@ use crate::shared::{find_func_by_name, get_param_n_idx, insert_postfix, insert_p use rand::distributions::{Distribution, Uniform}; use std::error::Error; use std::ffi::OsStr; -use wasm::{ +use wasabi_wasm::{ BinaryOp, Function, FunctionType, Global, GlobalOp, Instr, LoadOp, Local, LocalOp, Module, StoreOp, UnaryOp, }; -use wasm::{BlockType, Idx, Label, Memarg, Mutability, Val, ValType}; +use wasabi_wasm::{BlockType, Idx, Label, Memarg, Mutability, Val, ValType}; pub fn instrument_file( input_file: &OsStr, diff --git a/wasm_instrumenter/src/shared/mod.rs b/wasm_instrumenter/src/shared/mod.rs index cc8ec3472..449049465 100644 --- a/wasm_instrumenter/src/shared/mod.rs +++ b/wasm_instrumenter/src/shared/mod.rs @@ -1,5 +1,4 @@ -use wasm::Idx; -use wasm::{Function, Instr, Local}; +use wasabi_wasm::{Function, Idx, Instr, Local}; pub fn find_func_by_name<'a>( name: &str, From c8562db29dfa5521646930ce24ab8926e02a8216 Mon Sep 17 00:00:00 2001 From: Mrmaxmeier Date: Thu, 27 Mar 2025 14:44:20 +0100 Subject: [PATCH 5/6] bump to wasabi bf7ea8 --- wasm_instrumenter/Cargo.lock | 408 +++++++++++++++++++++++++----- wasm_instrumenter/Cargo.toml | 2 +- wasm_instrumenter/src/canaries.rs | 22 +- 3 files changed, 360 insertions(+), 72 deletions(-) diff --git a/wasm_instrumenter/Cargo.lock b/wasm_instrumenter/Cargo.lock index 14b0eab4b..d64014518 100644 --- a/wasm_instrumenter/Cargo.lock +++ b/wasm_instrumenter/Cargo.lock @@ -2,24 +2,6 @@ # It is not intended for manual editing. version = 4 -[[package]] -name = "ahash" -version = "0.8.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" -dependencies = [ - "cfg-if", - "once_cell", - "version_check", - "zerocopy 0.7.35", -] - -[[package]] -name = "allocator-api2" -version = "0.2.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" - [[package]] name = "ansi_term" version = "0.12.1" @@ -58,6 +40,15 @@ version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5c8214115b7bf84099f1309324e63141d4c5d7cc26862f97a0a857dbefe165bd" +[[package]] +name = "cc" +version = "1.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fcb57c740ae1daf453ae85f16e37396f672b039e00d9d866e07ddb24e328e3a" +dependencies = [ + "shlex", +] + [[package]] name = "cfg-if" version = "1.0.0" @@ -104,12 +95,32 @@ version = "0.8.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" +[[package]] +name = "displaydoc" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "either" version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" +[[package]] +name = "form_urlencoded" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" +dependencies = [ + "percent-encoding", +] + [[package]] name = "futures" version = "0.3.31" @@ -205,42 +216,161 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" [[package]] -name = "hashbrown" -version = "0.14.5" +name = "hermit-abi" +version = "0.1.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" +checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" dependencies = [ - "ahash", - "allocator-api2", + "libc", ] [[package]] -name = "hermit-abi" -version = "0.1.19" +name = "icu_collections" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" +checksum = "db2fa452206ebee18c4b5c2274dbf1de17008e874b4dc4f0aea9d01ca79e4526" dependencies = [ - "libc", + "displaydoc", + "yoke", + "zerofrom", + "zerovec", ] [[package]] -name = "indexmap" -version = "1.9.3" +name = "icu_locid" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" +checksum = "13acbb8371917fc971be86fc8057c41a64b521c184808a698c02acc242dbf637" dependencies = [ - "autocfg", - "hashbrown 0.12.3", + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", ] [[package]] -name = "internment" -version = "0.7.5" +name = "icu_locid_transform" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04e8e537b529b8674e97e9fb82c10ff168a290ac3867a0295f112061ffbca1ef" +checksum = "01d11ac35de8e40fdeda00d9e1e9d92525f3f9d887cdd7aa81d727596788b54e" dependencies = [ - "hashbrown 0.14.5", - "parking_lot", + "displaydoc", + "icu_locid", + "icu_locid_transform_data", + "icu_provider", + "tinystr", + "zerovec", +] + +[[package]] +name = "icu_locid_transform_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fdc8ff3388f852bede6b579ad4e978ab004f139284d7b28715f773507b946f6e" + +[[package]] +name = "icu_normalizer" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19ce3e0da2ec68599d193c93d088142efd7f9c5d6fc9b803774855747dc6a84f" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "utf16_iter", + "utf8_iter", + "write16", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8cafbf7aa791e9b22bec55a167906f9e1215fd475cd22adfcf660e03e989516" + +[[package]] +name = "icu_properties" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93d6020766cfc6302c15dbbc9c8778c37e62c14427cb7f6e601d849e092aeef5" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_locid_transform", + "icu_properties_data", + "icu_provider", + "tinystr", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67a8effbc3dd3e4ba1afa8ad918d5684b8868b3b26500753effea8d2eed19569" + +[[package]] +name = "icu_provider" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ed421c8a8ef78d3e2dbc98a973be2f3770cb42b606e3ab18d6237c4dfde68d9" +dependencies = [ + "displaydoc", + "icu_locid", + "icu_provider_macros", + "stable_deref_trait", + "tinystr", + "writeable", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_provider_macros" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "idna" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "686f825264d630750a544639377bae737628043f20d38bbc029e8f29ea968a7e" +dependencies = [ + "idna_adapter", + "smallvec", + "utf8_iter", +] + +[[package]] +name = "idna_adapter" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "daca1df1c957320b2cf139ac61e7bd64fed304c5040df000a745aa1de3b4ef71" +dependencies = [ + "icu_normalizer", + "icu_properties", +] + +[[package]] +name = "indexmap" +version = "1.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" +dependencies = [ + "autocfg", + "hashbrown", ] [[package]] @@ -261,6 +391,22 @@ version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8355be11b20d696c8f18f6cc018c4e372165b1fa8126cef092399c9951984ffa" +[[package]] +name = "libmimalloc-sys" +version = "0.1.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07d0e07885d6a754b9c7993f2625187ad694ee985d60f23355ff0e7077261502" +dependencies = [ + "cc", + "libc", +] + +[[package]] +name = "litemap" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23fb14cb19457329c82206317a5663005a4d404783dc74f4252769b0d5f42856" + [[package]] name = "lock_api" version = "0.4.12" @@ -283,6 +429,21 @@ version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" +[[package]] +name = "mimalloc" +version = "0.1.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99585191385958383e13f6b822e6b6d8d9cf928e7d286ceb092da92b43c87bc1" +dependencies = [ + "libmimalloc-sys", +] + +[[package]] +name = "nohash-hasher" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bf50223579dc7cdcfb3bfcacf7069ff68243f8c363f62ffa99cf000a6b9c451" + [[package]] name = "num-traits" version = "0.2.19" @@ -331,6 +492,12 @@ dependencies = [ "windows-targets", ] +[[package]] +name = "percent-encoding" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" + [[package]] name = "pin-project-lite" version = "0.2.16" @@ -349,7 +516,7 @@ version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" dependencies = [ - "zerocopy 0.8.24", + "zerocopy", ] [[package]] @@ -450,6 +617,12 @@ dependencies = [ "bitflags 2.9.0", ] +[[package]] +name = "rustc-hash" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" + [[package]] name = "scc" version = "2.3.3" @@ -516,6 +689,12 @@ dependencies = [ "syn", ] +[[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.9" @@ -531,6 +710,12 @@ version = "1.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7fcf8323ef1faaee30a44a340193b1ac6814fd9b7b4e88e9d4519a3e4abe1cfd" +[[package]] +name = "stable_deref_trait" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" + [[package]] name = "strsim" version = "0.8.0" @@ -548,6 +733,17 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "synstructure" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "textwrap" version = "0.11.0" @@ -577,6 +773,16 @@ dependencies = [ "syn", ] +[[package]] +name = "tinystr" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9117f5d4db391c1cf6927e7bea3db74b9a1c1add8f7eda9ffd5364f40f57b82f" +dependencies = [ + "displaydoc", + "zerovec", +] + [[package]] name = "unicode-ident" version = "1.0.18" @@ -590,25 +796,45 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" [[package]] -name = "vec_map" -version = "0.8.2" +name = "url" +version = "2.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" +checksum = "32f8b686cadd1473f4bd0117a5d28d36b1ade384ea9b5069a1c40aefed7fda60" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", +] + +[[package]] +name = "utf16_iter" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8232dd3cdaed5356e0f716d285e4b40b932ac434100fe9b7e0e8e935b9e6246" [[package]] -name = "version_check" -version = "0.9.5" +name = "utf8_iter" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" +checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" + +[[package]] +name = "vec_map" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" [[package]] name = "wasabi_wasm" -version = "0.6.0" -source = "git+https://github.com/danleh/wasabi?rev=d83e3211774b7476e519995d750b853a93e930cb#d83e3211774b7476e519995d750b853a93e930cb" +version = "0.7.0" +source = "git+https://github.com/danleh/wasabi?rev=bf7ea80e5f74b063e038add84e5fb06b4e49b4d1#bf7ea80e5f74b063e038add84e5fb06b4e49b4d1" dependencies = [ - "internment", + "mimalloc", + "nohash-hasher", + "once_cell", "ordered-float", "rayon", + "rustc-hash", "serde", "thiserror", "wasm-encoder", @@ -623,9 +849,9 @@ checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" [[package]] name = "wasm-encoder" -version = "0.17.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e7ca71c70a6de5b10968ae4d298e548366d9cd9588176e6ff8866f3c49c96ee" +checksum = "05632e0a66a6ed8cca593c24223aabd6262f256c3693ad9822c315285f010614" dependencies = [ "leb128", ] @@ -643,11 +869,12 @@ dependencies = [ [[package]] name = "wasmparser" -version = "0.91.0" +version = "0.96.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "239cdca8b8f356af8118c522d5fea23da45b60832ed4e18ef90bb3c9d8dce24a" +checksum = "adde01ade41ab9a5d10ec8ed0bb954238cf8625b5cd5a13093d6de2ad9c2be1a" dependencies = [ "indexmap", + "url", ] [[package]] @@ -737,12 +964,39 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] -name = "zerocopy" -version = "0.7.35" +name = "write16" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1890f4022759daae28ed4fe62859b1236caebfc61ede2f63ed4e695f3f6d936" + +[[package]] +name = "writeable" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" +checksum = "1e9df38ee2d2c3c5948ea468a8406ff0db0b29ae1ffde1bcf20ef305bcc95c51" + +[[package]] +name = "yoke" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "120e6aef9aa629e3d4f52dc8cc43a015c7724194c97dfaf45180d2daf2b77f40" +dependencies = [ + "serde", + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2380878cad4ac9aac1e2435f3eb4020e8374b5f13c296cb75b4620ff8e229154" dependencies = [ - "zerocopy-derive 0.7.35", + "proc-macro2", + "quote", + "syn", + "synstructure", ] [[package]] @@ -751,14 +1005,14 @@ version = "0.8.24" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2586fea28e186957ef732a5f8b3be2da217d65c5969d4b1e17f973ebbe876879" dependencies = [ - "zerocopy-derive 0.8.24", + "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.7.35" +version = "0.8.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" +checksum = "a996a8f63c5c4448cd959ac1bab0aaa3306ccfd060472f85943ee0750f0169be" dependencies = [ "proc-macro2", "quote", @@ -766,10 +1020,42 @@ dependencies = [ ] [[package]] -name = "zerocopy-derive" -version = "0.8.24" +name = "zerofrom" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a996a8f63c5c4448cd959ac1bab0aaa3306ccfd060472f85943ee0750f0169be" +checksum = "50cc42e0333e05660c3587f3bf9d0478688e15d870fab3346451ce7f8c9fbea5" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] + +[[package]] +name = "zerovec" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa2b893d79df23bfb12d5461018d408ea19dfafe76c2c7ef6d4eba614f8ff079" +dependencies = [ + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6eafa6dfb17584ea3e2bd6e76e0cc15ad7af12b09abdd1ca55961bed9b1063c6" dependencies = [ "proc-macro2", "quote", diff --git a/wasm_instrumenter/Cargo.toml b/wasm_instrumenter/Cargo.toml index 597711328..00b3aa6e7 100644 --- a/wasm_instrumenter/Cargo.toml +++ b/wasm_instrumenter/Cargo.toml @@ -7,7 +7,7 @@ edition = "2018" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -wasabi_wasm = { git = "https://github.com/danleh/wasabi", rev = "d83e3211774b7476e519995d750b853a93e930cb" } +wasabi_wasm = { git = "https://github.com/danleh/wasabi", rev = "bf7ea80e5f74b063e038add84e5fb06b4e49b4d1" } rand = "0.7.3" rand_distr = "0.3.0" clap = "2.33.3" diff --git a/wasm_instrumenter/src/canaries.rs b/wasm_instrumenter/src/canaries.rs index 077d1b6f6..e81d316c8 100644 --- a/wasm_instrumenter/src/canaries.rs +++ b/wasm_instrumenter/src/canaries.rs @@ -6,7 +6,7 @@ use wasabi_wasm::{ BinaryOp, Function, FunctionType, Global, GlobalOp, Instr, LoadOp, Local, LocalOp, Module, StoreOp, UnaryOp, }; -use wasabi_wasm::{BlockType, Idx, Label, Memarg, Mutability, Val, ValType}; +use wasabi_wasm::{Idx, Label, Memarg, Mutability, Val, ValType}; pub fn instrument_file( input_file: &OsStr, @@ -79,7 +79,7 @@ pub fn instrument_with_heap_canary_check(m: &mut Module) { // resulting in canaries being placed unnecessarily far apart. vec![ // check if canary insertion is disabled - Instr::Block(BlockType(None)), + Instr::Block(FunctionType::empty()), Instr::Global(GlobalOp::Get, disable_canary_insertion_in_malloc), Instr::Const(Val::I32(1)), Instr::Binary(BinaryOp::I32Eq), @@ -105,7 +105,7 @@ pub fn instrument_with_heap_canary_check(m: &mut Module) { let tmp_result_local = func.add_fresh_local(ValType::I32); let mut postfix = vec![ Instr::Local(LocalOp::Set, tmp_result_local), - Instr::Block(BlockType(Some(ValType::I32))), + Instr::Block(FunctionType::new(&[], &[ValType::I32])), // if result is NULL, then don't attempt to insert canaries. Instr::Local(LocalOp::Get, tmp_result_local), Instr::Local(LocalOp::Get, tmp_result_local), @@ -185,18 +185,18 @@ pub fn instrument_with_heap_canary_check(m: &mut Module) { ) -> Vec { vec![ // if disable_canary_glob then skip the checks - Instr::Block(BlockType(None)), + Instr::Block(FunctionType::empty()), Instr::Global(GlobalOp::Get, disable_canary_glob), Instr::Const(Val::I32(1)), Instr::Binary(BinaryOp::I32Eq), Instr::BrIf(Label::from(0u32)), // if ptr == NULL, then skip the canary checks - Instr::Block(BlockType(None)), + Instr::Block(FunctionType::empty()), Instr::Local(LocalOp::Get, chunk_data_ptr), Instr::Unary(UnaryOp::I32Eqz), Instr::BrIf(Label::from(0u32)), // block to check first canary - Instr::Block(BlockType(None)), + Instr::Block(FunctionType::empty()), // decrease ptr by 12 Instr::Local(LocalOp::Get, chunk_data_ptr), Instr::Const(Val::I32(12)), @@ -219,7 +219,7 @@ pub fn instrument_with_heap_canary_check(m: &mut Module) { Instr::Unreachable, Instr::End, // block to check the second canary - Instr::Block(BlockType(None)), + Instr::Block(FunctionType::empty()), // fetch the size of the chunk Instr::Local(LocalOp::Get, chunk_data_ptr), Instr::Load( @@ -329,7 +329,7 @@ pub fn instrument_with_heap_canary_check(m: &mut Module) { Instr::Binary(BinaryOp::I64Mul), Instr::Const(Val::I64(0xFFFFFFFF)), Instr::Binary(BinaryOp::I64GeU), - Instr::If(BlockType(None)), + Instr::If(FunctionType::empty()), Instr::Const(Val::I32(1)), Instr::Local(LocalOp::Set, calloc_overflow), Instr::Else, @@ -432,7 +432,7 @@ pub fn instrument_with_stack_canary_check(m: &mut Module) { // create canary check instructions post_fix.append(&mut vec![ - Instr::Block(BlockType(None)), + Instr::Block(FunctionType::empty()), Instr::Global(GlobalOp::Get, stack_ptr_idx), Instr::Load( LoadOp::I64Load, @@ -624,7 +624,9 @@ fn returns_to_outer_block_jmp(f: &mut Function) { } // insert the block wrapper around the function body. - instrs.insert(0, Instr::Block(BlockType(return_type))); + let block_type = + return_type.map_or(FunctionType::empty(), |t| FunctionType::new(&[], &[t])); + instrs.insert(0, Instr::Block(block_type)); instrs.push(Instr::End); } } From 30d75154f035a4aa18daf80d6ff3fd2a1767ad22 Mon Sep 17 00:00:00 2001 From: Mrmaxmeier Date: Thu, 27 Mar 2025 14:44:21 +0100 Subject: [PATCH 6/6] bump to wasabi 21a322 (current main) --- wasm_instrumenter/Cargo.lock | 3 ++- wasm_instrumenter/Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/wasm_instrumenter/Cargo.lock b/wasm_instrumenter/Cargo.lock index d64014518..ccd7a32a9 100644 --- a/wasm_instrumenter/Cargo.lock +++ b/wasm_instrumenter/Cargo.lock @@ -827,7 +827,7 @@ checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" [[package]] name = "wasabi_wasm" version = "0.7.0" -source = "git+https://github.com/danleh/wasabi?rev=bf7ea80e5f74b063e038add84e5fb06b4e49b4d1#bf7ea80e5f74b063e038add84e5fb06b4e49b4d1" +source = "git+https://github.com/danleh/wasabi?rev=21a322b7faac9440b931762aae124ffa57d0fa17#21a322b7faac9440b931762aae124ffa57d0fa17" dependencies = [ "mimalloc", "nohash-hasher", @@ -836,6 +836,7 @@ dependencies = [ "rayon", "rustc-hash", "serde", + "smallvec", "thiserror", "wasm-encoder", "wasmparser", diff --git a/wasm_instrumenter/Cargo.toml b/wasm_instrumenter/Cargo.toml index 00b3aa6e7..2334f525f 100644 --- a/wasm_instrumenter/Cargo.toml +++ b/wasm_instrumenter/Cargo.toml @@ -7,7 +7,7 @@ edition = "2018" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -wasabi_wasm = { git = "https://github.com/danleh/wasabi", rev = "bf7ea80e5f74b063e038add84e5fb06b4e49b4d1" } +wasabi_wasm = { git = "https://github.com/danleh/wasabi", rev = "21a322b7faac9440b931762aae124ffa57d0fa17" } rand = "0.7.3" rand_distr = "0.3.0" clap = "2.33.3"