From: Helge Deller <deller@kernel.org>
To: qemu-devel@nongnu.org
Cc: Laurent Vivier <laurent@vivier.eu>, Helge Deller <deller@gmx.de>,
Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Subject: [PULL 4/4] linux-user: Translate errno in IP_RECVERR and IPV6_RECVERR
Date: Thu, 30 Apr 2026 09:19:22 +0200 [thread overview]
Message-ID: <20260430071922.15341-5-deller@kernel.org> (raw)
In-Reply-To: <20260430071922.15341-1-deller@kernel.org>
From: Helge Deller <deller@gmx.de>
Translate host error codes of IP_RECVERR and IPV6_RECVERR control messages to
target error codes before returning to the caller.
For example, this is important for architectures (e.g. hppa, alpha, sparc,
mips) on which the value of ECONNREFUSED is different to the value on a x86_64
host.
Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/602
Signed-off-by: Helge Deller <deller@gmx.de>
---
linux-user/syscall.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index d68edb7afd..d3d9fffb54 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -2008,7 +2008,8 @@ static inline abi_long host_to_target_cmsg(struct target_msghdr *target_msgh,
tgt_len != sizeof(struct errhdr_t)) {
goto unimplemented;
}
- __put_user(errh->ee.ee_errno, &target_errh->ee.ee_errno);
+ __put_user(host_to_target_errno(errh->ee.ee_errno),
+ &target_errh->ee.ee_errno);
__put_user(errh->ee.ee_origin, &target_errh->ee.ee_origin);
__put_user(errh->ee.ee_type, &target_errh->ee.ee_type);
__put_user(errh->ee.ee_code, &target_errh->ee.ee_code);
@@ -2062,7 +2063,8 @@ static inline abi_long host_to_target_cmsg(struct target_msghdr *target_msgh,
tgt_len != sizeof(struct errhdr6_t)) {
goto unimplemented;
}
- __put_user(errh->ee.ee_errno, &target_errh->ee.ee_errno);
+ __put_user(host_to_target_errno(errh->ee.ee_errno),
+ &target_errh->ee.ee_errno);
__put_user(errh->ee.ee_origin, &target_errh->ee.ee_origin);
__put_user(errh->ee.ee_type, &target_errh->ee.ee_type);
__put_user(errh->ee.ee_code, &target_errh->ee.ee_code);
--
2.53.0
next prev parent reply other threads:[~2026-04-30 7:19 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-30 7:19 [PULL 0/4] Linux user next patches Helge Deller
2026-04-30 7:19 ` [PULL 1/4] linux-user: Add missing CDROM ioctls Helge Deller
2026-04-30 7:19 ` [PULL 2/4] linux-user: Flush errors by using exit() instead of _exit() in error path Helge Deller
2026-04-30 7:19 ` [PULL 3/4] linux-user: Allow getsockopt() with NULL optval address Helge Deller
2026-04-30 7:19 ` Helge Deller [this message]
2026-04-30 17:35 ` [PULL 0/4] Linux user next patches Stefan Hajnoczi
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=20260430071922.15341-5-deller@kernel.org \
--to=deller@kernel.org \
--cc=deller@gmx.de \
--cc=laurent@vivier.eu \
--cc=pierrick.bouvier@oss.qualcomm.com \
--cc=qemu-devel@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 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.