Hi, This is v2 of the openat2 support in linux-user. Thanks for the excellent feedback from Richard Henderson. I reworked/updated the patch and (hopefully) addressed all comments/suggestions. Extracting the helper made it much clearer indeed.
The patch still requires openat2.h from the host, But I added a qemu_log_mask(LOG_UNIMP) when the passed "size" is bigger than our defined target_open_how size. This should allow us to catch structure changes (as we then also need to update our code that build the open_how from target_open_how). But maybe I'm missing something (if so my apologies!), I'm also happy always define "struct open_how" locally if you prefer that. Any feedback welcome! v1 -> v2: - do not include <sys/syscall.h> - drop do_guest_openat2 from qemu.h and make static - drop "safe" from do_guest_openat2 - ensure maybe_do_fake_open() is correct about when the result should be used or not - Extract do_openat2() helper from do_syscall1() - Call user_unlock* if a lock call fails - Fix silly incorrect use of "target_open_how" when "open_how" is required - Fix coding style comments - Fix validation of arg4 in openat2 - Fix missing zero initialization of open_how - Define target_open_how with abi_* types - Warn about unimplemented size if "size" of openat2 is bigger than target_open_how Thanks for Richard Henderson and Florian Schueller for their feedback. Michael Vogt (1): linux-user: add openat2 support in linux-user linux-user/syscall.c | 98 +++++++++++++++++++++++++++++++++++++-- linux-user/syscall_defs.h | 7 +++ meson.build | 1 + 3 files changed, 102 insertions(+), 4 deletions(-) -- 2.45.2