Summary:
This adds an ability to decode an instruction on top of the safeptrace::Stopped task and enables debug! tracing when single-stepping.
Note that performance overhead should not be present when higher tracing level is requested
Reviewed By: jasonwhite
Differential Revision: D40895393
fbshipit-source-id: 867f237a0517304314f4ac43313c1f26cee3f646
Summary: this adds more compact and reusable way to display libc::user_regs_struct
Reviewed By: jasonwhite
Differential Revision: D40895319
fbshipit-source-id: fde83d834cc4179bfc6a6aa8d77a4de5f6598e1b
Summary:
This was from the *before times* when `core::arch::asm` wasn't yet stable. `llvm_asm!()` has been removed from recent versions of rustc, so this stuff won't even compile anymore.
Note that this also removes a rather large block of `llvm_asm` (`check_for_xen_pmi_bug`) that hasn't yet been migrated over to the new asm syntax. This seems like a lot of work for little benefit, so I'm just deleting it for now.
Differential Revision: D40957341
fbshipit-source-id: 2b9bf97e93eaa9462295b9060907530dd797e288
Summary: Fixes `skip_seccomp_syscall` on aarch64 to *actually* skip the syscall. I plan on cleaning this up a bit more in a later diff because we are calling `getregs` and `setregs` more than necessary on a per-interception basis.
Reviewed By: VladimirMakaev
Differential Revision: D40867423
fbshipit-source-id: d72b4998b5c1c44f426a9129eccb205ccfc320fa
Summary: This fixes the initial syscall injection on aarch64. This also does slight simplification of the instructions that get plopped down at the current instruction pointer so that we can fit the instructions into a single word. That is, instead of injecting `INT3; SYSCALL; INT3`, we inject `SYSCALL; INT3`.
Reviewed By: VladimirMakaev
Differential Revision: D40867427
fbshipit-source-id: 2afa96f2270e16284523a17b09da00529893c20e
Summary: See comment for an explanation of why this is needed. These tests should eventually be updated to work on aarch64.
Reviewed By: VladimirMakaev
Differential Revision: D40867431
fbshipit-source-id: 089e8bd61bec21556bdebc8b1f89dd4d18aa0910
Summary: Change the `sub` instruction to `subs` as the latter is needed to update the condition code that `be.n` relies on.
Reviewed By: VladimirMakaev
Differential Revision: D40867430
fbshipit-source-id: b45987b5ccd4af784988f14fe0d6b3ac97b5ad80
Summary: This adds VDSO stubs for aarch64 so that we can intercept VDSO calls. See the comments in the code for more details.
Reviewed By: VladimirMakaev
Differential Revision: D40867428
fbshipit-source-id: 136818d9dbf52f4297dd4dae041e3e6dfe0764ae
Summary: Update from 0.2.135 to 0.2.137, the latest version on crates.io, in preparation for backporting a PR in the diff after this one.
Reviewed By: zertosh
Differential Revision: D40874274
fbshipit-source-id: debf9dae82ecc20201470e634f10904a2b308e51
Summary: To do proper feature detection on the CPU to know if we can get perf events, there is more work to do here. See the comment on `get_rcb_perf_config` for more info.
Reviewed By: VladimirMakaev
Differential Revision: D40701837
fbshipit-source-id: 4c7a7c00be0ab14e4fe9f4be09c8094567d5d031
Summary: This is a more architecture-independent name.
Reviewed By: VladimirMakaev
Differential Revision: D40701833
fbshipit-source-id: 66b77c6f62886ecd776a3efbc0b71248f875914e
Summary: These definitions are x86_64-specific, so they should be defined in their own file. Later, we'll add definitions for aarch64.
Reviewed By: VladimirMakaev
Differential Revision: D40701840
fbshipit-source-id: 0c52334dc7eb9bb60020c45c3f2ef58077c20322
Summary:
Followed guide here https://www.internalfb.com/intern/wiki/Linting/License_Lint/ to add fbcode/hermetic_infra/** code to license linter. As we have parts of our code shipped as Open Source it's important to get this automated
This diff is updating existing file's licenses to not get conflict after lint rule enablement
Reviewed By: jasonwhite
Differential Revision: D40674080
fbshipit-source-id: da6ecac036f8964619cf7912058f3a911558e7b1
Summary:
This abstracts the set of general purpose registers so that we can more easily access special registers in an architecture-independent way.
The rest of the code will be refactored to use this new interface in a later change.
Reviewed By: wangbj
Differential Revision: D40577289
fbshipit-source-id: 313a3ab3863f09a506b6e61fb67093fc49eeae3e
Summary: This release makes async trait methods work better with rust-analyzer's "go to definition" and other IDE functionality.
Reviewed By: zertosh
Differential Revision: D40532047
fbshipit-source-id: 1871d1819ebe1aab0846b0135f051c45e6e8821b
Summary:
On devvm5443.atn0.facebook.com (Intel Xeon Processor (Skylake)), I observed a slippage a bit past the skid of 50:
✉ Timeout: hermetic_infra/hermit/tests:hermit_run_strict__sh_par_work - main (300.011)
Test output:
> from_execution_error::timeout::LocalExecutor::Timeout
:: Run1...
thread 'main' panicked at 'Clock perf counter exceeds target value at start of attempted single-step: 23417931 > 23417927. Consider increasing SKID_MARGIN_RCBS.', hermetic_infra/reverie/reverie-ptrace/src/timer.rs:562:9
Therefore I'm bumping it to 60.
This is unfortunate, because it directly slows down our chaos mode preemptions (until we eventually get an emulator), but I'm therefore bumping the skid margin.
We could also potentially set it differently for devvm and for bare metal.
Reviewed By: jasonwhite
Differential Revision: D40383171
fbshipit-source-id: 34bb8217a61fc2c77f1d45d23b8c28f91cae5efc
Summary: This updates the libc crate to 0.2.135, which includes the FICLONE constant needed to the given ioctl.
Reviewed By: justintrudell
Differential Revision: D40286796
fbshipit-source-id: acfa115479cd289f478d8d73937be34ced5c4bbb
Summary:
When I was trying to use `nix::unistd::gethostname` in D39783468, the version `0.23.0` will require users to pass in a `buf` as a parameter, however, in `0.25.0`, there is no need to pass in a `buf` as a parameter. Hence, I would love to update `nix` crate from `0.23` to `0.25` in order to not pass a redundant `buf` while calling `nix::unistd::gethostname`.
I fixed conflicts reflected from the signals manually so this diff is more than a few lines of code in `Cargo.toml`.
Here are the [changes](https://github.com/nix-rust/nix/compare/v0.23.0..v0.25.0) between `0.23` and `0.25`. See `CHANGELOG.md` for the most significant changes in this version.
Reviewed By: bgw
Differential Revision: D39919100
fbshipit-source-id: 7f62585ff72230bd2608aeb5a4780dc0128795f7
Summary: D39418421 (8fef664fab) prematurely upgraded `thiserror`. Various projects in fbcode use nightly features including std::backtrace but the current fbcode Rust toolchain is 1.63.0, in which the backtrace API is different from the API of the latest nightlies.
Reviewed By: quark-zju
Differential Revision: D39562441
fbshipit-source-id: d1f8a993ec776cf82b1736b242bd4466def21230
Summary: This will help reverie-ptrace slowly migrate towards supporting `aarch64` as well as `x86_64`.
Reviewed By: jasonwhite
Differential Revision: D38787872
fbshipit-source-id: e747c59da8f0c59f0b85a50888c884dbbed65824
Summary:
Add bundlr-sdk to rust 3p crates.
Also needed some new fixups for a couple deps, and a custom fork of bundlr to use derive_builder 0.9 which is pinned in 2 deps we use, and fixed a missing out of scope trait bug in bundlr sdk.
Reviewed By: zhuomingfb0
Differential Revision: D37962056
fbshipit-source-id: 878048840d66dffcf558351614c45f9beef2f626
Summary:
This diff updates tracing. New features include:
## `tracing`
- New `Value` implementations for `String` and 128-bit integers. The `Value` implementation for `String` allows recording a `String` without needing to call `.as_str()` or similar. The `Value` implementation allows recording 128-bit integers, resolving this papercut: https://fb.workplace.com/groups/learningrust/permalink/3208916922712504/.
- There are additional methods on different trait objects of` Subscriber`s.
## `tracing-subscriber`
- Fixes multiple filtering bugs in the `Layer` implementations for `Option<impl Layer>` and `Vec<impl Layer>` (this is how folks are able to do arbitrary/dynamic numbers of loggers in `tracing`).
- Increases the minimum version of `tracing-core`.
- Adds a new `Layer::event_enabled` method, which allows Layers to filter events _after_ their field values are recorded. This is import for
- Some bug fixes in the `Filter` implementation for `EnvFilter`.
## `tracing-appender`
- Fixes bug in `RollingFileAppender` that could result in a failure to rotate the log file, or in panics in debug mode.
Notice to self: it seems like the filtering implementation in `tracing-subscriber` is kinda complex: it could make sense to fuzz it.
---
## Linked Change Logs
- `tracing-core`: https://github.com/tokio-rs/tracing/blob/v0.1.x/tracing-core/CHANGELOG.md#0128-june-23-2022
- `tracing-subscriber`: https://github.com/tokio-rs/tracing/blob/v0.1.x/tracing-subscriber/CHANGELOG.md#0314-jul-1-2022
- `tracing-appender`: https://github.com/tokio-rs/tracing/blob/v0.1.x/tracing-appender/CHANGELOG.md#022-march-17-2022
(Note: this ignores all push blocking failures!)
Reviewed By: jsgf
Differential Revision: D37932030
fbshipit-source-id: bee53e5ba219ffbcc9009781d347cd6b40f577ee
Summary:
This fixes a few things related to timers on AMD CPUs:
1. Fixes a breakage caused by updating to `raw-cpuid` v10. `FeatureInfo::{family_id,model_id}` no longer behave as they once did. This actually cleans up the code a bit.
2. Fixes some invalid assembly code in a test that only runs on AMD CPUs. This would cause a SIGILL.
3. Adds support for a few more AMD microarchitectures (Pinnacle Ridge, Castle Peak, and Cezanne).
Pull Request resolved: https://github.com/facebookexperimental/reverie/pull/14
Reviewed By: andronat
Differential Revision: D37638404
Pulled By: jasonwhite
fbshipit-source-id: f39c4aa166dab88917b56b0a0a16d319031a213a
Summary: If an RPC fails to send, there isn't much that can be done to handle it. In all call sites so far, they all just unwrap the error because it can't be handled properly. If an RPC fails, it is a programmer error (because the request/response failed to serialize/deserialize) and indicates a bug in our code.
Differential Revision: D37563857
fbshipit-source-id: 267072709f4230732a13989aaf74b50fd0908337
Summary: This makes merge conflicts much easier to handle.
Reviewed By: johnhurt
Differential Revision: D37564000
fbshipit-source-id: a7f1a2711ffbdbb23c93e2f479f47d0368a2dad9
Summary:
This is a pretty in depth third party library being added. The main changes are...
**version bumping**:
dunce = "1.0.0" => "1.0.2"
once_cell = "1.8" => "1.12"
tracing = "0.1.32" => "0.1.35"
adding ethers-rs fork:
https://github.com/rlkelly/ethers-rs.git
this depends on forks of:
coins-bip32 = https://github.com/rlkelly/bitcoins-rs.git
coins-bip39 = https://github.com/rlkelly/bitcoins-rs.git
eth-keystore = https://github.com/rlkelly/eth-keystore-rs.git
this was necessary to remove the wasm target, which creates a cyclic dependency for "indexmap". This was ran into previously here:
https://fb.workplace.com/groups/rust.language/permalink/8603206789727860/
also, some fixups were created for a few packages to facilitate build. I'm not a fan of libraries creating a build step to generate documentation...
----
This still does not have the ethers-middleware crate or the ethers-solc crate because it has the external build dependency of solc, which would make this a bit more complex to add:
https://docs.soliditylang.org/en/latest/installing-solidity.html
adding the crates without solc makes the process of integrating this library much easier, but it would be beneficial in the future.
@public
update rust deps
Reviewed By: jsgf
Differential Revision: D37320246
fbshipit-source-id: 251bd1c3c0e51733347a534fa597dea33d1df74b
Summary: This is to enable development on my Alder Lake Fedora laptop.
Reviewed By: jasonwhite
Differential Revision: D37300482
fbshipit-source-id: cf881caa854ca4f8ab84b23454faa5dba0445e8a
Summary:
Right now we get a whole bunch of annoying messages from tokio that spam our test logs:
2022-06-10T15:09:59.751928Z TRACE runtime.spawn{kind=block_on task.name= loc.file="hermetic_infra/reverie/reverie-ptrace/src/testing.rs" loc.line=58 loc.col=8}:runtime.spawn{kind=local task.name= loc.file="third-party/rust/vendor/tokio-1.15.0/src/task/local.rs" loc.line=302 loc.col=22}: tokio::task::waker: op="waker.drop" task.id=26
This diff makes the filter more restrictive for reverie tests.
Reviewed By: johnhurt
Differential Revision: D37071398
fbshipit-source-id: fe93ec3cc0cf61938be10d40df6fe2f46979fbf9