Commit 17644b36 authored by Andreas Schwab's avatar Andreas Schwab Committed by Riku Voipio
Browse files

linux-user: fix emulation of splice syscall



The second and fourth argument are in/out parameters, store them back
after the syscall.  Also, the fourth argument was mishandled, and EFAULT
handling was missing.

Signed-off-by: default avatarAndreas Schwab <schwab@suse.de>
Reviewed-by: default avatarPeter Maydell <peter.maydell@linaro.org>
Signed-off-by: default avatarRiku Voipio <riku.voipio@linaro.org>
parent 92bed463
Loading
Loading
Loading
Loading
+18 −4
Original line number Diff line number Diff line
@@ -9352,14 +9352,28 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
            loff_t loff_in, loff_out;
            loff_t *ploff_in = NULL, *ploff_out = NULL;
            if (arg2) {
                get_user_u64(loff_in, arg2);
                if (get_user_u64(loff_in, arg2)) {
                    goto efault;
                }
                ploff_in = &loff_in;
            }
            if (arg4) {
                get_user_u64(loff_out, arg2);
                if (get_user_u64(loff_out, arg4)) {
                    goto efault;
                }
                ploff_out = &loff_out;
            }
            ret = get_errno(splice(arg1, ploff_in, arg3, ploff_out, arg5, arg6));
            if (arg2) {
                if (put_user_u64(loff_in, arg2)) {
                    goto efault;
                }
            }
            if (arg4) {
                if (put_user_u64(loff_out, arg4)) {
                    goto efault;
                }
            }
        }
        break;
#endif