Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion crates/fspy/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#![cfg_attr(target_os = "windows", feature(windows_process_extensions_main_thread_handle))]
#![feature(once_cell_try)]

pub mod error;

Expand Down
12 changes: 6 additions & 6 deletions crates/fspy_preload_unix/src/interceptions/linux_syscall.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ intercept!(syscall(64): unsafe extern "C" fn(c_long, args: ...) -> c_long);
unsafe extern "C" fn syscall(syscall_no: c_long, mut args: ...) -> c_long {
// https://github.com/bminor/glibc/blob/efc8642051e6c4fe5165e8986c1338ba2c180de6/sysdeps/unix/sysv/linux/syscall.c#L23
// SAFETY: extracting variadic arguments matching the syscall ABI; the caller passes at least 6 c_long arguments
let a0 = unsafe { args.arg::<c_long>() };
let a0 = unsafe { args.next_arg::<c_long>() };
// SAFETY: extracting variadic arguments matching the syscall ABI
let a1 = unsafe { args.arg::<c_long>() };
let a1 = unsafe { args.next_arg::<c_long>() };
// SAFETY: extracting variadic arguments matching the syscall ABI
let a2 = unsafe { args.arg::<c_long>() };
let a2 = unsafe { args.next_arg::<c_long>() };
// SAFETY: extracting variadic arguments matching the syscall ABI
let a3 = unsafe { args.arg::<c_long>() };
let a3 = unsafe { args.next_arg::<c_long>() };
// SAFETY: extracting variadic arguments matching the syscall ABI
let a4 = unsafe { args.arg::<c_long>() };
let a4 = unsafe { args.next_arg::<c_long>() };
// SAFETY: extracting variadic arguments matching the syscall ABI
let a5 = unsafe { args.arg::<c_long>() };
let a5 = unsafe { args.next_arg::<c_long>() };

if syscall_no == libc::SYS_statx {
// c-style conversion is expected: (4294967196 -> -100 aka libc::AT_FDCWD)
Expand Down
4 changes: 2 additions & 2 deletions crates/fspy_preload_unix/src/interceptions/open.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ unsafe extern "C" fn open(path: *const c_char, flags: c_int, mut args: ...) -> c
unsafe { handle_open(path, OpenFlags(flags)) };
if has_mode_arg(flags) {
// SAFETY: when O_CREAT or O_TMPFILE is set, a mode_t argument is required by the open() contract
let mode: Mode = unsafe { args.arg() };
let mode: Mode = unsafe { args.next_arg() };
// SAFETY: calling the original libc open() with the same arguments forwarded from the interposed function
unsafe { open::original()(path, flags, mode) }
} else {
Expand All @@ -53,7 +53,7 @@ unsafe extern "C" fn openat(
if has_mode_arg(flags) {
// https://github.com/tailhook/openat/issues/21#issuecomment-535914957
// SAFETY: when O_CREAT or O_TMPFILE is set, a mode_t argument is required by the openat() contract
let mode: Mode = unsafe { args.arg() };
let mode: Mode = unsafe { args.next_arg() };
// SAFETY: calling the original libc openat() with the same arguments forwarded from the interposed function
unsafe { openat::original()(dirfd, path, flags, mode) }
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ unsafe extern "C" fn execle(path: *const c_char, arg0: *const c_char, valist: ..
// SAFETY: valist and arg0 are valid variadic arguments forwarded from the interposed execle function
unsafe {
with_argv(valist, arg0, |args, mut remaining| {
let envp = remaining.arg::<*const *const c_char>();
let envp = remaining.next_arg::<*const *const c_char>();
handle_exec(ExecResolveConfig::search_path_disabled(), path, args.as_ptr(), envp)
})
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub unsafe fn with_argv(
let argc = 1 + {
let mut va = va.clone();
// Safety: argv is guaranteed to be NULL-terminated
core::iter::from_fn(|| Some(unsafe { va.arg::<*const c_char>() }))
core::iter::from_fn(|| Some(unsafe { va.next_arg::<*const c_char>() }))
.position(|s| {
// Find the NULL terminator
s.is_null()
Expand Down Expand Up @@ -47,11 +47,11 @@ pub unsafe fn with_argv(

for item in out.iter_mut().take(argc).skip(1) {
// SAFETY: extracting the next *const c_char argument from the va_list; the count was pre-validated
item.write(unsafe { va.arg::<*const c_char>() });
item.write(unsafe { va.next_arg::<*const c_char>() });
}
out[argc].write(core::ptr::null());
// SAFETY: consuming the NULL terminator from the va_list to advance past it
unsafe { va.arg::<*const c_char>() };
unsafe { va.next_arg::<*const c_char>() };

// Safety: MaybeUninit<*const c_char> has the same layout as *const c_char,
// and all elements have been initialized via write() above.
Expand Down
1 change: 0 additions & 1 deletion crates/fspy_seccomp_unotify/src/supervisor/handler/arg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,6 @@ impl Fd {
}

impl FromSyscallArg for Fd {
#[expect(clippy::cast_possible_truncation, reason = "syscall arg represents a file descriptor")]
fn from_syscall_arg(arg: u64) -> io::Result<Self> {
Ok(Self { fd: arg as RawFd })
}
Expand Down
4 changes: 2 additions & 2 deletions crates/fspy_seccomp_unotify/tests/arg_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ async fn fd_and_path() -> Result<(), Box<dyn Error>> {

#[tokio::test]
async fn path_long() -> Result<(), Box<dyn Error>> {
let long_path = [b'a'].repeat(30000);
let long_path = b"a".repeat(30000);
let long_path_cstr = CString::new(long_path.as_slice()).unwrap();
let syscalls = run_in_pre_exec(move || {
let _ = openat(AT_FDCWD, long_path_cstr.as_c_str(), OFlag::O_RDONLY, Mode::empty());
Expand All @@ -129,7 +129,7 @@ async fn path_long() -> Result<(), Box<dyn Error>> {

#[tokio::test]
async fn path_overflow() -> Result<(), Box<dyn Error>> {
let long_path = [b'a'].repeat(40000);
let long_path = b"a".repeat(40000);
let long_path_cstr = CString::new(long_path.as_slice()).unwrap();
let syscalls = run_in_pre_exec(move || {
let _ = openat(AT_FDCWD, long_path_cstr.as_c_str(), OFlag::O_RDONLY, Mode::empty());
Expand Down
8 changes: 4 additions & 4 deletions crates/preload_test_lib/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ pub unsafe extern "C" fn open(path: *const c_char, flags: c_int, mut args: ...)
if has_mode_arg(flags) {
// SAFETY: `O_CREAT`/`O_TMPFILE` guarantees a `mode_t` follows per
// the `open(2)` contract.
let mode: libc::mode_t = unsafe { args.arg() };
let mode: libc::mode_t = unsafe { args.next_arg() };
// SAFETY: forwarding the caller's arguments unchanged.
unsafe { next_open()(path, flags, mode) }
} else {
Expand All @@ -103,7 +103,7 @@ pub unsafe extern "C" fn open64(path: *const c_char, flags: c_int, mut args: ...
if has_mode_arg(flags) {
// SAFETY: `O_CREAT`/`O_TMPFILE` guarantees a `mode_t` follows per
// the `open64(2)` contract.
let mode: libc::mode_t = unsafe { args.arg() };
let mode: libc::mode_t = unsafe { args.next_arg() };
// SAFETY: forwarding the caller's arguments unchanged.
unsafe { next_open64()(path, flags, mode) }
} else {
Expand All @@ -127,7 +127,7 @@ pub unsafe extern "C" fn openat(
if has_mode_arg(flags) {
// SAFETY: `O_CREAT`/`O_TMPFILE` guarantees a `mode_t` follows per
// the `openat(2)` contract.
let mode: libc::mode_t = unsafe { args.arg() };
let mode: libc::mode_t = unsafe { args.next_arg() };
// SAFETY: forwarding the caller's arguments unchanged.
unsafe { next_openat()(dirfd, path, flags, mode) }
} else {
Expand All @@ -151,7 +151,7 @@ pub unsafe extern "C" fn openat64(
if has_mode_arg(flags) {
// SAFETY: `O_CREAT`/`O_TMPFILE` guarantees a `mode_t` follows per
// the `openat64(2)` contract.
let mode: libc::mode_t = unsafe { args.arg() };
let mode: libc::mode_t = unsafe { args.next_arg() };
// SAFETY: forwarding the caller's arguments unchanged.
unsafe { next_openat64()(dirfd, path, flags, mode) }
} else {
Expand Down
4 changes: 2 additions & 2 deletions crates/pty_terminal/tests/terminal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ fn resize_terminal() {
stdout().flush().unwrap();
}));

let Terminal { mut pty_reader, mut pty_writer, child_handle: _, .. } =
let Terminal { mut pty_reader, mut pty_writer, .. } =
Terminal::spawn(ScreenSize { rows: 80, cols: 80 }, cmd).unwrap();

// Wait for initial size line (synchronize before resizing)
Expand Down Expand Up @@ -349,7 +349,7 @@ fn send_ctrl_c_interrupts_process() {
}
}));

let Terminal { mut pty_reader, mut pty_writer, child_handle: _, .. } =
let Terminal { mut pty_reader, mut pty_writer, .. } =
Terminal::spawn(ScreenSize { rows: 80, cols: 80 }, cmd).unwrap();

// Wait for process to be ready
Expand Down
2 changes: 1 addition & 1 deletion crates/vite_path/src/absolute/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ impl Display for StripPrefixError<'_> {
f.write_fmt(format_args!(
"{}: {}",
self.stripped_path.display(),
&self.invalid_path_data_error
self.invalid_path_data_error
))
}
}
Expand Down
2 changes: 1 addition & 1 deletion crates/vite_task/src/session/cache/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ impl ExecutionCache {
} else if old_input_config != cache_metadata.input_config {
FingerprintMismatch::InputConfig
} else {
debug_assert!(old_output_config != cache_metadata.output_config);
debug_assert_ne!(old_output_config, cache_metadata.output_config);
FingerprintMismatch::OutputConfig
};
return Ok(Err(CacheMiss::FingerprintMismatch(mismatch)));
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
# Needed nightly features:
# - cargo `Z-bindeps` to build and embed preload shared libraries as dependencies of fspy
# - `windows_process_extensions_main_thread_handle` to get the main thread handle for Detours injection
channel = "nightly-2026-03-05"
channel = "nightly-2026-05-24"
profile = "default"
Loading