Commit graph

95 commits

Author SHA1 Message Date
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
Jason White
75e875fe28 Implement local memory access
Reviewed By: johnhurt

Differential Revision: D34676792

fbshipit-source-id: 77f28c90d535ca3c50b05542e558053d1263937d
2022-03-07 13:11:06 -08:00
Jason White
cd68557b4c Fix bug in check_for_xen_pmi_bug
Summary: The `count` wasn't getting initialized properly, so it was possible in theory that the check could have been failing. I noticed this while attempting to convert this chunk of `llvm_asm!()` to the new `asm!()` syntax. Also added documentation explaining what this code is doing because it's not easy to read.

Reviewed By: johnhurt

Differential Revision: D34542806

fbshipit-source-id: 0f79b9d36757756a1cf76e98830f9cc76f06336c
2022-03-01 15:50:23 -08:00
Kevin Guthrie
c2d7dc125f lowering the log level for spurious wakup messages
Summary: Quick fix to make remove the postential for warning messages to cause false determinism failures

Reviewed By: andronat

Differential Revision: D34243592

fbshipit-source-id: 30c025ad8c4921e9c15f72956937166bfaf5d598
2022-02-16 10:51:06 -08:00
Eddie Shen
3341465137 Command getter for TracerBuilder
Summary:
Adds a way to fetch the command provided to `TracerBuilder`.

We're running into a situation where we're constructing a TracerBuilder and using it much later, but we want to debug and print the command that we're tracing when we execute the traced program.

You can alternatively avoid this by storing the necessary info alongside in an adjacent struct, but it feels a little silly to have to carry around a separate struct just for debugging.

Reviewed By: jasonwhite

Differential Revision: D34231169

fbshipit-source-id: ef40cb396f5530ee1f4324694ce5d9122dfe281f
2022-02-14 18:20:14 -08:00
Andres Suarez
74cf894bea Update async-trait to 0.1.52
Summary:
Fixes some clippy issues:
685b68b090

Reviewed By: dtolnay

Differential Revision: D34100067

fbshipit-source-id: fa49e68645b6e99d87f92a7b9ac73ba5d567fa0b
2022-02-09 02:05:45 -08:00
Wez Furlong
12ad2e60f7 Back out "Bump parking-lot to version 0.12.0"
Summary:
Original commit changeset: ce571ef50289

Original Phabricator Diff: D33985872 (6dda2dafb9)

Reviewed By: dtolnay

Differential Revision: D34060091

fbshipit-source-id: c1ddcdd1848a51f83dcbc9b2eec5f316bb6e44e5
2022-02-08 11:37:29 -08:00
Mofei Zhang
6dda2dafb9 Bump parking-lot to version 0.12.0
Summary:
~~~Added new parking-lot version named parking_lot_0_12~~~
allow-large-files

previous versions of parking-lot are incompatible with wasm compilation targets

https://github.com/rustwasm/wasm-bindgen/issues/2160
https://github.com/Amanieu/parking_lot/pull/302

Reviewed By: dtolnay

Differential Revision: D33985872

fbshipit-source-id: ce571ef50289fe97ff89dbf72d2c7f39fbd47758
2022-02-07 05:21:03 -08:00
Kevin Guthrie
e5e0e2983d Adding retry handing for precise timers to account for anomalous wakeups
Summary: Something appears to be causing timer marker events to randomly be sent early or possibly multiple times. This commit adds some sanity check and retry handling to ensure that early wakeups do not impact the implementing tool or at least long runs of single steps (and thus the timeouts that originally sparked this investigation)

Reviewed By: jasonwhite

Differential Revision: D33828008

fbshipit-source-id: 008bf1793964053405643640155269603c4e6bcc
2022-02-04 13:47:53 -08:00
Jason White
eed2eba46a Add support for TIOCGPTPEER ioctl
Summary:
This is called when creating a slave from a master pty and returns a file descriptor.

Usage example:
```
async fn handle_ioctl<G: Guest<Self>>(
    &self,
    guest: &mut G,
    syscall: Ioctl,
) -> Result<i64, Errno> {
    use reverie::syscalls::ioctl;

    match syscall.request() {
        ioctl::Request::TIOCGPTPEER(flags) => {
            let fd = guest.inject(syscall).await?;
            // Do something with the flags and fd ...
            Ok(fd)
        }
        _ => Ok(guest.inject(syscall).await?)
    }
}
```

Reviewed By: wangbj, igorsugak

Differential Revision: D33961825

