From dfcb46a4e04743c38a5ef355062bad8764b93ff5 Mon Sep 17 00:00:00 2001 From: Mara Bos Date: Sat, 3 Oct 2020 13:39:16 +0200 Subject: [PATCH] Update syscall FIXME to include note about 'wrong' types. --- src/shims/posix/linux/foreign_items.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/shims/posix/linux/foreign_items.rs b/src/shims/posix/linux/foreign_items.rs index 328280d459a1..364cfde6c072 100644 --- a/src/shims/posix/linux/foreign_items.rs +++ b/src/shims/posix/linux/foreign_items.rs @@ -116,10 +116,14 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx // FIXME: The libc syscall() function is a variadic function. // It's valid to call it with more arguments than a syscall // needs, so none of these syscalls should use check_arg_count. - // However, depending on the calling convention it might depend - // on the type and size of the arguments whether a call with - // the wrong number of arguments (or types) is valid or not. + // It's even valid to call it with the wrong type of arguments, + // as long as they'd end up in the same place with the calling + // convention used. (E.g. using a `usize` instead of a pointer.) + // It's not directly clear which number, size, and type of arguments + // are acceptable in which cases and which aren't. (E.g. some + // types might take up the space of two registers.) // So this needs to be researched first. + let sys_getrandom = this .eval_libc("SYS_getrandom")? .to_machine_usize(this)?;