Commit 7cbab5b1 authored by Michael Tokarev's avatar Michael Tokarev

use int for sparc64 timeval.tv_usec (#920032)

parent d890e9de
......@@ -3,3 +3,4 @@ do-not-link-everything-with-xen.patch
usb-mtp-use-O_NOFOLLOW-and-O_CLOEXEC-CVE-2018-16872.patch
bt-use-size_t-type-for-length-parameters-instead-of-int-CVE-2018-19665.patch
hw_usb-fix-mistaken-de-initialization-of-CCID-state.patch
sparc64-timeval.tv_usec-is-int.patch
From: Ben Hutchings <ben@decadent.org.uk>
Date: Wed, 6 Feb 2019 11:35:06 +0300
Subject: sparc64 timeval.tv_usec is int
On sparc (only) Linux defines timeval::tv_usec with type int, not
long. However qemu-user's definition of struct target_timeval uses
abi_long unconditionally. This results in the syscall translation
layer effectively multiplying tv_usec by 2**32. All sparc syscalls
passing non-zero values for this field fail with -EINVAL.
Laurent Vivier <laurent@vivier.eu>:
According to the kernel definition, I think it should be:
See arch/sparc/include/uapi/asm/posix_types.h
typedef int __kernel_suseconds_t;
..
---
linux-user/syscall_defs.h | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
index 99bbce083c..106eafe7fc 100644
--- a/linux-user/syscall_defs.h
+++ b/linux-user/syscall_defs.h
@@ -210,7 +210,11 @@ struct target_linger {
struct target_timeval {
abi_long tv_sec;
+#if defined(TARGET_SPARC64) && !defined(TARGET_ABI32)
+ abi_int tv_usec;
+#else
abi_long tv_usec;
+#endif
};
struct target_timespec {
--
2.11.0
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment