diff mbox

[v5,5/8] linux-user: Fix msgrcv() and msgsnd() syscalls support

Message ID 20160914202008.14119-6-aleksandar.markovic@rt-rk.com (mailing list archive)
State New, archived
Headers show

Commit Message

Aleksandar Markovic Sept. 14, 2016, 8:19 p.m. UTC
From: Aleksandar Markovic <aleksandar.markovic@imgtec.com>

If syscalls msgrcv() and msgsnd() fail, they return E2BIG, EACCES,
EAGAIN, EFAULT, EIDRM, EINTR, EINVAL, ENOMEM, or ENOMSG.

By examining negative scenarios of these syscalls for Mips, it was
established that ENOMSG does not have the same value accross all
platforms, but it is nevertheless not included for conversion in
the correspondant conversion table defined in linux-user/syscall.c.
This is certainly a bug, since it leads to the incorrect emulation
of msgrcv() and msgsnd() for scenarios involving ENOMSG.

This patch fixes this by extending the conversion table to include
ENOMSG.

Also, LTP test msgrcv04 will be fixed for some platforms.

Signed-off-by: Aleksandar Markovic <aleksandar.markovic@imgtec.com>
---
 linux-user/syscall.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Laurent Vivier Sept. 17, 2016, 11:43 p.m. UTC | #1
Le 14/09/2016 à 22:19, Aleksandar Markovic a écrit :
> From: Aleksandar Markovic <aleksandar.markovic@imgtec.com>
> 
> If syscalls msgrcv() and msgsnd() fail, they return E2BIG, EACCES,
> EAGAIN, EFAULT, EIDRM, EINTR, EINVAL, ENOMEM, or ENOMSG.
> 
> By examining negative scenarios of these syscalls for Mips, it was
> established that ENOMSG does not have the same value accross all
> platforms, but it is nevertheless not included for conversion in
> the correspondant conversion table defined in linux-user/syscall.c.
> This is certainly a bug, since it leads to the incorrect emulation
> of msgrcv() and msgsnd() for scenarios involving ENOMSG.
> 
> This patch fixes this by extending the conversion table to include
> ENOMSG.
> 
> Also, LTP test msgrcv04 will be fixed for some platforms.
> 
> Signed-off-by: Aleksandar Markovic <aleksandar.markovic@imgtec.com>

Reviewed-by: Laurent Vivier <laurent@vivier.eu>

> ---
>  linux-user/syscall.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/linux-user/syscall.c b/linux-user/syscall.c
> index 7f8ae41..bdc12ae 100644
> --- a/linux-user/syscall.c
> +++ b/linux-user/syscall.c
> @@ -750,6 +750,9 @@ static uint16_t host_to_target_errno_table[ERRNO_TABLE_SIZE] = {
>  #ifdef ENOTRECOVERABLE
>      [ENOTRECOVERABLE]	= TARGET_ENOTRECOVERABLE,
>  #endif
> +#ifdef ENOMSG
> +    [ENOMSG]            = TARGET_ENOMSG,
> +#endif
>  };
>  
>  static inline int host_to_target_errno(int err)
>
Aleksandar Markovic Sept. 19, 2016, 7:05 p.m. UTC | #2
Hello, Lorain.

I really appreciate your reviewing these patches. This was a great opportunity for me to learn a lot. I will address all your concerns about this series in its next version, which is planned to be posted by the end of this week. Regarding another series on Mips-specific issues, its v7 was posted on qemu-devel today.

Thanks,
Aleksandar
diff mbox

Patch

diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 7f8ae41..bdc12ae 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -750,6 +750,9 @@  static uint16_t host_to_target_errno_table[ERRNO_TABLE_SIZE] = {
 #ifdef ENOTRECOVERABLE
     [ENOTRECOVERABLE]	= TARGET_ENOTRECOVERABLE,
 #endif
+#ifdef ENOMSG
+    [ENOMSG]            = TARGET_ENOMSG,
+#endif
 };
 
 static inline int host_to_target_errno(int err)