linux-user/syscall.c | 2 ++ linux-user/syscall_defs.h | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-)
From: Helge Deller <deller@gmx.de>
Peter Hartley noticed, that in the qemu code the imr_ifindex member of
struct target_ip_mreq needs to be of type "int" instead of "long", which
is what the Linux kernel uses on all architectures.
Adjust the type accordingly, and add a QEMU_BUILD_BUG_ON() checker to
prevent such issues in the future.
This change should fix multicast issues when using hosts and guests with
different endianess or bit size.
Reported-by: Peter Hartley <peter@talesfromthearmchair.net>
Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/2553
Signed-off-by: Helge Deller <deller@gmx.de>
---
linux-user/syscall.c | 2 ++
linux-user/syscall_defs.h | 2 +-
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 910a4da0a6..4594909242 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -2161,6 +2161,8 @@ static abi_long do_setsockopt(int sockfd, int level, int optname,
QEMU_BUILD_BUG_ON(sizeof(struct ip_mreq) !=
sizeof(struct target_ip_mreq));
+ QEMU_BUILD_BUG_ON(sizeof(struct ip_mreqn) !=
+ sizeof(struct target_ip_mreqn));
if (optname == IP_MULTICAST_IF) {
min_size = sizeof(struct in_addr);
diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
index 138ce6abb1..b8511439da 100644
--- a/linux-user/syscall_defs.h
+++ b/linux-user/syscall_defs.h
@@ -210,7 +210,7 @@ struct target_ip_mreq {
struct target_ip_mreqn {
struct target_in_addr imr_multiaddr;
struct target_in_addr imr_address;
- abi_long imr_ifindex;
+ abi_int imr_ifindex;
};
struct target_ip_mreq_source {
--
2.53.0
On 24.04.2026 18:36, Helge Deller wrote: > From: Helge Deller <deller@gmx.de> > > Peter Hartley noticed, that in the qemu code the imr_ifindex member of > struct target_ip_mreq needs to be of type "int" instead of "long", which > is what the Linux kernel uses on all architectures. > > Adjust the type accordingly, and add a QEMU_BUILD_BUG_ON() checker to > prevent such issues in the future. > > This change should fix multicast issues when using hosts and guests with > different endianess or bit size. > > Reported-by: Peter Hartley <peter@talesfromthearmchair.net> > Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/2553 > Signed-off-by: Helge Deller <deller@gmx.de> This too seems to be qemu-stable material, I'm picking it up. Please let me know if I shouldn't. Thanks, /mjt
Hello Michel,
On 4/30/26 18:39, Michael Tokarev wrote:
> On 24.04.2026 18:36, Helge Deller wrote:
>> From: Helge Deller <deller@gmx.de>
>>
>> Peter Hartley noticed, that in the qemu code the imr_ifindex member of
>> struct target_ip_mreq needs to be of type "int" instead of "long", which
>> is what the Linux kernel uses on all architectures.
>>
>> Adjust the type accordingly, and add a QEMU_BUILD_BUG_ON() checker to
>> prevent such issues in the future.
>>
>> This change should fix multicast issues when using hosts and guests with
>> different endianess or bit size.
>>
>> Reported-by: Peter Hartley <peter@talesfromthearmchair.net>
>> Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/2553
>> Signed-off-by: Helge Deller <deller@gmx.de>
>
> This too seems to be qemu-stable material, I'm picking it up.
> Please let me know if I shouldn't.
please take it.
In general, please pick up all linux-user patches which I sent in two pull request
in the last few days, which are (the second pull request):
linux-user: Translate errno in IP_RECVERR and IPV6_RECVERR
linux-user: Allow getsockopt() with NULL optval address
linux-user: Flush errors by using exit() instead of _exit() in error path
linux-user: Add missing CDROM ioctls
and the first pull request:
linux-user: Flush errors by using exit() instead of _exit() in error path
linux-user: Use abi_int for imr_ifindex in ip_mreqn struct
linux-user: Fix CLONE_PARENT_SETTID when using fork-like clone
linux-user: Add getsockopt() for SO_RCVTIMEO_NEW and SO_SNDTIMEO_NEW
linux-user: Add setsockopt() for SO_RCVTIMEO_NEW and SO_SNDTIMEO_NEW
linux-user: Define SO_TIMESTAMP*_NEW and SO_RCVTIMEIO_NEW
linux-user/mips: sync k0 TLS for EF_MIPS_MACH_OCTEON userlands
linux-user/strace: Use pointer type for read and write values
linux-user/arm/nwfpe: Use thread-local storage for qemufpa
linux-user/arm/nwfpe: Replace user_registers with current_cpu
linux-user: Don't define target_stat64 struct for loongarch64
linux-user: fix off-by-one in host_to_target_for_each_rtattr()
linux-user/ppc: Fix ppc64 rt_sigframe stack offset
Thanks!
Helge
On 01.05.2026 00:33, Helge Deller wrote: ... > In general, please pick up all linux-user patches which I sent in two > pull request > in the last few days, which are (the second pull request) This all makes sense. I skipped some of them initially, now picked them all. Thank you! (For such cases, please Cc qemu-stable@ the pullreq itself (the cover message), so I know it's all for stable and not ask for each individual change). /mjt
© 2016 - 2026 Red Hat, Inc.