Summary: The version we're using is > 1 year old. I noticed the old version doesn't allow to override `assert_eq!` in a form of `use pretty_assertions::assert_eq`
Reviewed By: asm89
Differential Revision: D46010319
fbshipit-source-id: b48678e76fe907bdfbc6709ab438db992eb8d674
Summary:
Note: this is a re-land of D44623815, which was was reverted because of a land race with D44626072
In particular this fixes `FlattenUnordered` having a nasty deadlock, but also
some other bugs:
```
# 0.3.28 - 2023-03-30
* Update to syn 2. This raises MSRV of utility crates to 1.56. (#2730, #2733)
* Fix bug in `FlattenUnordered` (#2726, #2728)
# 0.3.27 - 2023-03-11
* Add `TryFlattenUnordered` (#2577, #2590, #2606, #2607)
* Add `AbortHandle::is_aborted` (#2710)
* Add `AbortRegistration::handle` (#2712)
* Make `BiLock` strict-provenance compatible (#2716)
# 0.3.26 - 2023-01-30
* Add `Either::as_pin_mut` and `Either::as_pin_ref` (#2691)
* Add `Shared::ptr_eq` and `Shared::ptr_hash` (#2691)
* Implement `FusedStream` for `Buffered` (#2676)
* Implement `FusedStream` for all streams in `ReadyChunks` (#2693)
* Fix bug in `FuturesOrdered::push_front` (#2664)
* Remove `Fut::Output: Clone` bounds from some `Shared` methods (#2662)
* Remove `T: Debug` bounds from `Debug` implementations of `mpsc` and `oneshot` types (#2666, #2667)
# 0.3.25 - 2022-10-20
* Fix soundness issue in `join!` and `try_join!` macros (#2649)
* Implement `Clone` for `sink::Drain` (#2650)
# 0.3.24 - 2022-08-29
* Fix incorrect termination of `select_with_strategy` streams (#2635)
# 0.3.23 - 2022-08-14
* Work around MSRV increase due to a cargo bug.
```
Reviewed By: zertosh
Differential Revision: D44632588
fbshipit-source-id: bdd87cb02b3aef63a65b1f9b852579225adfedbd
Summary:
Rust recently changed the default channel implementation, so maybe that's what triggered this failure.
This is a pretty brittle test. :/
Reviewed By: VladimirMakaev
Differential Revision: D44389514
fbshipit-source-id: 65ecc07edcab1aef99eb31dea2343d6ff4a92aa2
Summary:
* Adds a `README.md` file.
* Adds optional features to enable memory access and the async API.
`safeptrace` depends on `reverie-process` and `reverie-memory`, so those will need to be published as crates too.
Reviewed By: VladimirMakaev
Differential Revision: D44386559
fbshipit-source-id: e74c55d5d26239aa09aedac130dca880eb5f1206
Summary:
Everything in Reverie is super Linux-specific, so we should just skip compilation if we're not targetting Linux.
This is helpful for consumers of the library when it gets published to crates.io. With this, they don't need to have a special case for this in the `[dependencies]` section of `Cargo.toml`.
Reviewed By: VladimirMakaev
Differential Revision: D41824410
fbshipit-source-id: be1e0a887e35ed151cfad27af8107246df30c2e5
Summary: Might lead to a minor speed up, but probably not due to the magic of compiler optimizations. I noticed this a while back and meant to fix it before publishing the `safeptrace` crate (so this won't be a breaking change later).
Reviewed By: VladimirMakaev
Differential Revision: D41699769
fbshipit-source-id: ef3e5f24468ddb4b69b8628e28b1da8cfdcbce7b
Summary: This is useful for knowing if we're able to intercept CPUID or not.
Reviewed By: rrnewton
Differential Revision: D41599743
fbshipit-source-id: 56b1ca16f028ad070ecdf4e8489b6e318e386e65
Summary: It doesn't look like the never type is going to be stabilized anytime soon, so lets just use the `never-say-never` crate instead.
Reviewed By: dtolnay
Differential Revision: D41459064
fbshipit-source-id: 6bc82377242b31171251b2393a534f76c7f3d97a
Summary: Our early injected syscalls could get interrupted by a signal (like `SIGWINCH`), so we should always be sure to retry them.
Reviewed By: rrnewton
Differential Revision: D41568242
fbshipit-source-id: e3026bd162619795e776198b7bf05d3e33753c05
Summary: We inject a call to `arch_prctl(ARCH_SET_CPUID, 0)` to enable faulting on CPUID. This isn't supported on virtual machines, so we should gracefully handle any errors.
Reviewed By: rrnewton
Differential Revision: D41567919
fbshipit-source-id: 9623f2852d9b2e8cad0de447214c798c5b9dcb0b
Summary:
On Ubuntu 22.04, this is the disassembly of `gettimeofday` and `clock_gettime`:
```
0000000000000bd0 <__vdso_gettimeofday@LINUX_2.6>:
bd0: e9 4b fe ff ff jmp a20 <LINUX_2.6@LINUX_2.6+0xa20>
bd5: 66 66 2e 0f 1f 84 00 data16 cs nopw 0x0(%rax,%rax,1)
bdc: 00 00 00 00
0000000000000c10 <__vdso_clock_gettime@LINUX_2.6>:
c10: e9 9b fb ff ff jmp 7b0 <LINUX_2.6@LINUX_2.6+0x7b0>
c15: 66 66 2e 0f 1f 84 00 data16 cs nopw 0x0(%rax,%rax,1)
c1c: 00 00 00 00
```
These implementations just `jmp` to another internal function. The dynamic symbol table reports that these functions are 5 bytes in size, but we can see that they are aligned up to 16 bytes and they are still safe to patch. Thus, our patcher should take this padding and alignment into account.
Fixes https://github.com/facebookexperimental/hermit/issues/16.
Differential Revision: D41565913
fbshipit-source-id: 164aca876abf92642e7ebf4ce96d0860b276647b
Summary: The `getcpu` VDSO was just returning 0 unconditionally. This was an old hack to determinize the getcpu syscall, but we don't need this anymore because we just intercept it and determinize it instead. Reducing the size of this vdso function will make it more compatible with various VDSO implementations.
Reviewed By: wkhughes
Differential Revision: D41506684
fbshipit-source-id: 3dacad93971ecc7969d725f8b7e984a189a0ebb4
Summary: If the VDSO replacements are too large, they will overwrite too much memory if the real VDSO functions are smaller than the replacement. This fixes https://github.com/facebookexperimental/hermit/issues/16.
Reviewed By: wkhughes
Differential Revision: D41506686
fbshipit-source-id: 7c33e68ae9cccb440b820245e4d37184e156d03b
Summary: Removes usage of the `bench_black_box` unstable feature. This brings us one step closer to removing all usage of unstable nightly features, which will allow publishing a crate on https://crates.io.
Reviewed By: rrnewton
Differential Revision: D41387686
fbshipit-source-id: 98bfcf053cd320137dbf62f4ef24beb835e1f0df
Summary: Removes usage of the `map_first_last` unstable feature. This brings us one step closer to removing all usage of unstable nightly features, which will allow publishing a crate on https://crates.io.
Reviewed By: rrnewton
Differential Revision: D41387687
fbshipit-source-id: 05184220a6d6cd5ec03339845741b46e9557ca83
Summary: Removes usage of the `async_closure` unstable feature. This brings us one step closer to removing all usage of unstable nightly features, which will allow publishing a crate on https://crates.io.
Reviewed By: rrnewton
Differential Revision: D41387688
fbshipit-source-id: 136c5c8d19876e732d18dca195e87e3bc2ab7661
Summary: We want to allow precise timers with an instruction offset. While single stepping we have target and current value of the counter and once we match branches we only increment instructions
Reviewed By: jasonwhite
Differential Revision: D41269879
fbshipit-source-id: 46b3307249663de10607513dc59d8436ca907f78
Summary: `libunwind` isn't able to resolve symbols from the symbol table. There seems to be a regression preventing this from working. This partially fixes symbol lookup for stack frames by using the `object` crate for looking up symbols in the symbol table. This is a partial fix because symbol lookup does not seem to work yet for executables (only shared libraries).
Reviewed By: VladimirMakaev
Differential Revision: D41290099
fbshipit-source-id: 5d4ad1173f6ab1ca6c2995369c2dedb4a9f30e86
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