Commit graph

71 commits

Author SHA1 Message Date
Jason White
5df280b851 Don't return a Result for RPC messages
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
2022-06-30 16:59:53 -07:00
Jason White
6813d9a7b2 rustfmt with imports_granularity=Item
Summary: This makes merge conflicts much easier to handle.

Reviewed By: johnhurt

Differential Revision: D37564000

fbshipit-source-id: a7f1a2711ffbdbb23c93e2f479f47d0368a2dad9
2022-06-30 14:56:20 -07:00
Jason White
d34189fda6 third-party/rust: Update syscalls crate 0.6.1 -> 0.6.2
Summary:
From the changelog:
 - Added `SysnoSet` for constructing sets of syscalls. It uses a bitset under
   the hood and provides constant-time lookup and insertion of `Sysno`s.
 - Fixed `Sysno::len()` returning the wrong value for architectures with large
   syscall offsets.
 - Deprecated `Sysno::len()`. Use `Sysno::table_size()` instead. This will be
   removed in the next major version.

Differential Revision: D37556871

fbshipit-source-id: a287f2146a0776e6f0459a08b43a1d5a92bb6176
2022-06-30 11:59:56 -07:00
Jason White
884cba2bb0 Add log output for thread and process exits
Summary: Adds log output to the strace example tool. The real strace does this and so should we.

Reviewed By: johnhurt

Differential Revision: D37524309

fbshipit-source-id: e4f67a1e32b6ad4efedf84f570cb50cffad4fb3d
2022-06-29 10:59:11 -07:00
Robert Kelly
d8c87ad6ce ethers.rs
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
2022-06-23 20:03:16 -07:00
Ryan Newton
d3f1af59a9 tweak timer lib to suppport new processor type
Summary: This is to enable development on my Alder Lake Fedora laptop.

Reviewed By: jasonwhite

Differential Revision: D37300482

fbshipit-source-id: cf881caa854ca4f8ab84b23454faa5dba0445e8a
2022-06-22 07:15:17 -07:00
Igor Sugak
53c3abb5da update goblin to 0.5.2
Summary: As titled.

Reviewed By: dtolnay

Differential Revision: D37300975

fbshipit-source-id: bdc6c97735c19ab789af902bfa2244e0f06c9440
2022-06-21 08:14:33 -07:00
Ryan Newton
a11fa11768 switch tests to only log reverie messages
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
2022-06-10 09:06:33 -07:00
Jason White
674fbb2af5 third-party/rust: Update syscalls 0.6.0 -> 0.6.1
Reviewed By: johnhurt

Differential Revision: D37051530

fbshipit-source-id: e21fc86f98c5f55817ba6f412d7271b3da63d7bb
2022-06-09 18:12:21 -07:00
David Tolnay
3ca948fc77 third-party/rust: Update async-trait from 0.1.52 to 0.1.56
Summary:
Release notes:

- https://github.com/dtolnay/async-trait/releases/tag/0.1.53 (improved error messages)
- https://github.com/dtolnay/async-trait/releases/tag/0.1.54 (`impl Trait` support)
- https://github.com/dtolnay/async-trait/releases/tag/0.1.55 (compatibility with 2021 edition closure capture rules)
- https://github.com/dtolnay/async-trait/releases/tag/0.1.56 (more `impl Trait` work)

Reviewed By: zertosh

Differential Revision: D36881793

fbshipit-source-id: ce9b86693dd18efa6884d29419970b41ebff5447
2022-06-02 17:05:05 -07:00
Jason White
20c7020868 Appease the copyright linter
Summary: The OSS license linter doesn't like the word "its".

Reviewed By: johnhurt

Differential Revision: D36856385

fbshipit-source-id: 909037d96de8976f08004497d28b77838f8c6870
2022-06-02 11:51:06 -07:00
Jason White
d16ca7d7c0 Change Facebook -> Meta Platforms in Cargo.toml files
Reviewed By: johnhurt

Differential Revision: D36727976

fbshipit-source-id: 0449545ee3fb2faf4febcdec0be1d5940af5e937
2022-05-27 10:20:35 -07:00
Jason White
1bbfa8a5a2 Update copyright headers
Reviewed By: johnhurt

Differential Revision: D36727878

fbshipit-source-id: 2529052f6a81fb5a177ccdba51b7e0051577c148
2022-05-27 09:51:26 -07:00
Jason White
011e521c08 third-party/rust: Update syscalls crate 0.5 -> 0.6
Summary:
Changelog:
 * Removed `build.rs` and switched to Rust's inline assembly syntax. This should enable better codegen, including the ability to have syscalls get inlined.
 * **Breaking**: Architectures besides `arm`, `x86`, and `x86-64` now require nightly.
 * **Breaking**: Removed top-level `SYS_` constants. Just use the `Sysno` enum instead.

