diff --git a/wasm_instrumenter/Cargo.lock b/wasm_instrumenter/Cargo.lock index 3eb5313c9..ccd7a32a9 100644 --- a/wasm_instrumenter/Cargo.lock +++ b/wasm_instrumenter/Cargo.lock @@ -1,10 +1,12 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. +version = 4 + [[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", ] @@ -22,46 +24,46 @@ dependencies = [ [[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" -dependencies = [ - "quote 0.4.2", - "syn 0.12.15", -] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "1.2.1" +version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" +checksum = "5c8214115b7bf84099f1309324e63141d4c5d7cc26862f97a0a857dbefe165bd" [[package]] -name = "byteorder" -version = "1.3.4" +name = "cc" +version = "1.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de" +checksum = "1fcb57c740ae1daf453ae85f16e37396f672b039e00d9d866e07ddb24e328e3a" +dependencies = [ + "shlex", +] [[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,163 +71,409 @@ dependencies = [ ] [[package]] -name = "cloudabi" -version = "0.0.3" +name = "crossbeam-deque" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" +checksum = "9dd111b7b7f7d55b72c0a6ae361660ee5853c9af73f70c3c2ef6858b950e2e51" dependencies = [ - "bitflags", + "crossbeam-epoch", + "crossbeam-utils", ] [[package]] -name = "crossbeam-channel" -version = "0.4.4" +name = "crossbeam-epoch" +version = "0.9.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b153fe7cbef478c567df0f972e02e6d736db11affe43dfc9c56a9374d1adfb87" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" dependencies = [ "crossbeam-utils", - "maybe-uninit", ] [[package]] -name = "crossbeam-deque" -version = "0.7.3" +name = "crossbeam-utils" +version = "0.8.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f02af974daeee82218205558e51ec8768b48cf524bd01d550abe5573a608285" +checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" + +[[package]] +name = "displaydoc" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" dependencies = [ - "crossbeam-epoch", - "crossbeam-utils", - "maybe-uninit", + "proc-macro2", + "quote", + "syn", ] [[package]] -name = "crossbeam-epoch" -version = "0.8.2" +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 = "058ed274caafc1f60c4997b5fc07bf7dc7cca454af7c6e81edffe5f33f70dace" +checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" dependencies = [ - "autocfg", - "cfg-if", - "crossbeam-utils", - "lazy_static", - "maybe-uninit", - "memoffset", - "scopeguard", + "percent-encoding", ] [[package]] -name = "crossbeam-utils" -version = "0.7.2" +name = "futures" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3c7c73a2d1e9fc0886a08b93e98eb643461230d5f1925e4036204d5f2e261a8" +checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876" dependencies = [ - "autocfg", - "cfg-if", - "lazy_static", + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", ] [[package]] -name = "either" -version = "1.6.1" +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 = "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 = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" +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.15" +version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc587bc0ec293155d5bfa6b9891ec18a1e330c234f896ea47fbada4cadbe47e6" +checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" dependencies = [ "cfg-if", "libc", "wasi", ] +[[package]] +name = "hashbrown" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" + [[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 = "lazy_static" -version = "1.4.0" +name = "icu_collections" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db2fa452206ebee18c4b5c2274dbf1de17008e874b4dc4f0aea9d01ca79e4526" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_locid" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13acbb8371917fc971be86fc8057c41a64b521c184808a698c02acc242dbf637" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_locid_transform" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" +checksum = "01d11ac35de8e40fdeda00d9e1e9d92525f3f9d887cdd7aa81d727596788b54e" +dependencies = [ + "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]] +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 = "8355be11b20d696c8f18f6cc018c4e372165b1fa8126cef092399c9951984ffa" + +[[package]] +name = "libmimalloc-sys" +version = "0.1.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7d73b3f436185384286bd8098d17ec07c9a7d2388a6599f824d8502b529702a" +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.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 = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94" + +[[package]] +name = "memchr" +version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" [[package]] -name = "memoffset" -version = "0.5.6" +name = "mimalloc" +version = "0.1.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "043175f069eda7b85febe4a74abbaeff828d9f8b448515d3151a14a3542811aa" +checksum = "99585191385958383e13f6b822e6b6d8d9cf928e7d286ceb092da92b43c87bc1" dependencies = [ - "autocfg", + "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.12" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac267bcc07f48ee5f8935ab0d24f316fb722d7a1292e2913f0cc196b29ffd611" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" dependencies = [ "autocfg", "libm", ] [[package]] -name = "num_cpus" -version = "1.13.0" +name = "once_cell" +version = "1.21.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3" -dependencies = [ - "hermit-abi", - "libc", -] +checksum = "d75b0bedcc4fe52caa0e03d9f1151a323e4aa5e2d78ba3580400cd3c9e2bc4bc" [[package]] name = "ordered-float" -version = "1.1.0" +version = "3.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3741934be594d77de1c8461ebcbbe866f585ea616a9753aa78f2bdc69f0e4579" +checksum = "f1e1c390732d15f1d48471625cd92d154e66db2c56645e29a9cd26f4699f72dc" 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,58 +481,60 @@ 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 = "ppv-lite86" -version = "0.2.9" +name = "percent-encoding" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c36fa947111f5c62a733b652544dd0016a43ce89619538a8ef92724a6f501a20" +checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] -name = "proc-macro2" -version = "0.2.3" +name = "pin-project-lite" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd07deb3c6d1d9ff827999c7f9b04cdfd66b1b17ae508e14fe47b620f2282ae0" -dependencies = [ - "unicode-xid 0.1.0", -] +checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" [[package]] -name = "proc-macro2" -version = "1.0.24" +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.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" dependencies = [ - "unicode-xid 0.2.1", + "zerocopy", ] [[package]] -name = "quote" -version = "0.4.2" +name = "proc-macro2" +version = "1.0.94" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1eca14c727ad12702eb4b6bfb5a232287dcf8385cb8ca83a3eeaf6519c44c408" +checksum = "a31971752e70b8b2686d7e46ec17fb38dad4051d94024c88df49b667caea9c84" dependencies = [ - "proc-macro2 0.2.3", + "unicode-ident", ] [[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", ] [[package]] @@ -340,88 +590,131 @@ 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 = "rustc-hash" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" + +[[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", + "quote", + "syn", ] [[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", + "quote", + "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" +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 = "7fcf8323ef1faaee30a44a340193b1ac6814fd9b7b4e88e9d4519a3e4abe1cfd" + +[[package]] +name = "stable_deref_trait" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbee7696b84bbf3d89a1c2eccff0850e3047ed46bfcd2e92c29a2d074d57e252" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" [[package]] name = "strsim" @@ -431,24 +724,24 @@ checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" [[package]] name = "syn" -version = "0.12.15" +version = "2.0.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c97c05b8ebc34ddd6b967994d5c6e9852fa92f8b82b3858c39451f97346dcce5" +checksum = "b09a44accad81e1ba1cd74a32461ba89dee89095ba17b32f5d03683b1b1fc2a0" dependencies = [ - "proc-macro2 0.2.3", - "quote 0.4.2", - "unicode-xid 0.1.0", + "proc-macro2", + "quote", + "unicode-ident", ] [[package]] -name = "syn" -version = "1.0.42" +name = "synstructure" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c51d92969d209b54a98397e1b91c8ae82d8c87a7bb87df0b29aa2ad81454228" +checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" dependencies = [ - "proc-macro2 1.0.24", - "quote 1.0.7", - "unicode-xid 0.2.1", + "proc-macro2", + "quote", + "syn", ] [[package]] @@ -460,23 +753,70 @@ dependencies = [ "unicode-width", ] +[[package]] +name = "thiserror" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" +dependencies = [ + "proc-macro2", + "quote", + "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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512" + [[package]] name = "unicode-width" -version = "0.1.8" +version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3" +checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" [[package]] -name = "unicode-xid" -version = "0.1.0" +name = "url" +version = "2.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" +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 = "unicode-xid" -version = "0.2.1" +name = "utf8_iter" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" +checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" [[package]] name = "vec_map" @@ -485,12 +825,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" [[package]] -name = "wasabi_leb128" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ef95b2fc26dab4b706f4763b297aa7277a1660e83450fa39e6832e64aeeb637" +name = "wasabi_wasm" +version = "0.7.0" +source = "git+https://github.com/danleh/wasabi?rev=21a322b7faac9440b931762aae124ffa57d0fa17#21a322b7faac9440b931762aae124ffa57d0fa17" dependencies = [ - "num-traits", + "mimalloc", + "nohash-hasher", + "once_cell", + "ordered-float", + "rayon", + "rustc-hash", + "serde", + "smallvec", + "thiserror", + "wasm-encoder", + "wasmparser", ] [[package]] @@ -500,16 +849,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" [[package]] -name = "wasm" -version = "0.5.0" -source = "git+https://github.com/danleh/wasabi#e3f968f3db984621ecc34269918570bbee61a037" +name = "wasm-encoder" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05632e0a66a6ed8cca593c24223aabd6262f256c3693ad9822c315285f010614" dependencies = [ - "binary_derive", - "byteorder", - "ordered-float", - "rayon", - "serde", - "wasabi_leb128", + "leb128", ] [[package]] @@ -520,7 +865,17 @@ dependencies = [ "rand", "rand_distr", "serial_test", - "wasm", + "wasabi_wasm", +] + +[[package]] +name = "wasmparser" +version = "0.96.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "adde01ade41ab9a5d10ec8ed0bb954238cf8625b5cd5a13093d6de2ad9c2be1a" +dependencies = [ + "indexmap", + "url", ] [[package]] @@ -544,3 +899,166 @@ 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-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 = "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 = "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 = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] + +[[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", + "quote", + "syn", +] + +[[package]] +name = "zerofrom" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +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", + "syn", +] diff --git a/wasm_instrumenter/Cargo.toml b/wasm_instrumenter/Cargo.toml index 067b4a062..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] -wasm = { git = "https://github.com/danleh/wasabi" } +wasabi_wasm = { git = "https://github.com/danleh/wasabi", rev = "21a322b7faac9440b931762aae124ffa57d0fa17" } 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..abf1518a1 100644 --- a/wasm_instrumenter/src/afl_branch.rs +++ b/wasm_instrumenter/src/afl_branch.rs @@ -3,10 +3,11 @@ use rand::distributions::{Distribution, Uniform}; 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, +use wasabi_wasm::{ + BinaryOp, FunctionType, Global, GlobalOp, ImportOrPresent, Instr, LoadOp, Local, LocalOp, + Module, StoreOp, }; -use wasm::{FunctionType, Idx, Label, 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; @@ -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 { @@ -329,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 f289baebd..e81d316c8 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, +use wasabi_wasm::{ + 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 wasabi_wasm::{Idx, Label, Memarg, Mutability, Val, ValType}; pub fn instrument_file( input_file: &OsStr, @@ -14,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); @@ -78,16 +79,16 @@ 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::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), @@ -104,12 +105,12 @@ 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), - 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); @@ -184,27 +185,27 @@ 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::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::Block(FunctionType::empty()), 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)), + Instr::Block(FunctionType::empty()), // 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,12 +214,12 @@ 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 - Instr::Block(BlockType(None)), + Instr::Block(FunctionType::empty()), // fetch the size of the chunk Instr::Local(LocalOp::Get, chunk_data_ptr), Instr::Load( @@ -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,13 +323,13 @@ 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::If(BlockType(None)), + Instr::Binary(BinaryOp::I64GeU), + Instr::If(FunctionType::empty()), Instr::Const(Val::I32(1)), Instr::Local(LocalOp::Set, calloc_overflow), Instr::Else, @@ -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)), @@ -431,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, @@ -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,11 +620,13 @@ 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. - 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); } } diff --git a/wasm_instrumenter/src/shared/mod.rs b/wasm_instrumenter/src/shared/mod.rs index a0b630afe..449049465 100644 --- a/wasm_instrumenter/src/shared/mod.rs +++ b/wasm_instrumenter/src/shared/mod.rs @@ -1,5 +1,4 @@ -use wasm::highlevel::{Function, Instr, Local}; -use wasm::Idx; +use wasabi_wasm::{Function, Idx, Instr, Local}; pub fn find_func_by_name<'a>( name: &str,