fcntl() varargs parsing should be conditional on the command
As reported by @jrtc27: c3a7ed32 (comment 13031)
This seems very wrong. POSIX says the argument is of type
int
for some operations, so only anint
should be read for those, although I guess after the varargs syscall discussion in practice reading auintptr_t
in userspace is fine (but not currently on any of Morello, CHERI-MIPS and CHERI-RISC-V as they all use a long as the varargs slot size). However it definitely must not be read unconditionally; with bounded varargs this will fault for commands that don't take an argument, so this needs to be conditional on the command.