* [PATCH 0/2] linux-user: Small fix for copy_file_range
@ 2021-05-03 17:41 LemonBoy
2021-05-03 17:41 ` [PATCH 1/2] linux-user: Add copy_file_range to strace.list LemonBoy
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: LemonBoy @ 2021-05-03 17:41 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-ppc, laurent
From: Giuseppe Musacchio <thatlemon@gmail.com>
An unwanted sign-extension is currently making the host kernel return EOVERFLOW
when calling copy_file_range with a count of 0xffffffff, despite the host being
a 64bit platform.
The fix is only affecting 32bit targets on 64bit hosts, it's a no-op when the
target bitness matches the host one.
As a bonus add a pretty-printer for copy_file_range syscall.
Giuseppe Musacchio (2):
linux-user: Add copy_file_range to strace.list
linux-user: Fix erroneous conversion in copy_file_range
linux-user/strace.list | 3 +++
linux-user/syscall.c | 3 ++-
2 files changed, 5 insertions(+), 1 deletion(-)
--
2.30.2
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/2] linux-user: Add copy_file_range to strace.list
2021-05-03 17:41 [PATCH 0/2] linux-user: Small fix for copy_file_range LemonBoy
@ 2021-05-03 17:41 ` LemonBoy
2021-05-03 18:42 ` Laurent Vivier
2021-05-03 17:41 ` [PATCH 2/2] linux-user: Fix erroneous conversion in copy_file_range LemonBoy
2021-05-15 19:49 ` [PATCH 0/2] linux-user: Small fix for copy_file_range Laurent Vivier
2 siblings, 1 reply; 6+ messages in thread
From: LemonBoy @ 2021-05-03 17:41 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-ppc, laurent
From: Giuseppe Musacchio <thatlemon@gmail.com>
Signed-off-by: Giuseppe Musacchio <thatlemon@gmail.com>
---
linux-user/strace.list | 3 +++
1 file changed, 3 insertions(+)
diff --git a/linux-user/strace.list b/linux-user/strace.list
index 084048ab96..b81f9964e3 100644
--- a/linux-user/strace.list
+++ b/linux-user/strace.list
@@ -1665,3 +1665,6 @@
#ifdef TARGET_NR_statx
{ TARGET_NR_statx, "statx", NULL, print_statx, NULL },
#endif
+#ifdef TARGET_NR_copy_file_range
+{ TARGET_NR_copy_file_range, "copy_file_range", "%s(%d,%p,%d,%p,"TARGET_ABI_FMT_lu",%u)", NULL, NULL },
+#endif
--
2.30.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/2] linux-user: Fix erroneous conversion in copy_file_range
2021-05-03 17:41 [PATCH 0/2] linux-user: Small fix for copy_file_range LemonBoy
2021-05-03 17:41 ` [PATCH 1/2] linux-user: Add copy_file_range to strace.list LemonBoy
@ 2021-05-03 17:41 ` LemonBoy
2021-05-03 18:47 ` Laurent Vivier
2021-05-15 19:49 ` [PATCH 0/2] linux-user: Small fix for copy_file_range Laurent Vivier
2 siblings, 1 reply; 6+ messages in thread
From: LemonBoy @ 2021-05-03 17:41 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-ppc, laurent
From: Giuseppe Musacchio <thatlemon@gmail.com>
The implicit cast from abi_long to size_t may introduce an intermediate
unwanted sign-extension of the value for 32bit targets running on 64bit
hosts.
Signed-off-by: Giuseppe Musacchio <thatlemon@gmail.com>
---
linux-user/syscall.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 95d79ddc43..c425dfa278 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -13245,8 +13245,9 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,
}
poutoff = &outoff;
}
+ /* Do not sign-extend the count parameter. */
ret = get_errno(safe_copy_file_range(arg1, pinoff, arg3, poutoff,
- arg5, arg6));
+ (abi_ulong)arg5, arg6));
if (!is_error(ret) && ret > 0) {
if (arg2) {
if (put_user_u64(inoff, arg2)) {
--
2.30.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] linux-user: Add copy_file_range to strace.list
2021-05-03 17:41 ` [PATCH 1/2] linux-user: Add copy_file_range to strace.list LemonBoy
@ 2021-05-03 18:42 ` Laurent Vivier
0 siblings, 0 replies; 6+ messages in thread
From: Laurent Vivier @ 2021-05-03 18:42 UTC (permalink / raw)
To: LemonBoy, qemu-devel; +Cc: qemu-ppc
Le 03/05/2021 à 19:41, LemonBoy a écrit :
> From: Giuseppe Musacchio <thatlemon@gmail.com>
>
> Signed-off-by: Giuseppe Musacchio <thatlemon@gmail.com>
> ---
> linux-user/strace.list | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/linux-user/strace.list b/linux-user/strace.list
> index 084048ab96..b81f9964e3 100644
> --- a/linux-user/strace.list
> +++ b/linux-user/strace.list
> @@ -1665,3 +1665,6 @@
> #ifdef TARGET_NR_statx
> { TARGET_NR_statx, "statx", NULL, print_statx, NULL },
> #endif
> +#ifdef TARGET_NR_copy_file_range
> +{ TARGET_NR_copy_file_range, "copy_file_range", "%s(%d,%p,%d,%p,"TARGET_ABI_FMT_lu",%u)", NULL, NULL },
> +#endif
>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] linux-user: Fix erroneous conversion in copy_file_range
2021-05-03 17:41 ` [PATCH 2/2] linux-user: Fix erroneous conversion in copy_file_range LemonBoy
@ 2021-05-03 18:47 ` Laurent Vivier
0 siblings, 0 replies; 6+ messages in thread
From: Laurent Vivier @ 2021-05-03 18:47 UTC (permalink / raw)
To: LemonBoy, qemu-devel; +Cc: qemu-ppc
Le 03/05/2021 à 19:41, LemonBoy a écrit :
> From: Giuseppe Musacchio <thatlemon@gmail.com>
>
> The implicit cast from abi_long to size_t may introduce an intermediate
> unwanted sign-extension of the value for 32bit targets running on 64bit
> hosts.
>
> Signed-off-by: Giuseppe Musacchio <thatlemon@gmail.com>
> ---
> linux-user/syscall.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/linux-user/syscall.c b/linux-user/syscall.c
> index 95d79ddc43..c425dfa278 100644
> --- a/linux-user/syscall.c
> +++ b/linux-user/syscall.c
> @@ -13245,8 +13245,9 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,
> }
> poutoff = &outoff;
> }
> + /* Do not sign-extend the count parameter. */
> ret = get_errno(safe_copy_file_range(arg1, pinoff, arg3, poutoff,
> - arg5, arg6));
> + (abi_ulong)arg5, arg6));
> if (!is_error(ret) && ret > 0) {
> if (arg2) {
> if (put_user_u64(inoff, arg2)) {
>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 0/2] linux-user: Small fix for copy_file_range
2021-05-03 17:41 [PATCH 0/2] linux-user: Small fix for copy_file_range LemonBoy
2021-05-03 17:41 ` [PATCH 1/2] linux-user: Add copy_file_range to strace.list LemonBoy
2021-05-03 17:41 ` [PATCH 2/2] linux-user: Fix erroneous conversion in copy_file_range LemonBoy
@ 2021-05-15 19:49 ` Laurent Vivier
2 siblings, 0 replies; 6+ messages in thread
From: Laurent Vivier @ 2021-05-15 19:49 UTC (permalink / raw)
To: LemonBoy, qemu-devel; +Cc: qemu-ppc
Le 03/05/2021 à 19:41, LemonBoy a écrit :
> From: Giuseppe Musacchio <thatlemon@gmail.com>
>
> An unwanted sign-extension is currently making the host kernel return EOVERFLOW
> when calling copy_file_range with a count of 0xffffffff, despite the host being
> a 64bit platform.
>
> The fix is only affecting 32bit targets on 64bit hosts, it's a no-op when the
> target bitness matches the host one.
>
> As a bonus add a pretty-printer for copy_file_range syscall.
>
> Giuseppe Musacchio (2):
> linux-user: Add copy_file_range to strace.list
> linux-user: Fix erroneous conversion in copy_file_range
>
> linux-user/strace.list | 3 +++
> linux-user/syscall.c | 3 ++-
> 2 files changed, 5 insertions(+), 1 deletion(-)
>
Applied to my linux-user-for-6.1 branch.
Thanks,
Laurent
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2021-05-15 19:50 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-03 17:41 [PATCH 0/2] linux-user: Small fix for copy_file_range LemonBoy
2021-05-03 17:41 ` [PATCH 1/2] linux-user: Add copy_file_range to strace.list LemonBoy
2021-05-03 18:42 ` Laurent Vivier
2021-05-03 17:41 ` [PATCH 2/2] linux-user: Fix erroneous conversion in copy_file_range LemonBoy
2021-05-03 18:47 ` Laurent Vivier
2021-05-15 19:49 ` [PATCH 0/2] linux-user: Small fix for copy_file_range Laurent Vivier
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.