From: Richard Henderson <richard.henderson@linaro.org>
To: Max Filippov <jcmvbkbc@gmail.com>, qemu-devel@nongnu.org
Cc: "Laurent Vivier" <laurent@vivier.eu>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
qemu-stable@nongnu.org
Subject: Re: [PATCH v2] linux-user/syscall: xtensa: fix ipc_perm conversion
Date: Tue, 2 Apr 2024 14:01:23 -1000 [thread overview]
Message-ID: <533cebf3-9abc-4a3e-b8b7-59f1c1c0be0d@linaro.org> (raw)
In-Reply-To: <20240329223318.155572-1-jcmvbkbc@gmail.com>
On 3/29/24 12:33, Max Filippov wrote:
> target_ipc_perm::mode and target_ipc_perm::__seq fields are 32-bit wide
> on xtensa and thus need to use tswap32.
> The issue is spotted by the libc-test http://nsz.repo.hu/git/?p=libc-test
> on big-endian xtensa core.
>
> Cc: qemu-stable@nongnu.org
> Fixes: a3da8be5126b ("target/xtensa: linux-user: fix sysv IPC structures")
> Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
> ---
> Changes v1->v2:
> - split into a separate patch
>
> linux-user/syscall.c | 10 ++++++----
> 1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/linux-user/syscall.c b/linux-user/syscall.c
> index e384e1424890..d9bfd31c1cad 100644
> --- a/linux-user/syscall.c
> +++ b/linux-user/syscall.c
> @@ -3758,12 +3758,13 @@ static inline abi_long target_to_host_ipc_perm(struct ipc_perm *host_ip,
> host_ip->gid = tswap32(target_ip->gid);
> host_ip->cuid = tswap32(target_ip->cuid);
> host_ip->cgid = tswap32(target_ip->cgid);
> -#if defined(TARGET_ALPHA) || defined(TARGET_MIPS) || defined(TARGET_PPC)
> +#if defined(TARGET_ALPHA) || defined(TARGET_MIPS) || defined(TARGET_PPC) || \
> + defined(TARGET_XTENSA)
> host_ip->mode = tswap32(target_ip->mode);
> #else
> host_ip->mode = tswap16(target_ip->mode);
> #endif
Oof. I think we should rewrite these along the lines of __get_user_e, using
__builtin_choose_expr and sizeof to choose the correct routine.
r~
prev parent reply other threads:[~2024-04-03 0:02 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-29 22:33 [PATCH v2] linux-user/syscall: xtensa: fix ipc_perm conversion Max Filippov
2024-04-02 10:59 ` Philippe Mathieu-Daudé
2024-04-03 0:01 ` Richard Henderson [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=533cebf3-9abc-4a3e-b8b7-59f1c1c0be0d@linaro.org \
--to=richard.henderson@linaro.org \
--cc=jcmvbkbc@gmail.com \
--cc=laurent@vivier.eu \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-stable@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).