qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] Bug#920032: qemu-user uses wrong struct timeval on spar


From: Laurent Vivier
Subject: Re: [Qemu-devel] Bug#920032: qemu-user uses wrong struct timeval on sparc
Date: Tue, 22 Jan 2019 09:13:02 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0

On 22/01/2019 07:12, Thomas Huth wrote:
>  Hi Ben,
> 
> could you please submit this as a proper patch to the qemu-devel mailing
> list, with Signed-off-by line?
> (see https://wiki.qemu.org/Contribute/SubmitAPatch for details)
> 
>  Thanks,
>   Thomas
> 
> 
> On 2019-01-22 06:42, Michael Tokarev wrote:
>> Forwarding to address@hidden
>> http://bugs.debian.org/920032
>>
>> Thanks!
>>
>> 21.01.2019 22:09, Ben Hutchings wrote:
>>> Package: qemu-user
>>> Version: 1:3.1+dfsg-2
>>> Severity: important
>>> Tags: patch
>>>
>>> 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.  The
>>> following patch seems to fix this.
>>>
>>> Ben.
>>>
>>> --- 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_SPARC)

According to the kernel definition, I think it should be:

#if defined(TARGET_SPARC64) && !defined(TARGET_ABI32)

See include/uapi/linux/time.h

struct timeval {
        __kernel_time_t         tv_sec;         /* seconds */
        __kernel_suseconds_t    tv_usec;        /* microseconds */
};

and arch/sparc/include/uapi/asm/posix_types.h

#if defined(__sparc__) && defined(__arch64__)
...
typedef int                    __kernel_suseconds_t;


>>> +    abi_int tv_usec;
>>> +#else
>>>       abi_long tv_usec;
>>> +#endif
>>>   };
>>>     struct target_timespec {
>>> --- END ---
>>>
>>> -- System Information:
>>> Debian Release: buster/sid
>>>    APT prefers unstable-debug
>>>    APT policy: (500, 'unstable-debug'), (500, 'stable-updates'), (500,
>>> 'unstable'), (500, 'testing'), (500, 'stable'), (1, 'experimental')
>>> Architecture: amd64 (x86_64)
>>> Foreign Architectures: i386
>>>
>>> Kernel: Linux 4.19.0-1-amd64 (SMP w/4 CPU cores)
>>> Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8),
>>> LANGUAGE=en_GB.UTF-8 (charmap=UTF-8)
>>> Shell: /bin/sh linked to /bin/dash
>>> Init: systemd (via /run/systemd/system)
>>> LSM: AppArmor: enabled
>>>
>>> Versions of packages qemu-user depends on:
>>> ii  libc6         2.28-3
>>> ii  libcapstone3  3.0.5-3
>>> ii  libgcc1       1:8.2.0-13
>>> ii  libglib2.0-0  2.58.1-2
>>> ii  libstdc++6    8.2.0-13
>>> ii  zlib1g        1:1.2.11.dfsg-1
>>>
>>> Versions of packages qemu-user recommends:
>>> ii  qemu-user-static [qemu-user-binfmt]  1:3.1+dfsg-2
>>>
>>> Versions of packages qemu-user suggests:
>>> ii  sudo  1.8.26-2
>>>
>>> -- no debconf information
>>>
>>
> 
> 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]