fbshipit-source-id: 0e6d4a0ed984a4b96b2501095dd44a978030788e
2022-02-02 17:47:21 -08:00
Jason White
371f84d4d4 Add clone3 syscall support
Summary: Adds support for the `clone3` syscall, which is now used by `pthread_create`. This also introduces `CloneFamily`, which abstracts `fork`, `vfork`, `clone`, and `clone3`.

Reviewed By: johnhurt

Differential Revision: D33865362

fbshipit-source-id: 8b91225c63ff6a8aa9c283877a30f58aa4cd9bb2
2022-01-31 15:54:19 -08:00
Jason White
9864620234 Fix doc references
Reviewed By: wangbj

Differential Revision: D33808859

fbshipit-source-id: 2897f66dcd50ef89b90d9c69f2303aadaaacfa6a
2022-01-27 12:44:16 -08:00
Jason White
2393a650f6 Regenerate Cargo.toml
Summary: Forgot to do this in the previous diff.

Reviewed By: rrnewton

Differential Revision: D33801337

fbshipit-source-id: 68afdd162412c5b5636f87990d543f4f93a8939b
2022-01-26 14:23:10 -08:00
Jason White
60e67eab1b Add file and line info to backtraces
Summary:
Adds file and line number resolution to backtraces. This also adds a 1GB limit on the amount of in-memory symbols at any given time. If the internal symbol cache exceeds this, the oldest entries will be discarded until we're under that limit again. We may need to tweak this and make it more configurable in the future.

Follow-up: Auxiliary debug files, such as `.debug` files, are not supported. This should be easy to support by reading the `gnu_debuglink` section and finding the `.debug` file.

Reviewed By: johnhurt

Differential Revision: D33086623

fbshipit-source-id: 43112e3bdd135a1a43ca75c10756cc8ec101c9b8
2022-01-26 14:23:10 -08:00
Kevin Guthrie
72b1376c6e Add check to catch PMU bugs
Summary: Mozilla-rr has a set of tests that it runs to determine if the host system's perf timers can be trusted. This diff transcribes that functionality (as close as possible) into reverie

Reviewed By: jasonwhite

Differential Revision: D33644553

fbshipit-source-id: 8ecd505bf339ceb4c8b2b8fea86a1f23b14a9b73
2022-01-26 05:22:32 -08:00
Andres Suarez
23b58143af Update tokio to 1.15
Reviewed By: Imxset21

Differential Revision: D33759920

fbshipit-source-id: 7fd02dc93a7c1c564454a1fece3ff4b12dba3d3e
2022-01-25 02:04:43 -08:00
Jason White
668ee0772b third-party/rust: Update gimli, object, and addr2line crates
Reviewed By: Imxset21

Differential Revision: D33275115

fbshipit-source-id: 9a8eb9dd6c64f834ae76ae77aa7bbe510dda1a5c
2022-01-07 13:24:25 -08:00
Jason White
72ced7689b Give copyright attribution where needed (#10)
Summary:
Some code was derived from https://github.com/daniel5151/gdbstub. Although much of `gdbstub` has been rewritten for inclusion in Reverie, some parts still remain. This gives copyright attribution where it was missing. Fixes https://github.com/facebookexperimental/reverie/issues/9.

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

Reviewed By: asm89

Differential Revision: D33467315

Pulled By: jasonwhite

fbshipit-source-id: dc3b5391d02242adb9bd742b55369343dba43666
2022-01-07 12:09:23 -08:00
Jason White
7287507a84 Center diagram in the README
Summary: Minor change, but looks nicer.

Reviewed By: wangbj

Differential Revision: D33411660

fbshipit-source-id: e2bec3f178eedd7239e5dd302f29cea19ea1e9c8
2022-01-04 18:14:12 -08:00
Jason White
256fc33dd5 Remove extern crate usage
Summary: This hasn't been necessary for quite a while now.

Reviewed By: wangbj

Differential Revision: D33411662

fbshipit-source-id: e6f88834521809b59323aa9d14796ff31571e7b6
2022-01-04 18:14:12 -08:00
Jason White
39d5c0b427 Fix comments in example tools
Reviewed By: wangbj

Differential Revision: D33411658

fbshipit-source-id: 595356f8501bfb9cb2b67b4c084154e1cdca07c8
2022-01-04 18:14:12 -08:00
facebook-github-bot
15d2f61411 Initial commit
fbshipit-source-id: c440d991296c92bdc5e109a11d269049e8840e94
2021-12-29 16:14:27 -08:00