mirror of
https://github.com/facebookexperimental/reverie.git
synced 2024-11-28 09:24:18 +00:00
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
This commit is contained in:
parent
05446620a2
commit
f507b56319
14 changed files with 127 additions and 120 deletions
|
@ -15,7 +15,7 @@ futures = { version = "0.3.13", features = ["async-await", "compat"] }
|
|||
libc = "0.2.121"
|
||||
nix = "0.23"
|
||||
serde = { version = "1.0.136", features = ["derive", "rc"] }
|
||||
syscalls = { version = "0.4.2", features = ["with-serde"] }
|
||||
syscalls = { version = "0.5", features = ["with-serde"] }
|
||||
thiserror = "1.0.30"
|
||||
tokio = { version = "1.15", features = ["full", "test-util", "tracing"] }
|
||||
|
||||
|
|
|
@ -86,7 +86,7 @@ impl Fd {
|
|||
/// file descriptor.
|
||||
pub fn pidfd_open(pid: libc::pid_t, flags: u32) -> Result<Self, Errno> {
|
||||
// TODO: Move this into its own PidFd type?
|
||||
unsafe { syscalls::syscall2(syscalls::Sysno::pidfd_open, pid as u64, flags as u64) }
|
||||
unsafe { syscalls::syscall2(syscalls::Sysno::pidfd_open, pid as usize, flags as usize) }
|
||||
.map(|fd| Self::new(fd as i32))
|
||||
}
|
||||
|
||||
|
@ -116,9 +116,9 @@ impl Fd {
|
|||
unsafe {
|
||||
syscalls::syscall3(
|
||||
syscalls::Sysno::pidfd_getfd,
|
||||
self.as_raw_fd() as u64,
|
||||
targetfd as u64,
|
||||
flags as u64,
|
||||
self.as_raw_fd() as usize,
|
||||
targetfd as usize,
|
||||
flags as usize,
|
||||
)
|
||||
}
|
||||
.map(|fd| Self::new(fd as i32))
|
||||
|
|
|
@ -474,7 +474,14 @@ impl<L: Tool> TracedTask<L> {
|
|||
fn get_syscall(&self, task: &Stopped) -> Result<Syscall, TraceError> {
|
||||
let regs = task.getregs()?;
|
||||
let nr = Sysno::from(regs.orig_rax as i32);
|
||||
let args = SyscallArgs::from(&[regs.rdi, regs.rsi, regs.rdx, regs.r10, regs.r8, regs.r9]);
|
||||
let args = SyscallArgs::new(
|
||||
regs.rdi as usize,
|
||||
regs.rsi as usize,
|
||||
regs.rdx as usize,
|
||||
regs.r10 as usize,
|
||||
regs.r8 as usize,
|
||||
regs.r9 as usize,
|
||||
);
|
||||
trace!(
|
||||
"[retrieve_task_state] translating ptrace event SECCOMP into syscall {}",
|
||||
nr
|
||||
|
@ -645,7 +652,7 @@ impl<L: Tool + 'static> TracedTask<L> {
|
|||
|
||||
// Make sure we got our desired address.
|
||||
assert_eq!(
|
||||
Errno::from_ret(task.getregs()?.rax as i64)? as u64,
|
||||
Errno::from_ret(task.getregs()?.rax as usize)? as u64,
|
||||
page_addr,
|
||||
"Could not mmap address {}",
|
||||
page_addr
|
||||
|
@ -1461,12 +1468,12 @@ impl<L: Tool + 'static> TracedTask<L> {
|
|||
let no = nr as u64;
|
||||
regs.orig_rax = no;
|
||||
regs.rax = no;
|
||||
regs.rdi = args.arg0;
|
||||
regs.rsi = args.arg1;
|
||||
regs.rdx = args.arg2;
|
||||
regs.r10 = args.arg3;
|
||||
regs.r8 = args.arg4;
|
||||
regs.r9 = args.arg5;
|
||||
regs.rdi = args.arg0 as u64;
|
||||
regs.rsi = args.arg1 as u64;
|
||||
regs.rdx = args.arg2 as u64;
|
||||
regs.r10 = args.arg3 as u64;
|
||||
regs.r8 = args.arg4 as u64;
|
||||
regs.r9 = args.arg5 as u64;
|
||||
|
||||
// instruction at PRIVATE_PAGE_OFFSET, see `populate_mmap_page`.
|
||||
// 7000_0000: 0f 05 syscall
|
||||
|
@ -1525,7 +1532,7 @@ impl<L: Tool + 'static> TracedTask<L> {
|
|||
// it back.
|
||||
restore_context(&stopped, context, None)?;
|
||||
}
|
||||
Ok(Errno::from_ret(regs.rax as i64))
|
||||
Ok(Errno::from_ret(regs.rax as usize).map(|x| x as i64))
|
||||
}
|
||||
Event::NewChild(op, child) => {
|
||||
let ret = child.pid().as_raw() as i64;
|
||||
|
@ -1539,7 +1546,7 @@ impl<L: Tool + 'static> TracedTask<L> {
|
|||
}
|
||||
Event::Syscall => {
|
||||
let regs = stopped.getregs()?;
|
||||
Ok(Errno::from_ret(regs.rax as i64))
|
||||
Ok(Errno::from_ret(regs.rax as usize).map(|x| x as i64))
|
||||
}
|
||||
st => panic!("untraced_syscall returned unknown state: {:?}", st),
|
||||
},
|
||||
|
|
|
@ -14,4 +14,4 @@ libc = "0.2.121"
|
|||
nix = "0.23"
|
||||
paste = "1.0"
|
||||
serde = { version = "1.0.136", features = ["derive", "rc"] }
|
||||
syscalls = { version = "0.4.2", features = ["with-serde"] }
|
||||
syscalls = { version = "0.5", features = ["with-serde"] }
|
||||
|
|
|
@ -86,12 +86,12 @@ impl Displayable for CloneFlags {
|
|||
}
|
||||
|
||||
impl FromToRaw for CloneFlags {
|
||||
fn from_raw(raw: u64) -> Self {
|
||||
unsafe { Self::from_bits_unchecked(raw) }
|
||||
fn from_raw(raw: usize) -> Self {
|
||||
unsafe { Self::from_bits_unchecked(raw as u64) }
|
||||
}
|
||||
|
||||
fn into_raw(self) -> u64 {
|
||||
self.bits() as u64
|
||||
fn into_raw(self) -> usize {
|
||||
self.bits() as usize
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ command_enum! {
|
|||
/// See [`ioctl_list(2)`][ioctl_list] for a more complete list.
|
||||
///
|
||||
/// [ioctl_list]: http://man7.org/linux/man-pages/man2/ioctl_list.2.html
|
||||
pub enum Request<'a>: libc::c_ulong {
|
||||
pub enum Request<'a>: usize {
|
||||
// <include/asm-i386/socket.h>
|
||||
FIOSETOWN(Option<Addr<'a, libc::c_int>>) = 0x00008901,
|
||||
SIOCSPGRP(Option<Addr<'a, libc::c_int>>) = 0x00008902,
|
||||
|
|
|
@ -101,11 +101,11 @@ where
|
|||
}
|
||||
|
||||
impl<'a, T> FromToRaw for Option<CArrayPtr<'a, T>> {
|
||||
fn from_raw(raw: u64) -> Self {
|
||||
fn from_raw(raw: usize) -> Self {
|
||||
Option::<Addr<'a, Option<T>>>::from_raw(raw).map(CArrayPtr)
|
||||
}
|
||||
|
||||
fn into_raw(self) -> u64 {
|
||||
fn into_raw(self) -> usize {
|
||||
self.map(|p| p.0).into_raw()
|
||||
}
|
||||
}
|
||||
|
@ -178,11 +178,11 @@ impl<'a> ReadAddr for CStrPtr<'a> {
|
|||
}
|
||||
|
||||
impl<'a> FromToRaw for Option<CStrPtr<'a>> {
|
||||
fn from_raw(raw: u64) -> Self {
|
||||
fn from_raw(raw: usize) -> Self {
|
||||
Option::<Addr<'a, u8>>::from_raw(raw).map(CStrPtr)
|
||||
}
|
||||
|
||||
fn into_raw(self) -> u64 {
|
||||
fn into_raw(self) -> usize {
|
||||
self.map(|p| p.0).into_raw()
|
||||
}
|
||||
}
|
||||
|
@ -249,11 +249,11 @@ impl<'a> ReadAddr for PathPtr<'a> {
|
|||
}
|
||||
|
||||
impl<'a> FromToRaw for Option<PathPtr<'a>> {
|
||||
fn from_raw(raw: u64) -> Self {
|
||||
fn from_raw(raw: usize) -> Self {
|
||||
Option::<CStrPtr<'a>>::from_raw(raw).map(PathPtr)
|
||||
}
|
||||
|
||||
fn into_raw(self) -> u64 {
|
||||
fn into_raw(self) -> usize {
|
||||
self.map(|p| p.0).into_raw()
|
||||
}
|
||||
}
|
||||
|
@ -297,11 +297,11 @@ impl<'a> ReadAddr for StatPtr<'a> {
|
|||
}
|
||||
|
||||
impl<'a> FromToRaw for Option<StatPtr<'a>> {
|
||||
fn from_raw(raw: u64) -> Self {
|
||||
fn from_raw(raw: usize) -> Self {
|
||||
Option::<AddrMut<'a, libc::stat>>::from_raw(raw).map(StatPtr)
|
||||
}
|
||||
|
||||
fn into_raw(self) -> u64 {
|
||||
fn into_raw(self) -> usize {
|
||||
self.map(|p| p.0).into_raw()
|
||||
}
|
||||
}
|
||||
|
@ -361,11 +361,11 @@ impl<'a> ReadAddr for StatxPtr<'a> {
|
|||
}
|
||||
|
||||
impl<'a> FromToRaw for Option<StatxPtr<'a>> {
|
||||
fn from_raw(raw: u64) -> Self {
|
||||
fn from_raw(raw: usize) -> Self {
|
||||
Option::<AddrMut<'a, libc::statx>>::from_raw(raw).map(StatxPtr)
|
||||
}
|
||||
|
||||
fn into_raw(self) -> u64 {
|
||||
fn into_raw(self) -> usize {
|
||||
self.map(|p| p.0).into_raw()
|
||||
}
|
||||
}
|
||||
|
@ -447,12 +447,12 @@ impl Default for StatxMask {
|
|||
}
|
||||
|
||||
impl FromToRaw for StatxMask {
|
||||
fn from_raw(raw: u64) -> Self {
|
||||
fn from_raw(raw: usize) -> Self {
|
||||
StatxMask::from_bits_truncate(raw as u32)
|
||||
}
|
||||
|
||||
fn into_raw(self) -> u64 {
|
||||
self.bits() as u64
|
||||
fn into_raw(self) -> usize {
|
||||
self.bits() as usize
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -83,12 +83,12 @@ bitflags::bitflags! {
|
|||
}
|
||||
|
||||
impl FromToRaw for PollFlags {
|
||||
fn from_raw(raw: u64) -> Self {
|
||||
fn from_raw(raw: usize) -> Self {
|
||||
Self::from_bits_truncate(raw as libc::c_short)
|
||||
}
|
||||
|
||||
fn into_raw(self) -> u64 {
|
||||
self.bits() as u64
|
||||
fn into_raw(self) -> usize {
|
||||
self.bits() as usize
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -480,7 +480,7 @@ macro_rules! typed_syscall {
|
|||
) => {
|
||||
typed_syscall! {
|
||||
$(#[$attrs])*
|
||||
$vis struct $Name -> u64 {
|
||||
$vis struct $Name -> usize {
|
||||
$($vals)*
|
||||
}
|
||||
}
|
||||
|
@ -522,7 +522,7 @@ macro_rules! syscall_list {
|
|||
}
|
||||
|
||||
impl $crate::SyscallInfo for $name {
|
||||
type Return = Result<u64, $crate::Errno>;
|
||||
type Return = Result<usize, $crate::Errno>;
|
||||
|
||||
fn name(&self) -> &'static str {
|
||||
match self {
|
||||
|
@ -621,7 +621,7 @@ macro_rules! command_enum {
|
|||
)*
|
||||
|
||||
/// Catch-all case when we don't know the command and its argument.
|
||||
Other($type, u64),
|
||||
Other($type, usize),
|
||||
}
|
||||
|
||||
impl<$($lt,)*> ::core::fmt::Display for $name<$($lt,)*> {
|
||||
|
@ -657,7 +657,7 @@ macro_rules! command_enum {
|
|||
|
||||
impl<$($lt,)*> $name<$($lt,)*> {
|
||||
/// Creates the enum from raw arguments.
|
||||
pub fn from_raw(cmd: $type, arg: u64) -> Self {
|
||||
pub fn from_raw(cmd: $type, arg: usize) -> Self {
|
||||
match cmd {
|
||||
$(
|
||||
$(#[$meta])*
|
||||
|
@ -668,7 +668,7 @@ macro_rules! command_enum {
|
|||
}
|
||||
|
||||
/// Converts the enum into raw arguments.
|
||||
pub fn into_raw(self) -> ($type, u64) {
|
||||
pub fn into_raw(self) -> ($type, usize) {
|
||||
match self {
|
||||
$(
|
||||
$(#[$meta])*
|
||||
|
@ -793,12 +793,12 @@ macro_rules! const_enum {
|
|||
}
|
||||
|
||||
impl $crate::FromToRaw for $Name {
|
||||
fn from_raw(raw: u64) -> Self {
|
||||
fn from_raw(raw: usize) -> Self {
|
||||
Self(raw as $inner)
|
||||
}
|
||||
|
||||
fn into_raw(self) -> u64 {
|
||||
self.0 as u64
|
||||
fn into_raw(self) -> usize {
|
||||
self.0 as usize
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -32,96 +32,96 @@ use crate::{Addr, AddrMut, Errno};
|
|||
/// information and conversions should never fail. This ensures that adding type
|
||||
/// information to a value will always be forward compatible.
|
||||
///
|
||||
/// This trait is very similar to `From<u64>` and `Into<u64>`. Instead of reusing
|
||||
/// those existing traits, this separate trait is necessary such that it can be
|
||||
/// implemented for foreign types.
|
||||
/// This trait is very similar to `From<usize>` and `Into<usize>`. Instead of
|
||||
/// reusing those existing traits, this separate trait is necessary such that it
|
||||
/// can be implemented for foreign types.
|
||||
pub trait FromToRaw: Sized {
|
||||
/// Converts a raw value into this type.
|
||||
fn from_raw(value: u64) -> Self;
|
||||
fn from_raw(value: usize) -> Self;
|
||||
|
||||
/// Converts this type into a raw value.
|
||||
fn into_raw(self) -> u64;
|
||||
fn into_raw(self) -> usize;
|
||||
}
|
||||
|
||||
impl FromToRaw for u32 {
|
||||
fn from_raw(raw: u64) -> Self {
|
||||
fn from_raw(raw: usize) -> Self {
|
||||
raw as Self
|
||||
}
|
||||
|
||||
fn into_raw(self) -> u64 {
|
||||
self as u64
|
||||
fn into_raw(self) -> usize {
|
||||
self as usize
|
||||
}
|
||||
}
|
||||
|
||||
impl FromToRaw for i32 {
|
||||
fn from_raw(raw: u64) -> Self {
|
||||
fn from_raw(raw: usize) -> Self {
|
||||
raw as Self
|
||||
}
|
||||
|
||||
fn into_raw(self) -> u64 {
|
||||
self as u64
|
||||
}
|
||||
}
|
||||
|
||||
impl FromToRaw for u64 {
|
||||
fn from_raw(raw: u64) -> Self {
|
||||
raw
|
||||
}
|
||||
|
||||
fn into_raw(self) -> u64 {
|
||||
self
|
||||
fn into_raw(self) -> usize {
|
||||
self as usize
|
||||
}
|
||||
}
|
||||
|
||||
impl FromToRaw for usize {
|
||||
fn from_raw(raw: u64) -> Self {
|
||||
fn from_raw(raw: usize) -> Self {
|
||||
raw
|
||||
}
|
||||
|
||||
fn into_raw(self) -> usize {
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
impl FromToRaw for u64 {
|
||||
fn from_raw(raw: usize) -> Self {
|
||||
raw as Self
|
||||
}
|
||||
|
||||
fn into_raw(self) -> u64 {
|
||||
self as u64
|
||||
fn into_raw(self) -> usize {
|
||||
self as usize
|
||||
}
|
||||
}
|
||||
|
||||
impl FromToRaw for i64 {
|
||||
fn from_raw(raw: u64) -> Self {
|
||||
fn from_raw(raw: usize) -> Self {
|
||||
raw as Self
|
||||
}
|
||||
|
||||
fn into_raw(self) -> u64 {
|
||||
self as u64
|
||||
fn into_raw(self) -> usize {
|
||||
self as usize
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, T> FromToRaw for Option<Addr<'a, T>> {
|
||||
fn from_raw(raw: u64) -> Self {
|
||||
fn from_raw(raw: usize) -> Self {
|
||||
Addr::from_raw(raw as usize)
|
||||
}
|
||||
|
||||
fn into_raw(self) -> u64 {
|
||||
self.map_or(0, |addr| addr.as_raw() as u64)
|
||||
fn into_raw(self) -> usize {
|
||||
self.map_or(0, |addr| addr.as_raw() as usize)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, T> FromToRaw for Option<AddrMut<'a, T>> {
|
||||
fn from_raw(raw: u64) -> Self {
|
||||
fn from_raw(raw: usize) -> Self {
|
||||
AddrMut::from_raw(raw as usize)
|
||||
}
|
||||
|
||||
fn into_raw(self) -> u64 {
|
||||
self.map_or(0, |addr| addr.as_raw() as u64)
|
||||
fn into_raw(self) -> usize {
|
||||
self.map_or(0, |addr| addr.as_raw() as usize)
|
||||
}
|
||||
}
|
||||
|
||||
macro_rules! impl_raw_bits {
|
||||
($t:ty : $inner:ty) => {
|
||||
impl $crate::FromToRaw for $t {
|
||||
fn from_raw(raw: u64) -> Self {
|
||||
fn from_raw(raw: usize) -> Self {
|
||||
unsafe { Self::from_bits_unchecked(raw as $inner) }
|
||||
}
|
||||
|
||||
fn into_raw(self) -> u64 {
|
||||
self.bits() as u64
|
||||
fn into_raw(self) -> usize {
|
||||
self.bits() as usize
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -146,7 +146,7 @@ impl_raw_bits!(SfdFlags);
|
|||
impl_raw_bits!(TimerFlags);
|
||||
|
||||
impl FromToRaw for Option<Mode> {
|
||||
fn from_raw(raw: u64) -> Self {
|
||||
fn from_raw(raw: usize) -> Self {
|
||||
if raw == 0 {
|
||||
None
|
||||
} else {
|
||||
|
@ -154,7 +154,7 @@ impl FromToRaw for Option<Mode> {
|
|||
}
|
||||
}
|
||||
|
||||
fn into_raw(self) -> u64 {
|
||||
fn into_raw(self) -> usize {
|
||||
match self {
|
||||
None => 0,
|
||||
Some(mode) => mode.into_raw(),
|
||||
|
@ -163,12 +163,12 @@ impl FromToRaw for Option<Mode> {
|
|||
}
|
||||
|
||||
impl FromToRaw for Pid {
|
||||
fn from_raw(raw: u64) -> Self {
|
||||
fn from_raw(raw: usize) -> Self {
|
||||
Pid::from_raw(raw as i32)
|
||||
}
|
||||
|
||||
fn into_raw(self) -> u64 {
|
||||
self.as_raw() as u64
|
||||
fn into_raw(self) -> usize {
|
||||
self.as_raw() as usize
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -176,14 +176,14 @@ impl<T> FromToRaw for Result<T, Errno>
|
|||
where
|
||||
T: FromToRaw,
|
||||
{
|
||||
fn from_raw(raw: u64) -> Self {
|
||||
Errno::from_ret(raw as i64).map(|x| T::from_raw(x as u64))
|
||||
fn from_raw(raw: usize) -> Self {
|
||||
Errno::from_ret(raw).map(|x| T::from_raw(x as usize))
|
||||
}
|
||||
|
||||
fn into_raw(self) -> u64 {
|
||||
fn into_raw(self) -> usize {
|
||||
match self {
|
||||
Ok(x) => x.into_raw(),
|
||||
Err(err) => -err.into_raw() as u64,
|
||||
Err(err) => -err.into_raw() as usize,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -196,7 +196,7 @@ mod test {
|
|||
#[test]
|
||||
fn test_results() {
|
||||
assert_eq!(
|
||||
Result::<Pid, Errno>::from_raw(-2i64 as u64),
|
||||
Result::<Pid, Errno>::from_raw(-2isize as usize),
|
||||
Err(Errno::ENOENT)
|
||||
);
|
||||
|
||||
|
|
|
@ -444,7 +444,7 @@ typed_syscall! {
|
|||
}
|
||||
}
|
||||
|
||||
fn get_mode(flags: OFlag, mode: u64) -> Option<Mode> {
|
||||
fn get_mode(flags: OFlag, mode: usize) -> Option<Mode> {
|
||||
if flags.intersects(OFlag::O_CREAT | OFlag::O_TMPFILE) {
|
||||
Some(FromToRaw::from_raw(mode))
|
||||
} else {
|
||||
|
@ -478,7 +478,7 @@ impl From<Creat> for Open {
|
|||
fn from(creat: Creat) -> Self {
|
||||
let Creat { mut raw } = creat;
|
||||
raw.arg2 = raw.arg1;
|
||||
raw.arg1 = (libc::O_CREAT | libc::O_WRONLY | libc::O_TRUNC) as u64;
|
||||
raw.arg1 = (libc::O_CREAT | libc::O_WRONLY | libc::O_TRUNC) as usize;
|
||||
Open { raw }
|
||||
}
|
||||
}
|
||||
|
@ -940,7 +940,7 @@ impl From<Vfork> for Clone {
|
|||
/// See kernel/fork.c for more details.
|
||||
fn from(_: Vfork) -> Self {
|
||||
let raw = SyscallArgs {
|
||||
arg0: (libc::CLONE_VFORK | libc::CLONE_VM | libc::SIGCHLD) as u64,
|
||||
arg0: (libc::CLONE_VFORK | libc::CLONE_VM | libc::SIGCHLD) as usize,
|
||||
arg1: 0,
|
||||
arg2: 0,
|
||||
arg3: 0,
|
||||
|
@ -958,7 +958,7 @@ impl From<Fork> for Clone {
|
|||
/// See kernel/fork.c for more details.
|
||||
fn from(_: Fork) -> Self {
|
||||
let raw = SyscallArgs {
|
||||
arg0: libc::SIGCHLD as u64,
|
||||
arg0: libc::SIGCHLD as usize,
|
||||
arg1: 0,
|
||||
arg2: 0,
|
||||
arg3: 0,
|
||||
|
@ -1092,7 +1092,7 @@ typed_syscall! {
|
|||
|
||||
fn set(mut self, v: FcntlCmd) -> Self {
|
||||
let (cmd, arg) = v.into_raw();
|
||||
self.raw.arg1 = cmd as u64;
|
||||
self.raw.arg1 = cmd as usize;
|
||||
self.raw.arg2 = arg;
|
||||
self
|
||||
}
|
||||
|
@ -1483,8 +1483,8 @@ typed_syscall! {
|
|||
typed_syscall! {
|
||||
pub struct Sysfs {
|
||||
option: i32,
|
||||
arg1: u64,
|
||||
arg2: u64,
|
||||
arg1: usize,
|
||||
arg2: usize,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1578,7 +1578,7 @@ typed_syscall! {
|
|||
pub struct ModifyLdt {
|
||||
func: i32,
|
||||
ptr: Option<AddrMut<libc::c_void>>,
|
||||
bytecount: u64,
|
||||
bytecount: usize,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1616,7 +1616,7 @@ typed_syscall! {
|
|||
|
||||
fn set(mut self, v: ArchPrctlCmd) -> Self {
|
||||
let (cmd, arg) = v.into_raw();
|
||||
self.raw.arg0 = cmd as u64;
|
||||
self.raw.arg0 = cmd as usize;
|
||||
self.raw.arg1 = arg;
|
||||
self
|
||||
}
|
||||
|
@ -2395,7 +2395,7 @@ impl From<Open> for Openat {
|
|||
raw.arg3 = raw.arg2;
|
||||
raw.arg2 = raw.arg1;
|
||||
raw.arg1 = raw.arg0;
|
||||
raw.arg0 = libc::AT_FDCWD as u64;
|
||||
raw.arg0 = libc::AT_FDCWD as usize;
|
||||
Openat { raw }
|
||||
}
|
||||
}
|
||||
|
@ -2406,9 +2406,9 @@ impl From<Creat> for Openat {
|
|||
fn from(creat: Creat) -> Self {
|
||||
let Creat { mut raw } = creat;
|
||||
raw.arg3 = raw.arg1;
|
||||
raw.arg2 = (libc::O_CREAT | libc::O_WRONLY | libc::O_TRUNC) as u64;
|
||||
raw.arg2 = (libc::O_CREAT | libc::O_WRONLY | libc::O_TRUNC) as usize;
|
||||
raw.arg1 = raw.arg0;
|
||||
raw.arg0 = libc::AT_FDCWD as u64;
|
||||
raw.arg0 = libc::AT_FDCWD as usize;
|
||||
Openat { raw }
|
||||
}
|
||||
}
|
||||
|
@ -2429,7 +2429,7 @@ impl From<Mkdir> for Mkdirat {
|
|||
let Mkdir { mut raw } = syscall;
|
||||
raw.arg2 = raw.arg1;
|
||||
raw.arg1 = raw.arg0;
|
||||
raw.arg0 = libc::AT_FDCWD as u64;
|
||||
raw.arg0 = libc::AT_FDCWD as usize;
|
||||
Mkdirat { raw }
|
||||
}
|
||||
}
|
||||
|
@ -2452,7 +2452,7 @@ impl From<Mknod> for Mknodat {
|
|||
raw.arg3 = raw.arg2;
|
||||
raw.arg2 = raw.arg1;
|
||||
raw.arg1 = raw.arg0;
|
||||
raw.arg0 = libc::AT_FDCWD as u64;
|
||||
raw.arg0 = libc::AT_FDCWD as usize;
|
||||
Mknodat { raw }
|
||||
}
|
||||
}
|
||||
|
@ -2490,7 +2490,7 @@ impl From<Stat> for Newfstatat {
|
|||
raw.arg3 = 0;
|
||||
raw.arg2 = raw.arg1;
|
||||
raw.arg1 = raw.arg0;
|
||||
raw.arg0 = libc::AT_FDCWD as u64;
|
||||
raw.arg0 = libc::AT_FDCWD as usize;
|
||||
Newfstatat { raw }
|
||||
}
|
||||
}
|
||||
|
@ -2498,10 +2498,10 @@ impl From<Stat> for Newfstatat {
|
|||
impl From<Lstat> for Newfstatat {
|
||||
fn from(lstat: Lstat) -> Self {
|
||||
let Lstat { mut raw } = lstat;
|
||||
raw.arg3 = AtFlags::AT_SYMLINK_NOFOLLOW.bits() as u64;
|
||||
raw.arg3 = AtFlags::AT_SYMLINK_NOFOLLOW.bits() as usize;
|
||||
raw.arg2 = raw.arg1;
|
||||
raw.arg1 = raw.arg0;
|
||||
raw.arg0 = libc::AT_FDCWD as u64;
|
||||
raw.arg0 = libc::AT_FDCWD as usize;
|
||||
Newfstatat { raw }
|
||||
}
|
||||
}
|
||||
|
@ -2519,7 +2519,7 @@ impl From<Unlink> for Unlinkat {
|
|||
let Unlink { mut raw } = unlink;
|
||||
raw.arg2 = 0;
|
||||
raw.arg1 = raw.arg0;
|
||||
raw.arg0 = libc::AT_FDCWD as u64;
|
||||
raw.arg0 = libc::AT_FDCWD as usize;
|
||||
Unlinkat { raw }
|
||||
}
|
||||
}
|
||||
|
@ -2527,9 +2527,9 @@ impl From<Unlink> for Unlinkat {
|
|||
impl From<Rmdir> for Unlinkat {
|
||||
fn from(rmdir: Rmdir) -> Self {
|
||||
let Rmdir { mut raw } = rmdir;
|
||||
raw.arg2 = libc::AT_REMOVEDIR as u64;
|
||||
raw.arg2 = libc::AT_REMOVEDIR as usize;
|
||||
raw.arg1 = raw.arg0;
|
||||
raw.arg0 = libc::AT_FDCWD as u64;
|
||||
raw.arg0 = libc::AT_FDCWD as usize;
|
||||
Unlinkat { raw }
|
||||
}
|
||||
}
|
||||
|
@ -2563,8 +2563,8 @@ impl From<Link> for Linkat {
|
|||
let Link { mut raw } = link;
|
||||
raw.arg3 = raw.arg1;
|
||||
raw.arg1 = raw.arg0;
|
||||
raw.arg0 = libc::AT_FDCWD as u64;
|
||||
raw.arg2 = libc::AT_FDCWD as u64;
|
||||
raw.arg0 = libc::AT_FDCWD as usize;
|
||||
raw.arg2 = libc::AT_FDCWD as usize;
|
||||
raw.arg4 = 0;
|
||||
Linkat { raw }
|
||||
}
|
||||
|
@ -3094,9 +3094,9 @@ impl From<Rename> for Renameat2 {
|
|||
let Rename { mut raw } = rename;
|
||||
raw.arg4 = 0;
|
||||
raw.arg3 = raw.arg1;
|
||||
raw.arg2 = libc::AT_FDCWD as u64;
|
||||
raw.arg2 = libc::AT_FDCWD as usize;
|
||||
raw.arg1 = raw.arg0;
|
||||
raw.arg0 = libc::AT_FDCWD as u64;
|
||||
raw.arg0 = libc::AT_FDCWD as usize;
|
||||
Renameat2 { raw }
|
||||
}
|
||||
}
|
||||
|
@ -3172,7 +3172,7 @@ impl From<Execve> for Execveat {
|
|||
raw.arg3 = raw.arg2;
|
||||
raw.arg2 = raw.arg1;
|
||||
raw.arg1 = raw.arg0;
|
||||
raw.arg0 = libc::AT_FDCWD as u64;
|
||||
raw.arg0 = libc::AT_FDCWD as usize;
|
||||
Execveat { raw }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ impl Tool for LocalState {
|
|||
Syscall::Signalfd4(_) => {
|
||||
let (_, args) = syscall.into_parts();
|
||||
assert_eq!(args.arg2, 8);
|
||||
assert_eq!(args.arg3, libc::SFD_CLOEXEC as u64);
|
||||
assert_eq!(args.arg3, libc::SFD_CLOEXEC as usize);
|
||||
guest.tail_inject(syscall).await
|
||||
}
|
||||
_ => guest.tail_inject(syscall).await,
|
||||
|
|
|
@ -149,11 +149,11 @@ impl Tool for LocalState {
|
|||
let clock_value = guest.read_clock().unwrap();
|
||||
let ts = guest.thread_state_mut();
|
||||
ts.last_tick = clock_value;
|
||||
ts.timer_assertion = Some(args.arg0);
|
||||
ts.timer_assertion = Some(args.arg0 as u64);
|
||||
}
|
||||
Sysno::clock_adjtime => assert_eq!(
|
||||
guest.read_clock().unwrap(),
|
||||
guest.thread_state_mut().last_tick + args.arg0
|
||||
guest.thread_state_mut().last_tick + args.arg0 as u64
|
||||
),
|
||||
_ => guest.tail_inject(syscall).await,
|
||||
};
|
||||
|
|
|
@ -57,7 +57,7 @@ impl Tool for LocalStateVforkClone {
|
|||
// vfork is very tricky because child/parent share the same stack. see P153347946 for
|
||||
// a bit more context.
|
||||
let raw: SyscallArgs = SyscallArgs {
|
||||
arg0: (libc::CLONE_VFORK | libc::CLONE_VM | libc::SIGCHLD) as u64,
|
||||
arg0: (libc::CLONE_VFORK | libc::CLONE_VM | libc::SIGCHLD) as usize,
|
||||
arg1: 0,
|
||||
arg2: 0,
|
||||
arg3: 0,
|
||||
|
|
Loading…
Reference in a new issue