From dabd98056778238e9e1b9f0668183c7cb635d2b1 Mon Sep 17 00:00:00 2001 From: Mara Bos Date: Fri, 2 Oct 2020 20:53:31 +0200 Subject: [PATCH] Update note about number of arguments to SYS_futex. --- src/shims/posix/linux/sync.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/shims/posix/linux/sync.rs b/src/shims/posix/linux/sync.rs index 8da6921653c..ae905836867 100644 --- a/src/shims/posix/linux/sync.rs +++ b/src/shims/posix/linux/sync.rs @@ -8,8 +8,13 @@ pub fn futex<'tcx>( dest: PlaceTy<'tcx, Tag>, ) -> InterpResult<'tcx> { // The amount of arguments used depends on the type of futex operation. - // Some users always pass all arguments, even the unused ones, due to how they wrap this syscall in their code base. - // Some other users pass only the arguments the operation actually needs. So we don't use `check_arg_count` here. + // The full futex syscall takes six arguments (excluding the syscall + // number), which is also the maximum amount of arguments a linux syscall + // can take on most architectures. + // However, not all futex operations use all six arguments. The unused ones + // may or may not be left out from the `syscall()` call. + // Therefore we don't use `check_arg_count` here, but only check for the + // number of arguments to fall within a range. if !(4..=7).contains(&args.len()) { throw_ub_format!("incorrect number of arguments for futex syscall: got {}, expected between 4 and 7 (inclusive)", args.len()); } -- 2.44.0