All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [Qemu-devel] Bug#920032: qemu-user uses wrong struct timeval on sparc
       [not found] <154809778688.10764.12505763850198799463.reportbug@deadeye.wl.decadent.org.uk>
@ 2019-01-22  5:42 ` Michael Tokarev
  2019-01-22  6:12   ` Thomas Huth
  0 siblings, 1 reply; 3+ messages in thread
From: Michael Tokarev @ 2019-01-22  5:42 UTC (permalink / raw)
  To: qemu-devel, 920032

Forwarding to qemu-devel@.
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)
> +    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
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] Bug#920032: qemu-user uses wrong struct timeval on sparc
  2019-01-22  5:42 ` [Qemu-devel] Bug#920032: qemu-user uses wrong struct timeval on sparc Michael Tokarev
@ 2019-01-22  6:12   ` Thomas Huth
  2019-01-22  8:13     ` Laurent Vivier
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas Huth @ 2019-01-22  6:12 UTC (permalink / raw)
  To: qemu-devel, Ben Hutchings
  Cc: Michael Tokarev, 920032, Laurent Vivier, Riku Voipio

 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 qemu-devel@.
> 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)
>> +    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
>>
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] Bug#920032: qemu-user uses wrong struct timeval on sparc
  2019-01-22  6:12   ` Thomas Huth
@ 2019-01-22  8:13     ` Laurent Vivier
  0 siblings, 0 replies; 3+ messages in thread
From: Laurent Vivier @ 2019-01-22  8:13 UTC (permalink / raw)
  To: Thomas Huth, qemu-devel, Ben Hutchings
  Cc: Riku Voipio, Michael Tokarev, 920032

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 qemu-devel@.
>> 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
>>>
>>
> 
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-01-22  8:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <154809778688.10764.12505763850198799463.reportbug@deadeye.wl.decadent.org.uk>
2019-01-22  5:42 ` [Qemu-devel] Bug#920032: qemu-user uses wrong struct timeval on sparc Michael Tokarev
2019-01-22  6:12   ` Thomas Huth
2019-01-22  8:13     ` 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.