Reviewed By: johnhurt

Differential Revision: D36606892

fbshipit-source-id: 9d20addfec65fa712b25d9449ec6e414187565ca
2022-05-24 09:29:52 -07:00
Jason White
1e5ed86ae1 Prepare for syscalls crate update
Reviewed By: johnhurt

Differential Revision: D36607034

fbshipit-source-id: f50f6a21ef9c3febf6bb8fcf4a8f0b30514e6e61
2022-05-24 06:43:45 -07:00
Anastasios Andronidis
1aac7d0ad2 Get guest registers
Reviewed By: jasonwhite

Differential Revision: D36315857

fbshipit-source-id: bd00a87fea9b17a28d5afc438d640f2b68bd5975
2022-05-11 09:05:58 -07:00
CodemodService Bot
9899fe55c4 Daily common/rust/cargo_from_buck/bin/autocargo
Reviewed By: Croohand

Differential Revision: D36239957

fbshipit-source-id: 3f4cb4b55927f437e95dfd2d2563fdbafbeb2988
2022-05-09 04:05:21 -07:00
Jason White
f507b56319 third-party/rust: Update syscalls crate to v0.5.0
Summary:
See https://github.com/jasonwhite/syscalls/blob/master/CHANGELOG.md

The biggest change here is that the type of syscall registers and return values was changed from `u64` to `usize` (to support 32-bit architectures).

Reviewed By: zertosh

Differential Revision: D36157822

fbshipit-source-id: d8776b6809dd00df93b147ee34deb37df61a2675
2022-05-05 13:15:19 -07:00
Ryan Newton
05446620a2 minor compiler warning
Summary: Just another simple compiler warning fix.

Reviewed By: jasonwhite

Differential Revision: D35966952

fbshipit-source-id: 9656519ef0e0164cfda98326d0fa9b74e6a3f78d
2022-04-29 08:06:47 -07:00
Jason White
4d5c226d5a third-party/rust: Update tracing-subscriber from 0.3.10 to 0.3.11
Reviewed By: dtolnay

Differential Revision: D35956332

fbshipit-source-id: f92818417ec7ce6d655c171c180aac4696f84269
2022-04-27 19:09:17 -07:00
Ryan Newton
cdba957ddb just a minor lint
Summary: Fix compiler warning.

Reviewed By: jasonwhite

Differential Revision: D35905514

fbshipit-source-id: 5320c9cb543756ef68830b3e0a07c3284a67b693
2022-04-25 13:31:24 -07:00
Jason White
ab908fd184 third-party/rust: Update raw-cpuid to v10.
Summary: Updating raw-cpuid to get this fix: https://github.com/gz/rust-cpuid/issues/45

Reviewed By: dtolnay

Differential Revision: D35856229

fbshipit-source-id: 74e173e4db6d3e4270ce0993a5491adb2b776a1f
2022-04-22 18:48:48 -07:00
Ryan Newton
94cb7e879d minor: print args to syscall
Summary:
If we're going to print a trace message when we inject the syscall, we might as well show the raw args.

The specific use case I used this for was making sure when I am changing args between the Detcore and reverie layers, that they are changing in the expected way.  Detcore already prints log messages for the syscalls and arguments it receives from the guest.  This lets us see the actual arguments that are passed to the kernel.

Reviewed By: jasonwhite

Differential Revision: D35804814

fbshipit-source-id: 2fc5a1b526326b554d4f015bfd0cb41d0dfc4ab2
2022-04-22 13:14:18 -07:00
Jason White
7de9d81972 Fix PMU validation tests on GitHub's Ubuntu VM (#12)
Summary:
The Ubuntu VM that GitHub Actions uses doesn't seem to have permissions
to access the PMU. This exits the test successfully if it's not available.

Pull Request resolved: https://github.com/facebookexperimental/reverie/pull/12

Reviewed By: andronat

Differential Revision: D35838916

Pulled By: jasonwhite

fbshipit-source-id: 0e6cba4c170e3c7e293300e031ee41333c399040
2022-04-22 11:52:10 -07:00
Anastasios Andronidis
6cb6d53799 Don't hide error info
Summary:
In case the child dies, no error code is reported. Here is an example:
```
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: ()', hermetic_infra/reverie/reverie-process/src/container.rs:850:26
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
```

