Fixes DR's handling of the clone_args struct used by the app. While creating our own copy of the app's clone_args object, we need to allocate as much space as specified by the app in the clone3 syscall's args. We should not use the size of DR's internal struct copy (clone3_syscall_args_t) for this, as it may contain less/more fields than the one used by the app.
Replaces memcpy with d_r_safe_read to properly handle the case where reading of the user-provided clone args faults. Adds checks to match kernel's behaviour for EINVAL and EFAULT.
Also fixes an existing bug where we were fixing syscall params and freeing mem in the fork case as well.
Fixes handling for the !CLONE_VM case in clone3, to match what we do for the same in clone.
Adds test for the !CLONE_VM case, and for some cases where clone3 should return EINVAL or EFAULT.
Performs some refactoring: makes asm code in linux.clone test more verbose by using explicit move/load/store to set up registers for the syscall; use separate routine for pre-syscall handling of clone3; use DR's copy of clone args and saved flags everywhere, instead of reading the app clone args without a safe-read.
Issue: #5131 (closed)