Commit graph

32 commits

Author SHA1 Message Date
Jason White
f492da1e30 ci: Fix clippy (#20)
Summary:
The clippy action has been in a broken state since 1438ff0f2e. This fixes the GitHub action and all of the clippy warnings.

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

Reviewed By: VladimirMakaev

Differential Revision: D47322336

Pulled By: jasonwhite

fbshipit-source-id: 88f8d16cc81269448c2425d8b56bcc3623e04b31
2023-07-10 16:46:43 -07:00
Jason White
dba0b5b9b7 Extract MemoryAccess into separate crate
Summary: This removes the need for `safeptrace` to depend on `reverie-syscalls`, which is a somewhat heavyweight library.

Reviewed By: VladimirMakaev

Differential Revision: D41751372

fbshipit-source-id: 36f601c7f441b070cd3a0678621649c4fb12b28e
2022-12-07 18:06:56 -08:00
Jason White
9515dfe3c2 Only compile for Linux
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
2022-12-07 18:05:11 -08:00
Jason White
d9a2b94410 reverie-syscalls: Add io_uring support
Reviewed By: rrnewton

Differential Revision: D41699755

fbshipit-source-id: a16e262d5f66e7af373dea93e1e4bd349db4f841
2022-12-03 12:19:30 -08:00
Jason White
5995e04dde reverie-syscalls: Fix Sendfile missing from aarch64
Summary: `sendfile` is available on aarch64, so this was a mistake.

Differential Revision: D41590782

fbshipit-source-id: 6e704bc0c3358c232768a5382c7b5435445c3976
2022-11-29 15:58:23 -08:00
Jason White
316b36650c Add ReadFamily
Summary: Adds `ReadFamily` to make it easier to handle all `read` syscall variants.

Reviewed By: igorsugak

Differential Revision: D41239542

fbshipit-source-id: 2c847e421b38281aa5243d8dfc00a8d1de0c075a
2022-11-11 16:52:21 -08:00
Jason White
df05ba9e83 Remove Addr::as_ref and AddrMut::as_ref
Summary: These operations are misleading and should never be called. Since the address could be a remote address, dereferencing it like this is wildly wrong. Not quite sure how they got there in the first place.

Reviewed By: igorsugak

Differential Revision: D41193389

fbshipit-source-id: 143c491df81125b319f7d5d88049021a81981795
2022-11-10 15:26:59 -08:00
Vladimir Makaev
f33975a3eb trace output buffers for clock_gettime
Reviewed By: jasonwhite

Differential Revision: D40946575

fbshipit-source-id: 5ca05f7d38ebd1eb7e031f017482ef8358bf1f2d
2022-11-08 04:39:12 -08:00
Vladimir Makaev
96c89f04e8 implement displayable_ptr! macro to simplify displayable implementation
Summary:
Implementing Displayable can be quite annoying (see D40877692)
This macro provides a boilerplate implementation for a custom struct wrapper for AddrMut<T>
Additional customization can be achieved by implementing Displayable for T

Reviewed By: jasonwhite

Differential Revision: D40946491

fbshipit-source-id: daff74b2c0c23c6d970f920c7d43ab2c381a1dcb
2022-11-08 04:39:12 -08:00
Vladimir Makaev
0ecbd32338 detlog "gettimeofday" output buffers
Summary: While investigating a test failure I've narrowed down a divergence to a gettimeofday syscall having different result in trace-replay use case in certain conditions. In this diff I'm enhacing the syscalls DETLOGS with "output buffers" derefed. Currently barelly any of the parameters are supported but hopefully we'll handle Displayable in a more general purpose way in a future

Reviewed By: jasonwhite

Differential Revision: D40877692

fbshipit-source-id: 47c3d310713e400fb2ab18dc736b84999e8c7b99
2022-11-08 04:39:12 -08:00
Jason White
ffd9f11127 Fix reverie-syscalls tests on aarch64
Reviewed By: wkhughes

Differential Revision: D40919201

fbshipit-source-id: 76e9d470fe6632d4c42232a6c7bbc41c2ac8d0f8
2022-11-03 12:53:11 -07:00
Jason White
b7bf8c32bd Add alias for Newfstatat syscall
Summary: The syscall `fstatat` is defined a bit weirdly on x86-64 as `newfstatat`. To make the platform differences slightly easier to deal with, lets just define a type alias for it.

Reviewed By: wkhughes

Differential Revision: D40910778

fbshipit-source-id: 4bf307e574d2d2c13f1cf764e7604b32113d209e
2022-11-03 12:53:11 -07:00
Jason White
ada1e3c542 Get tests building under aarch64
Reviewed By: VladimirMakaev

Differential Revision: D40701839

fbshipit-source-id: e60053c7d21696e7f7dd120420b896dee3d65ba7
2022-10-27 10:56:09 -07:00
Vladimir Makaev
03cbd6044d update hermetic_infra/** files with correct license header - 1/x
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
2022-10-26 12:18:14 -07:00
Jason White
adc75712a7 Add FICLONE and FICLONERANGE ioctls
Reviewed By: igorsugak

Differential Revision: D40521846

fbshipit-source-id: 25ec8d85ee0fc3c4df07637c9623505460a6670b
2022-10-19 13:37:38 -07:00
Nofel Yaseen
79de15c108 Enable aarch64 build
Summary: Get reverie-syscalls building on aarch64

Reviewed By: jasonwhite

Differential Revision: D40323777

fbshipit-source-id: bc7a326dc06deb2247a4b2a8f784b05745e961b7
2022-10-17 12:28:12 -07:00
Jason White
c4bd924994 Propagate typed_syscall!{} attributes
Differential Revision: D40329620

fbshipit-source-id: 5088249785601329aee6609c4873d991bdaf38f3
2022-10-13 10:15:47 -07:00
Jason White
b973b4ad42 Propagate syscall_list!{} attributes
Differential Revision: D40323825

fbshipit-source-id: 78deea76931058ed8eeb44250a0168ef400fee8a
2022-10-12 16:34:18 -07:00
Vladimir Makayev
de2fea408e Handle 'sysinfo' system call deterministically: use static values
Summary: Currently 'sysinfo' isn't being captured and determinized this might be a source of some divergencies in heap & stack. This diff with handle 'sysinfo' with hardcoded reasonable values. Follow up diffs with further enhance this

Reviewed By: rrnewton

Differential Revision: D39546772

fbshipit-source-id: a5a49e882a0fea4512bf991d257b0f8072f7f792
2022-09-18 18:49:13 -07:00
Stiopa Koltsov
e53c5ef362 Apply rustfmt
Reviewed By: zertosh

Differential Revision: D38485027

fbshipit-source-id: 0f5e5b743e002045c95aca427b76e969d6bce347
2022-08-06 08:21:44 -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
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
1bbfa8a5a2 Update copyright headers
Reviewed By: johnhurt

Differential Revision: D36727878

fbshipit-source-id: 2529052f6a81fb5a177ccdba51b7e0051577c148
2022-05-27 09:51:26 -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
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
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
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
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
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
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
facebook-github-bot
15d2f61411 Initial commit
fbshipit-source-id: c440d991296c92bdc5e109a11d269049e8840e94
2021-12-29 16:14:27 -08:00