With this diff, we at least have some more info shown:
```
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Error { errno: EINVAL, context: Mount }', hermetic_infra/reverie/reverie-process/src/container.rs:834:26
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
```

Reviewed By: jasonwhite

Differential Revision: D35615348

fbshipit-source-id: ad540645a1bb06f275ab43994b1b1f4e9a4fdb1f
2022-04-13 16:58:26 -07:00
Jason White
3a31b92d6c Fix warnings
Reviewed By: andronat

Differential Revision: D35603562

fbshipit-source-id: 20496da3ca212ed867ecdf374990f93c996f6417
2022-04-13 09:45:27 -07:00
Huapeng Zhou
e5f89a81e9 rust: update crossterm to 0.23.0 and arc-swap to 1.5.0
Summary:
Needed to import [cloud-hypervisor](https://github.com/cloud-hypervisor/cloud-hypervisor).

(Note: this ignores all push blocking failures!)

Reviewed By: dtolnay

Differential Revision: D34434866

fbshipit-source-id: 69741b4ac767e0ab5ecc8307dd40267d9dcbf4ae
2022-04-12 23:50:06 -07:00
Jason White
cc09499c1f Upgrade to platform010
Summary:
Upgrades to platform010.

 1. This will let us use the new `core::arch::asm` macro and get rid of `llvm_asm`.
 2. All of fbcode should be upgrading to platform010. See [this post](https://fb.workplace.com/groups/fbcode.fyi/permalink/4768582506510846/) for more information.

Reviewed By: johnhurt

Differential Revision: D34939437

fbshipit-source-id: 2f8a6249c09c74d4e07dbca41994b17a708bf333
2022-04-12 19:07:52 -07:00
Will Hughes
c2df9c5b8c Add NanosleepFamily
Summary:
Add NanosleepFamily of syscalls, namely `nanosleep` and `clock_nanosleep`.

`nanosleep` can be transformed into `clock_nanosleep` by using clockid `CLOCK_REALTIME` and flags 0 (i.e., *not* `TIMER_ABSTIME`).

Reviewed By: johnhurt

Differential Revision: D35577747

fbshipit-source-id: 5925b083b4a49cdbfdff11117156d6366947d706
2022-04-12 12:36:22 -07:00
Jason White
f52262ef55 Fix some asm blocks
Reviewed By: andronat

Differential Revision: D35570647

fbshipit-source-id: 78dadc127ef2167d3c14cbe67fee853c7a51107a
2022-04-12 11:09:06 -07:00
Jason White
a7287aa33a Temporarily disable backtrace test
Summary: `libunwind` seems to be failing to look up the symbols. Need to debug this further.

Reviewed By: andronat

Differential Revision: D35569071

fbshipit-source-id: 38dc3925a277bb655ca476f97791754a736fb6aa
2022-04-12 11:09:06 -07:00
Jason White
61c24a5a35 Support clock_getres as a vdso function
Summary: `clock_getres` is a vdso function in recent versions of glibc.

Reviewed By: andronat

Differential Revision: D35570102

fbshipit-source-id: d09850b4d1bec002af749452f80228e1542fafaa
2022-04-12 11:09:06 -07:00
Jason White
86f6a155f3 third-party/rust: Update tempfile to v3.3.0
Reviewed By: jsgf

Differential Revision: D35477506

fbshipit-source-id: ef10c8f7548a21c0fb3d83d5debfe2e000657d08
2022-04-11 15:18:36 -07:00
Huapeng Zhou
f38f5c1cbc rust: update serde_json to 1.0.79 and serde to 1.0.136
Summary:
Needed to import [cloud-hypervisor](https://github.com/cloud-hypervisor/cloud-hypervisor).

(Note: this ignores all push blocking failures!)

Reviewed By: dtolnay

Differential Revision: D34433589

fbshipit-source-id: f92ea3ba640d19f170513b558f3d5208790bab67
2022-04-10 23:39:55 -07:00
Andreas Backx
f9bb665df0 upgrade tracing-subscriber from 0.3.9 to 0.3.10
Summary: 0.3.10 adds a new EnvFilter builder that I would like to use. :)

Reviewed By: wqfish

Differential Revision: D35473723

fbshipit-source-id: df31dad09c8f8fc9c27a43c85b5d6ac8f97d69a3
2022-04-08 04:00:03 -07:00
Huapeng Zhou
0b18766e8d rust: update anyhow to 1.0.56
Summary:
Needed by cloud-hypervisor https://github.com/cloud-hypervisor/cloud-hypervisor/blob/main/Cargo.toml#L19.

(Note: this ignores all push blocking failures!)

Reviewed By: jsgf

Differential Revision: D34432496

fbshipit-source-id: deaa320c74a22e325a116bcc0d5b0120c4f3744b
2022-04-07 04:31:34 -07:00
Will Hughes
675073a631 Read child TID from clone family syscalls
Summary: Expose the child TID arg passed to clone family syscalls. For fork and vfork this will be 0 as child TID is not an arg, for clone and clone3 this is read from the args.

Reviewed By: jasonwhite

Differential Revision: D35370069

fbshipit-source-id: 32821152adaadd17c66f334f286f5410fabd4b97
2022-04-05 01:23:00 -07:00
Huapeng Zhou
413542a24f rust: update thiserror to 1.0.30
Summary: Needed to import [cloud-hypervisor](https://github.com/cloud-hypervisor/cloud-hypervisor/blob/main/Cargo.toml#L31).

Reviewed By: dtolnay

Differential Revision: D34437972

fbshipit-source-id: 9f22bb1fde83308a319f40e138d9ab7f180c7fa0
2022-03-31 00:26:06 -07:00
CodemodService FBSourceRustfmtLinterBot
e467c37695 Daily arc lint --take RUSTFMT
Reviewed By: ivanmurashko

Differential Revision: D35243292

fbshipit-source-id: 2f973660c82eb4e772c36af50499adca697f076d
2022-03-30 02:52:36 -07:00
David Tolnay
924aff3d5e Reformat with new rustfmt 4/7
Summary:
Generated by `tools/arcanist/lint/codemods/rustfmt-fbsource` with the rustfmt executable added by D35234535 (ce519e0af4).

drop-conflicts

Reviewed By: zertosh

Differential Revision: D35234536

fbshipit-source-id: 3e8b23b4abbb9bdd052d86dcd619f88bbcc5d454
2022-03-29 20:22:00 -07:00
David Tolnay
ce519e0af4 Update to version 1.4.38-nightly from nightly-2022-03-28
Summary:
The changes from the old "rustfmt 2.x" branch, which we upgraded to in D23569308, have since been merged into the master branch of rustfmt under the flag `version = "Two"`. Fixes like needed for https://fb.workplace.com/groups/learningrust/posts/545143730235002 now only land to master; there is no separate 2.x branch in development. This diff pulls in the newest version of rustfmt so that we can handle any new syntax and pick up fixes to rustfmt issues that we report or contribute.

The tools/third-party/rustfmt changes in this diff are generated by:

```
$ echo nightly-2022-03-28 > tools/third-party/rustfmt/.rustfmt-version
$ tools/third-party/rustfmt/rustfmt-upgrade
```

Reviewed By: zertosh

Differential Revision: D35234535

fbshipit-source-id: c79454fa918cf052312418dd271404e85bf872b2
2022-03-29 20:18:21 -07:00
David Tolnay
5b57993cf3 Prepare for rustfmt upgrade 7/13
Summary:
Context: I am upgrading rustfmt in D35234535.

 ---

This diff contains all the formatting changes which are idempotent between the old and the new version of rustfmt. It's generated by formatting with the new rustfmt, then formatting immediately again with the old rustfmt. If there are any big changes in here, that's code that old rustfmt used to crash on but new rustfmt handles correctly.

Separating out this part of the changes prior to flipping the rustfmt version switch globally allows the amount of code that needs to be landed atomically to be smaller, since this diff is independent and can land at any point before the rest of the stack.

 ---

Reviewed By: zertosh

Differential Revision: D35234529

fbshipit-source-id: 77e102f5d6f4b7f05df8d5d6bd9294cc9f3b15e6
2022-03-29 18:56:43 -07:00
Jason White
6dd486377b Add Command::prepend_args
Summary: This is useful when wrapping a preexisting `Command` with another program.

Reviewed By: johnhurt

Differential Revision: D35164471

fbshipit-source-id: 39f861de9cf41c1ba438c497c885d5d367ada5ce
2022-03-29 18:41:29 -07:00
Jason White
74ca492114 Add seccomp notify support
Summary:
Adds the ability to receive seccomp notify events from a process asynchronously.

NOTE: Getting the file descriptor out of the `seccomp()` return value in the child process is very akward. Because of this, there is currently a possibility of deadlock if using `seccomp_notify` and a process fails to spawn. In this case, an error will be sent through a pipe to the parent process, but the parent process will never be able to read it because it will be spinning in a loop trying to read the file descriptor from the child.

Reviewed By: johnhurt

Differential Revision: D35138101

fbshipit-source-id: 2df0ddb39a6ed7e594d04df188a2143833f082c0
2022-03-29 18:41:29 -07:00
David Tolnay
b351f26d3d Switch configuration to 2021 edition
Summary:
This results in no formatting changes for the Rust code that's in fbcode today, but it does affect the configuration of the Rust parser that `rustfmt` parses its input with.

There are some language changes between 2018 edition and 2021 edition: for example the macro input in `m!(s"")` is 2 tokens in 2018 edition and 1 token in 2021 edition. Thus even absent any formatting differences, it's possible that different error messages would be produced on a particular input by `rustfmt --edition 2018` vs `rustfmt --edition 2021`, so it's best for us to keep the rustfmt edition in sync with the edition that Buck runs rustc with, which is:

https://www.internalfb.com/code/fbsource/[b25775c8103c84ae602d9bcf297595b56f932f5a]/tools/buckconfigs/fbsource-common.bcfg?lines=324-325

Reviewed By: zertosh

Differential Revision: D35234518

fbshipit-source-id: c1b9ab47f4e592b7fd1530d39af878775cf1dc18
2022-03-29 18:29:47 -07:00
Huapeng Zhou
7213f65761 rust: update libc from 0.2.117 to 0.2.121
Summary: Needed to import cloud-hypervisor https://github.com/cloud-hypervisor/cloud-hypervisor/blob/main/Cargo.toml#L25.

Reviewed By: dtolnay

Differential Revision: D35052728

fbshipit-source-id: bdd60925501c446ee6d429fad6e95d6593ff2544
2022-03-23 10:00:47 -07:00
Javier Honduvilla Coto
36515611d2 Bump nix crate from 0.22 => 0.23
Summary:
Updating to be able to use  `pwritev` and `preadv`.

- Followed [the documentation on how to update crates](https://www.internalfb.com/intern/wiki/Rust-at-facebook/Managing_fbsource_third-party_with_Reindeer/).
- These are all the changes between our current version and the updated one: https://github.com/nix-rust/nix/compare/v0.22.0..v0.23.1. See `CHANGELOG.md` for the most significant changes in this version.

Let me know if I missed anything, this is my first crate upgrade!

Reviewed By: jsgf

Differential Revision: D34820818

fbshipit-source-id: 89f59a759bf042112e7d48612a345a8164dc7176
2022-03-22 09:26:52 -07:00
David Barsky
7bfb3c0fe6 third-party: update tracing and related crates
Summary:
This diff does the following:
- Updates the tracing crates to the latest versions available. Changes include:
    - Experimental support for [Valuable](https://tokio.rs/blog/2021-05-valuable), which makes recording values much more like how serde does. Valuable also makes it easier to write a tracing-slog crate due to some implementation details of slog where buffering of values is necessary.
    - Combinators for combining filters in tracing-subscriber.
    - A `MakeWriter` implementation for `RollingFileAppender` in `tracing_appender`, which allows the `RollingFileAppender` without a background thread to being spun up.
    - Reduced the disabled span drop overhead by 50-70%—this might be most apparent in tests that don't set a subscriber.
- Move the tokio-console off git dependencies and to published versions on crates.io.

This diff also updates the following, non-exhaustive list of crates:
- parking_lot
- prost
- thread_local
- tonic
- hyper
- httparse
- h2

allow-large-files

Reviewed By: jsgf, fanzeyi

Differential Revision: D34801437

fbshipit-source-id: 2409de9194c8e00647ac5e4c514325fd2e23d247
2022-03-16 15:36:55 -07:00
CodemodService Bot
401e7f31ad Daily common/rust/cargo_from_buck/bin/autocargo
Reviewed By: krallin

Differential Revision: D34814289

fbshipit-source-id: bfff94231c3b3884537c4ea0b602d22eb916d4cb
2022-03-11 01:22:36 -08:00
Jason White
193965dfe5 Convert llvm_asm to asm
Summary:
The `llvm_asm` nightly feature was removed in Rust 1.59 and `asm!()` was simultaneously stabilized, so we need to make the switch so things continue compiling.

This retains the `llvm_asm` code so that it can continue compiling on old llvm versions. This will be removed when that is updated.

Reviewed By: johnhurt

Differential Revision: D34561246

fbshipit-source-id: 42cd2c7e83cea9a5c21bd5871463bb1a42be139d
2022-03-10 12:05:42 -08:00