Since O_TMPFILE might differ between guest and host, add it to the bitmask_transtbl. While at it, fix the definitions of O_DIRECTORY etc on arm64, which are identical to arm32 according to kernel sources.
This fixes open14 and openat03 ltp testcases.
Fixes: https://bugs.launchpad.net/qemu/+bug/1709170
--- linux-user/strace.c | 4 ++++ linux-user/syscall.c | 3 +++ linux-user/syscall_defs.h | 8 +++++++- 3 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/linux-user/strace.c b/linux-user/strace.c index d821d165ff..bd897a3f20 100644 --- a/linux-user/strace.c +++ b/linux-user/strace.c @@ -838,6 +838,10 @@ UNUSED static struct flags open_flags[] = { #ifdef O_PATH FLAG_TARGET(O_PATH), #endif +#ifdef O_TMPFILE + FLAG_TARGET(O_TMPFILE), + FLAG_TARGET(__O_TMPFILE), +#endif FLAG_END, };
diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 54343c06be..b3aa8099b4 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -342,6 +342,9 @@ static bitmask_transtbl fcntl_flags_tbl[] = { #if defined(O_PATH) { TARGET_O_PATH, TARGET_O_PATH, O_PATH, O_PATH }, #endif +#if defined(O_TMPFILE) + { TARGET_O_TMPFILE, TARGET_O_TMPFILE, O_TMPFILE, O_TMPFILE }, +#endif /* Don't terminate the list prematurely on 64-bit host+guest. */ #if TARGET_O_LARGEFILE != 0 || O_LARGEFILE != 0 { TARGET_O_LARGEFILE, TARGET_O_LARGEFILE, O_LARGEFILE, O_LARGEFILE, }, diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h index 40c5027e93..6e2287e918 100644 --- a/linux-user/syscall_defs.h +++ b/linux-user/syscall_defs.h @@ -2416,7 +2416,7 @@ struct target_statfs64 { #define TARGET_O_CLOEXEC 010000000 #define TARGET___O_SYNC 000100000 #define TARGET_O_PATH 020000000 -#elif defined(TARGET_ARM) || defined(TARGET_M68K) +#elif defined(TARGET_ARM) || defined(TARGET_M68K) || defined(TARGET_AARCH64) #define TARGET_O_DIRECTORY 040000 /* must be a directory */ #define TARGET_O_NOFOLLOW 0100000 /* don't follow links */ #define TARGET_O_DIRECT 0200000 /* direct disk access hint */ @@ -2513,6 +2513,12 @@ struct target_statfs64 { #ifndef TARGET_O_PATH #define TARGET_O_PATH 010000000 #endif +#ifndef TARGET___O_TMPFILE +#define TARGET___O_TMPFILE 020000000 +#endif +#ifndef TARGET_O_TMPFILE +#define TARGET_O_TMPFILE (TARGET___O_TMPFILE | TARGET_O_DIRECTORY) +#endif #ifndef TARGET_O_NDELAY #define TARGET_O_NDELAY TARGET_O_NONBLOCK #endif -- 2.11.0
Since O_TMPFILE might differ between guest and host,
add it to the bitmask_transtbl. While at it, fix the definitions
of O_DIRECTORY etc on arm64, which are identical to arm32 according
to kernel sources.
This fixes open14 and openat03 ltp testcases.
Fixes: https:/ /bugs.launchpad .net/qemu/ +bug/1709170
--- user/strace. c | 4 ++++ user/syscall. c | 3 +++ user/syscall_ defs.h | 8 +++++++-
linux-
linux-
linux-
3 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/linux- user/strace. c b/linux- user/strace. c .bd897a3f20 100644 user/strace. c user/strace. c TARGET( O_PATH) , O_TMPFILE) , __O_TMPFILE) ,
index d821d165ff.
--- a/linux-
+++ b/linux-
@@ -838,6 +838,10 @@ UNUSED static struct flags open_flags[] = {
#ifdef O_PATH
FLAG_
#endif
+#ifdef O_TMPFILE
+ FLAG_TARGET(
+ FLAG_TARGET(
+#endif
FLAG_END,
};
diff --git a/linux- user/syscall. c b/linux- user/syscall. c .b3aa8099b4 100644 user/syscall. c user/syscall. c user/syscall_ defs.h b/linux- user/syscall_ defs.h .6e2287e918 100644 user/syscall_ defs.h user/syscall_ defs.h TARGET_ M68K) TARGET_ M68K) || defined( TARGET_ AARCH64)
index 54343c06be.
--- a/linux-
+++ b/linux-
@@ -342,6 +342,9 @@ static bitmask_transtbl fcntl_flags_tbl[] = {
#if defined(O_PATH)
{ TARGET_O_PATH, TARGET_O_PATH, O_PATH, O_PATH },
#endif
+#if defined(O_TMPFILE)
+ { TARGET_O_TMPFILE, TARGET_O_TMPFILE, O_TMPFILE, O_TMPFILE },
+#endif
/* Don't terminate the list prematurely on 64-bit host+guest. */
#if TARGET_O_LARGEFILE != 0 || O_LARGEFILE != 0
{ TARGET_O_LARGEFILE, TARGET_O_LARGEFILE, O_LARGEFILE, O_LARGEFILE, },
diff --git a/linux-
index 40c5027e93.
--- a/linux-
+++ b/linux-
@@ -2416,7 +2416,7 @@ struct target_statfs64 {
#define TARGET_O_CLOEXEC 010000000
#define TARGET___O_SYNC 000100000
#define TARGET_O_PATH 020000000
-#elif defined(TARGET_ARM) || defined(
+#elif defined(TARGET_ARM) || defined(
#define TARGET_O_DIRECTORY 040000 /* must be a directory */
#define TARGET_O_NOFOLLOW 0100000 /* don't follow links */
#define TARGET_O_DIRECT 0200000 /* direct disk access hint */
@@ -2513,6 +2513,12 @@ struct target_statfs64 {
#ifndef TARGET_O_PATH
#define TARGET_O_PATH 010000000
#endif
+#ifndef TARGET___O_TMPFILE
+#define TARGET___O_TMPFILE 020000000
+#endif
+#ifndef TARGET_O_TMPFILE
+#define TARGET_O_TMPFILE (TARGET___O_TMPFILE | TARGET_O_DIRECTORY)
+#endif
#ifndef TARGET_O_NDELAY
#define TARGET_O_NDELAY TARGET_O_NONBLOCK
#endif
--
2.11.0