* [Qemu-devel] [PATCH] Fix emulation of splice syscall
@ 2015-02-04 16:37 Andreas Schwab
2015-02-04 20:20 ` Peter Maydell
2015-02-05 11:31 ` Andreas Schwab
0 siblings, 2 replies; 6+ messages in thread
From: Andreas Schwab @ 2015-02-04 16:37 UTC (permalink / raw)
To: qemu-devel
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 <schwab@suse.de>
---
linux-user/syscall.c | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index d4398b9..db2f5c7 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -9345,14 +9345,24 @@ 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 (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
--
2.2.2
--
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH] Fix emulation of splice syscall
2015-02-04 16:37 [Qemu-devel] [PATCH] Fix emulation of splice syscall Andreas Schwab
@ 2015-02-04 20:20 ` Peter Maydell
2015-02-05 8:20 ` Andreas Schwab
2015-02-05 11:31 ` Andreas Schwab
1 sibling, 1 reply; 6+ messages in thread
From: Peter Maydell @ 2015-02-04 20:20 UTC (permalink / raw)
To: Andreas Schwab; +Cc: QEMU Developers
On 4 February 2015 at 16:37, Andreas Schwab <schwab@suse.de> wrote:
> 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 <schwab@suse.de>
> ---
> linux-user/syscall.c | 16 +++++++++++++---
> 1 file changed, 13 insertions(+), 3 deletions(-)
>
> diff --git a/linux-user/syscall.c b/linux-user/syscall.c
> index d4398b9..db2f5c7 100644
> --- a/linux-user/syscall.c
> +++ b/linux-user/syscall.c
> @@ -9345,14 +9345,24 @@ 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;
Coding style demands braces for all these if statements. Otherwise
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
-- PMM
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH] Fix emulation of splice syscall
2015-02-04 20:20 ` Peter Maydell
@ 2015-02-05 8:20 ` Andreas Schwab
2015-02-05 8:31 ` Peter Maydell
0 siblings, 1 reply; 6+ messages in thread
From: Andreas Schwab @ 2015-02-05 8:20 UTC (permalink / raw)
To: Peter Maydell; +Cc: QEMU Developers
Peter Maydell <peter.maydell@linaro.org> writes:
> Coding style demands braces for all these if statements.
That must be a recent change.
Andreas.
--
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH] Fix emulation of splice syscall
2015-02-05 8:20 ` Andreas Schwab
@ 2015-02-05 8:31 ` Peter Maydell
0 siblings, 0 replies; 6+ messages in thread
From: Peter Maydell @ 2015-02-05 8:31 UTC (permalink / raw)
To: Andreas Schwab; +Cc: QEMU Developers
On 5 February 2015 at 08:20, Andreas Schwab <schwab@suse.de> wrote:
> Peter Maydell <peter.maydell@linaro.org> writes:
>
>> Coding style demands braces for all these if statements.
>
> That must be a recent change.
It's been documented in CODING_STYLE since we first
wrote down our style choices in 2009...
There is of course still a fair amount of older code which
doesn't follow the style, but we try to follow it for new
code that gets added.
-- PMM
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Qemu-devel] [PATCH] Fix emulation of splice syscall
2015-02-04 16:37 [Qemu-devel] [PATCH] Fix emulation of splice syscall Andreas Schwab
2015-02-04 20:20 ` Peter Maydell
@ 2015-02-05 11:31 ` Andreas Schwab
2015-02-05 11:33 ` Peter Maydell
1 sibling, 1 reply; 6+ messages in thread
From: Andreas Schwab @ 2015-02-05 11:31 UTC (permalink / raw)
To: qemu-devel
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 <schwab@suse.de>
---
linux-user/syscall.c | 22 ++++++++++++++++++----
1 file changed, 18 insertions(+), 4 deletions(-)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index d4398b9..550aafe 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -9344,15 +9344,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
--
2.2.2
--
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH] Fix emulation of splice syscall
2015-02-05 11:31 ` Andreas Schwab
@ 2015-02-05 11:33 ` Peter Maydell
0 siblings, 0 replies; 6+ messages in thread
From: Peter Maydell @ 2015-02-05 11:33 UTC (permalink / raw)
To: Andreas Schwab; +Cc: Riku Voipio, QEMU Developers
On 5 February 2015 at 11:31, Andreas Schwab <schwab@suse.de> wrote:
> 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 <schwab@suse.de>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
and cc'ing Riku as linux-user maintainer.
-- PMM
> ---
> linux-user/syscall.c | 22 ++++++++++++++++++----
> 1 file changed, 18 insertions(+), 4 deletions(-)
>
> diff --git a/linux-user/syscall.c b/linux-user/syscall.c
> index d4398b9..550aafe 100644
> --- a/linux-user/syscall.c
> +++ b/linux-user/syscall.c
> @@ -9344,15 +9344,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
> --
> 2.2.2
>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2015-02-05 11:33 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-04 16:37 [Qemu-devel] [PATCH] Fix emulation of splice syscall Andreas Schwab
2015-02-04 20:20 ` Peter Maydell
2015-02-05 8:20 ` Andreas Schwab
2015-02-05 8:31 ` Peter Maydell
2015-02-05 11:31 ` Andreas Schwab
2015-02-05 11:33 ` Peter Maydell
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.