summary refs log tree commit diff stats
path: root/bsd-user/syscall_defs.h
diff options
context:
space:
mode:
authorRichard Henderson <richard.henderson@linaro.org>2023-08-07 18:26:54 -0700
committerRichard Henderson <richard.henderson@linaro.org>2023-08-09 07:17:42 -0700
commita05cee93f4052179c036789c5a246948dcc362f0 (patch)
tree282ef45a00d97874197532670a13c89a28144944 /bsd-user/syscall_defs.h
parent9ab8d0714964abce6f5b8bcac49d6239c548ed12 (diff)
downloadfocaccia-qemu-a05cee93f4052179c036789c5a246948dcc362f0.tar.gz
focaccia-qemu-a05cee93f4052179c036789c5a246948dcc362f0.zip
linux-user: Use ARRAY_SIZE with bitmask_transtbl
Rather than using a zero tuple to end the table, use a macro
to apply ARRAY_SIZE and pass that on to the convert functions.

This fixes two bugs in which the conversion functions required
that both the target and host masks be non-zero in order to
continue, rather than require both target and host masks be
zero in order to terminate.

This affected mmap_flags_tbl when the host does not support
all of the flags we wish to convert (e.g. MAP_UNINITIALIZED).
Mapping these flags to zero is good enough, and matches how
the kernel ignores bits that are unknown.

Fixes: 4b840f96 ("linux-user: Populate more bits in mmap_flags_tbl")
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'bsd-user/syscall_defs.h')
-rw-r--r--bsd-user/syscall_defs.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/bsd-user/syscall_defs.h b/bsd-user/syscall_defs.h
index b6d113d24a..aedfbf2d7d 100644
--- a/bsd-user/syscall_defs.h
+++ b/bsd-user/syscall_defs.h
@@ -227,7 +227,9 @@ type safe_##name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, \
 }
 
 /* So far all target and host bitmasks are the same */
+#undef  target_to_host_bitmask
 #define target_to_host_bitmask(x, tbl) (x)
+#undef  host_to_target_bitmask
 #define host_to_target_bitmask(x, tbl) (x)
 
 #endif /* SYSCALL_DEFS_H */