fstatat size mismatch
PATCH 1/1 fstatat size mismatch
host_to_target_stat64 is used for both stat64 and newfstatat syscalls. In the latter case we don't actually have a struct stat64. The current TARGET_ABI_BITS test is wrong for some 64-bit ILP32 targets (in particular MIPS N32). Check for TARGET_NR_newfstatat instead.
This will all break horribly if both newfstatat and stat64 are defined, so also add a check for that.
--- linux-user/syscall.c | 12 +++++++++++- 1 files changed, 11 insertions(+), 1 deletions(-)
linux-user/syscall.c +11 -1
@@ -4474,6 +4474,16 @@ static inline abi_long host_to_target_timespec(abi_ulong target_addr,return 0 ; } +/* The newfstatat syscall uses regular struct stat. However it never +occurs on targets with a struct stat64. This allows us to share +host_to_target_stat64 between newfstatat and fstatat64. */ + +#if defined(TARGET_NR_newfstatat) && (defined(TARGET_NR_fstatat64) \ + || defined(TARGET_NR_stat64) || defined(TARGET_NR_fstat64) \ + || defined(TARGET_NR_lstat64)) +#error mismatched stat syscalls. +#endif +#if defined(TARGET_NR_stat64) || defined(TARGET_NR_newfstatat) static inline abi_long host_to_target_stat64(void *cpu_env, abi_ulong target_addr,
@@ -4506,7 +4516,7 @@ static inline abi_long host_to_target_stat64(void *cpu_env, } else#endif { -#if TARGET_ABI_BITS ==64 && !defined(TARGET_ALPHA ) +#if defined(TARGET_NR_newfstatat)struct target_stat *target_st;#else struct target_stat64 *target_st;
Signature · 1 line
1.7.8.3
A "linux-user: " prefix for the subject would be nice, but let's wait for other comments first.
Am 09.02.2012 20:05, schrieb Paul Brook:
Quoted 10 lines
host_to_target_stat64is used for both stat64 and newfstatat syscalls. In the latter case we don't actually have a struct stat64. The currentTARGET_ABI_BITStest is wrong for some 64-bit ILP32 targets (in particular MIPS N32). Check forTARGET_NR_newfstatatinstead.This will all break horribly if both newfstatat and stat64 are defined, so also add a check for that.
Signed-off-by Paul Brook <[email protected]>---
CC'ing Riku.
Andreas
Quoted 33 lines
linux-user/syscall.c | 12 +++++++++++- 1 files changed, 11 insertions(+), 1 deletions(-)linux-user/syscall.c +11
-1@@ -4474,6 +4474,16 @@ static inline abi_long host_to_target_timespec(abi_ulong target_addr,return 0 ; } +/* The newfstatat syscall uses regular struct stat. However it never +occurs on targets with a struct stat64. This allows us to share +host_to_target_stat64 between newfstatat and fstatat64. */ + +#if defined(TARGET_NR_newfstatat) && (defined(TARGET_NR_fstatat64) \ + || defined(TARGET_NR_stat64) || defined(TARGET_NR_fstat64) \ + || defined(TARGET_NR_lstat64)) +#error mismatched stat syscalls. +#endif +#if defined(TARGET_NR_stat64) || defined(TARGET_NR_newfstatat) static inline abi_long host_to_target_stat64(void *cpu_env, abi_ulong target_addr,@@ -4506,7 +4516,7 @@ static inline abi_long host_to_target_stat64(void *cpu_env, } else#endif { -#if TARGET_ABI_BITS ==64 && !defined(TARGET_ALPHA ) +#if defined(TARGET_NR_newfstatat)struct target_stat *target_st;#else struct target_stat64 *target_st;
Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg