Skip to contentSkip to conversation

linux-user/syscall.c: add target-to-host mapping for epoll_create1()

PATCH Applied Sergei Trofimovich 2 participants 3 messages Apr 15, 2020 – Apr 16, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 linux-user/syscall.c: add target-to-host mapping for epoll_create1()

Noticed by Barnabás Virágh as a python-3.7 failue on qemu-alpha.

The bug shows up on alpha as it's one of the targets where EPOLL_CLOEXEC differs from other targets:
sysdeps/unix/sysv/linux/alpha/bits/epoll.h: EPOLL_CLOEXEC = 01000000
sysdeps/unix/sysv/linux/bits/epoll.h: EPOLL_CLOEXEC = 02000000

Reported-by Barnabás Virágh
CC Riku Voipio <[email protected]>
CC Laurent Vivier <[email protected]>
---
 linux-user/syscall.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
linux-user/syscall.c +1 -1
index 674f70e70a..05f03919ff 100644
@@ -12012,7 +12012,7 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,
 #endif
 #if defined(TARGET_NR_epoll_create1) && defined(CONFIG_EPOLL_CREATE1)
     case TARGET_NR_epoll_create1:
-        return get_errno(epoll_create1(arg1));
+        return get_errno(epoll_create1(target_to_host_bitmask(arg1, fcntl_flags_tbl)));
 #endif
 #if defined(TARGET_NR_epoll_ctl)
     case TARGET_NR_epoll_ctl:
Signature · 1 line
2.26.1
Reviewed-by on v1 1/1
#1 lore raw

Le 16/04/2020 à 00:05, Sergei Trofimovich a écrit :

Quoted 22 lines

Noticed by Barnabás Virágh as a python-3.7 failue on qemu-alpha.

The bug shows up on alpha as it's one of the targets where EPOLL_CLOEXEC differs from other targets:
sysdeps/unix/sysv/linux/alpha/bits/epoll.h: EPOLL_CLOEXEC = 01000000
sysdeps/unix/sysv/linux/bits/epoll.h: EPOLL_CLOEXEC = 02000000

Reported-by Barnabás Virágh
CC Riku Voipio <[email protected]>
CC Laurent Vivier <[email protected]>
---
 linux-user/syscall.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
linux-user/syscall.c +0 -0
index 674f70e70a..05f03919ff 100644

linux-user/syscall.c static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1, · line 12018

Quoted 8 lines
linux-user/syscall.c +1 -1
@@ -12012,7 +12012,7 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,
 #endif
 #if defined(TARGET_NR_epoll_create1) && defined(CONFIG_EPOLL_CREATE1)
     case TARGET_NR_epoll_create1:
-        return get_errno(epoll_create1(arg1));
+        return get_errno(epoll_create1(target_to_host_bitmask(arg1, fcntl_flags_tbl)));
 #endif
 #if defined(TARGET_NR_epoll_ctl)
     case TARGET_NR_epoll_ctl:
#2 lore raw
In reply to Sergei Trofimovich

Le 16/04/2020 à 00:05, Sergei Trofimovich a écrit :

Quoted 22 lines

Noticed by Barnabás Virágh as a python-3.7 failue on qemu-alpha.

The bug shows up on alpha as it's one of the targets where EPOLL_CLOEXEC differs from other targets:
sysdeps/unix/sysv/linux/alpha/bits/epoll.h: EPOLL_CLOEXEC = 01000000
sysdeps/unix/sysv/linux/bits/epoll.h: EPOLL_CLOEXEC = 02000000

Reported-by Barnabás Virágh
CC Riku Voipio <[email protected]>
CC Laurent Vivier <[email protected]>
---
 linux-user/syscall.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
linux-user/syscall.c +0 -0
index 674f70e70a..05f03919ff 100644

linux-user/syscall.c static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1, · line 12018

Quoted 8 lines
linux-user/syscall.c +1 -1
@@ -12012,7 +12012,7 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,
 #endif
 #if defined(TARGET_NR_epoll_create1) && defined(CONFIG_EPOLL_CREATE1)
     case TARGET_NR_epoll_create1:
-        return get_errno(epoll_create1(arg1));
+        return get_errno(epoll_create1(target_to_host_bitmask(arg1, fcntl_flags_tbl)));
 #endif
 #if defined(TARGET_NR_epoll_ctl)
     case TARGET_NR_epoll_ctl:

Applied to my linux-user-for-5.0 branch.

Thanks,
Laurent