Skip to content

Commit

Permalink
linux-user: fix emulation of splice syscall
Browse files Browse the repository at this point in the history
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: Andreas Schwab <[email protected]>
Reviewed-by: Peter Maydell <[email protected]>
Signed-off-by: Riku Voipio <[email protected]>
  • Loading branch information
andreas-schwab authored and Riku Voipio committed Mar 22, 2015
1 parent 92bed46 commit 17644b3
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions linux-user/syscall.c
Original file line number Diff line number Diff line change
Expand Up @@ -9351,15 +9351,29 @@ 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 (arg2) {
if (get_user_u64(loff_in, arg2)) {
goto efault;
}
ploff_in = &loff_in;
}
if(arg4) {
get_user_u64(loff_out, arg2);
if (arg4) {
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
Expand Down

0 comments on commit 17644b3

Please sign in to comment.