qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Wrong unpacked structure for epoll_event on qemu-or1k (openr


From: Laurent Vivier
Subject: Re: [PATCH] Wrong unpacked structure for epoll_event on qemu-or1k (openrisc user-space)
Date: Wed, 19 Jul 2023 10:49:59 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0

Le 18/07/2023 à 17:06, Luca Bonissi a écrit :
On 18/07/23 16:40, Peter Maydell wrote:
Hi; thanks for this patch. Unfortunately we need patches
to include a Signed-off-by: line that says you're legally
OK with it being contributed to QEMU, or we can't take them.

Sorry for the missing "signed-off-by" line, adding it just now:

==============
The or1k epoll_event structure - unlike other architectures - is packed, so we need to define it as packed in qemu-user, otherwise it leads to infinite loop due to missing file descriptor in the returned data:


Signed-off-by: Luca Bonissi <qemu@bonslack.org>
---

diff -up a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
--- a/linux-user/syscall_defs.h    2023-03-27 15:41:42.000000000 +0200
+++ b/linux-user/syscall_defs.h    2023-06-30 17:29:39.034322213 +0200
@@ -2714,7 +2709,7 @@
  #define FUTEX_CMD_MASK          ~(FUTEX_PRIVATE_FLAG | FUTEX_CLOCK_REALTIME)

  #ifdef CONFIG_EPOLL
-#if defined(TARGET_X86_64)
+#if defined(TARGET_X86_64) || defined(TARGET_OPENRISC)
  #define TARGET_EPOLL_PACKED QEMU_PACKED
  #else
  #define TARGET_EPOLL_PACKED

According to linux/glibc sourced, epoll is only packed for x86_64.

Did you try to check the alignment of the structure with gdb of a C program using offsetof() in an openrisc VM or linux-user container?

Perhaps the default alignment of long is not correctly defined in qemu for 
openrisc?

You can check with:

int main(void)
{
        printf("alignof(short) %ld\n", __alignof__(short));
        printf("alignof(int) %ld\n", __alignof__(int));
        printf("alignof(long) %ld\n", __alignof__(long));
        printf("alignof(long long) %ld\n", __alignof__(long long));
}

See include/exec/user/abitypes.h to update the value.

Thanks,
Laurent



reply via email to

[Prev in Thread] Current Thread [Next in Thread]