Skip to content

Commit 7623b5b

Browse files
committed
Merge remote-tracking branch 'remotes/vivier2/tags/linux-user-for-5.1-pull-request' into staging
linux-user pull request 2020-07-02 Update linux-user maintainer Improve strace output for some syscalls Display contents of ioctl() parameters Fix sparc64 flushw operation # gpg: Signature made Sat 04 Jul 2020 17:25:21 BST # gpg: using RSA key CD2F75DDC8E3A4DC2E4F5173F30C38BD3F2FBE3C # gpg: issuer "[email protected]" # gpg: Good signature from "Laurent Vivier <[email protected]>" [full] # gpg: aka "Laurent Vivier <[email protected]>" [full] # gpg: aka "Laurent Vivier (Red Hat) <[email protected]>" [full] # Primary key fingerprint: CD2F 75DD C8E3 A4DC 2E4F 5173 F30C 38BD 3F2F BE3C * remotes/vivier2/tags/linux-user-for-5.1-pull-request: MAINTAINERS: update linux-user maintainer linux-user: Add strace support for printing arguments of ioctl() linux-user: Add thunk argument types for SIOCGSTAMP and SIOCGSTAMPNS linux-user: Add strace support for printing arguments of fallocate() linux-user: Add strace support for printing arguments of chown()/lchown() linux-user: Add strace support for printing arguments of lseek() linux-user: Add strace support for printing argument of syscalls used for extended attributes linux-user: Add strace support for a group of syscalls linux-user: Extend strace support to enable argument printing after syscall execution linux-user: syscall: ioctls: support DRM_IOCTL_VERSION linux-user/sparc64: Fix the handling of window spill trap target/sparc: Translate flushw opcode Signed-off-by: Peter Maydell <[email protected]>
2 parents eb6490f + 8f902c5 commit 7623b5b

File tree

14 files changed

+782
-116
lines changed

14 files changed

+782
-116
lines changed

MAINTAINERS

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2630,8 +2630,7 @@ F: bsd-user/
26302630
F: default-configs/*-bsd-user.mak
26312631

26322632
Linux user
2633-
M: Riku Voipio <[email protected]>
2634-
R: Laurent Vivier <[email protected]>
2633+
M: Laurent Vivier <[email protected]>
26352634
S: Maintained
26362635
F: linux-user/
26372636
F: default-configs/*-linux-user.mak

bsd-user/main.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,11 @@ static void save_window(CPUSPARCState *env)
413413
save_window_offset(env, cpu_cwp_dec(env, env->cwp - 2));
414414
env->wim = new_wim;
415415
#else
416-
save_window_offset(env, cpu_cwp_dec(env, env->cwp - 2));
416+
/*
417+
* cansave is zero if the spill trap handler is triggered by `save` and
418+
* nonzero if triggered by a `flushw`
419+
*/
420+
save_window_offset(env, cpu_cwp_dec(env, env->cwp - env->cansave - 2));
417421
env->cansave++;
418422
env->canrestore--;
419423
#endif

configure

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3194,6 +3194,13 @@ if ! check_include "ifaddrs.h" ; then
31943194
have_ifaddrs_h=no
31953195
fi
31963196

3197+
#########################################
3198+
# libdrm check
3199+
have_drm_h=no
3200+
if check_include "libdrm/drm.h" ; then
3201+
have_drm_h=yes
3202+
fi
3203+
31973204
##########################################
31983205
# VTE probe
31993206

@@ -7377,6 +7384,9 @@ fi
73777384
if test "$have_ifaddrs_h" = "yes" ; then
73787385
echo "HAVE_IFADDRS_H=y" >> $config_host_mak
73797386
fi
7387+
if test "$have_drm_h" = "yes" ; then
7388+
echo "HAVE_DRM_H=y" >> $config_host_mak
7389+
fi
73807390
if test "$have_broken_size_max" = "yes" ; then
73817391
echo "HAVE_BROKEN_SIZE_MAX=y" >> $config_host_mak
73827392
fi

include/exec/user/thunk.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ void thunk_register_struct_direct(int id, const char *name,
7373
const StructEntry *se1);
7474
const argtype *thunk_convert(void *dst, const void *src,
7575
const argtype *type_ptr, int to_host);
76+
const argtype *thunk_print(void *arg, const argtype *type_ptr);
7677

7778
extern StructEntry *struct_entries;
7879

linux-user/ioctls.h

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -279,13 +279,17 @@
279279
* FIXME: create a macro to define this kind of entry
280280
*/
281281
{ TARGET_SIOCGSTAMP_OLD, TARGET_SIOCGSTAMP_OLD,
282-
"SIOCGSTAMP_OLD", IOC_R, do_ioctl_SIOCGSTAMP },
282+
"SIOCGSTAMP_OLD", IOC_R, do_ioctl_SIOCGSTAMP,
283+
{ MK_PTR(MK_STRUCT(STRUCT_timeval)) } },
283284
{ TARGET_SIOCGSTAMPNS_OLD, TARGET_SIOCGSTAMPNS_OLD,
284-
"SIOCGSTAMPNS_OLD", IOC_R, do_ioctl_SIOCGSTAMPNS },
285+
"SIOCGSTAMPNS_OLD", IOC_R, do_ioctl_SIOCGSTAMPNS,
286+
{ MK_PTR(MK_STRUCT(STRUCT_timespec)) } },
285287
{ TARGET_SIOCGSTAMP_NEW, TARGET_SIOCGSTAMP_NEW,
286-
"SIOCGSTAMP_NEW", IOC_R, do_ioctl_SIOCGSTAMP },
288+
"SIOCGSTAMP_NEW", IOC_R, do_ioctl_SIOCGSTAMP,
289+
{ MK_PTR(MK_STRUCT(STRUCT__kernel_sock_timeval)) } },
287290
{ TARGET_SIOCGSTAMPNS_NEW, TARGET_SIOCGSTAMPNS_NEW,
288-
"SIOCGSTAMPNS_NEW", IOC_R, do_ioctl_SIOCGSTAMPNS },
291+
"SIOCGSTAMPNS_NEW", IOC_R, do_ioctl_SIOCGSTAMPNS,
292+
{ MK_PTR(MK_STRUCT(STRUCT__kernel_timespec)) } },
289293

290294
IOCTL(RNDGETENTCNT, IOC_R, MK_PTR(TYPE_INT))
291295
IOCTL(RNDADDTOENTCNT, IOC_W, MK_PTR(TYPE_INT))
@@ -574,6 +578,11 @@
574578
IOCTL_SPECIAL(SIOCDELRT, IOC_W, do_ioctl_rt,
575579
MK_PTR(MK_STRUCT(STRUCT_rtentry)))
576580

581+
#ifdef HAVE_DRM_H
582+
IOCTL_SPECIAL(DRM_IOCTL_VERSION, IOC_RW, do_ioctl_drm,
583+
MK_PTR(MK_STRUCT(STRUCT_drm_version)))
584+
#endif
585+
577586
#ifdef TARGET_TIOCSTART
578587
IOCTL_IGNORE(TIOCSTART)
579588
IOCTL_IGNORE(TIOCSTOP)

linux-user/qemu.h

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,26 @@ struct linux_binprm {
184184
int (*core_dump)(int, const CPUArchState *); /* coredump routine */
185185
};
186186

187+
typedef struct IOCTLEntry IOCTLEntry;
188+
189+
typedef abi_long do_ioctl_fn(const IOCTLEntry *ie, uint8_t *buf_temp,
190+
int fd, int cmd, abi_long arg);
191+
192+
struct IOCTLEntry {
193+
int target_cmd;
194+
unsigned int host_cmd;
195+
const char *name;
196+
int access;
197+
do_ioctl_fn *do_ioctl;
198+
const argtype arg_type[5];
199+
};
200+
201+
extern IOCTLEntry ioctl_entries[];
202+
203+
#define IOC_R 0x0001
204+
#define IOC_W 0x0002
205+
#define IOC_RW (IOC_R | IOC_W)
206+
187207
void do_init_thread(struct target_pt_regs *regs, struct image_info *infop);
188208
abi_ulong loader_build_argptr(int envc, int argc, abi_ulong sp,
189209
abi_ulong stringp, int push_ptr);
@@ -383,7 +403,9 @@ int host_to_target_waitstatus(int status);
383403
void print_syscall(int num,
384404
abi_long arg1, abi_long arg2, abi_long arg3,
385405
abi_long arg4, abi_long arg5, abi_long arg6);
386-
void print_syscall_ret(int num, abi_long arg1);
406+
void print_syscall_ret(int num, abi_long ret,
407+
abi_long arg1, abi_long arg2, abi_long arg3,
408+
abi_long arg4, abi_long arg5, abi_long arg6);
387409
/**
388410
* print_taken_signal:
389411
* @target_signum: target signal being taken
@@ -668,6 +690,22 @@ static inline int is_error(abi_long ret)
668690
return (abi_ulong)ret >= (abi_ulong)(-4096);
669691
}
670692

693+
#if TARGET_ABI_BITS == 32
694+
static inline uint64_t target_offset64(uint32_t word0, uint32_t word1)
695+
{
696+
#ifdef TARGET_WORDS_BIGENDIAN
697+
return ((uint64_t)word0 << 32) | word1;
698+
#else
699+
return ((uint64_t)word1 << 32) | word0;
700+
#endif
701+
}
702+
#else /* TARGET_ABI_BITS == 32 */
703+
static inline uint64_t target_offset64(uint64_t word0, uint64_t word1)
704+
{
705+
return word0;
706+
}
707+
#endif /* TARGET_ABI_BITS != 32 */
708+
671709
/**
672710
* preexit_cleanup: housekeeping before the guest exits
673711
*

linux-user/sparc/cpu_loop.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,11 @@ static void save_window(CPUSPARCState *env)
6969
save_window_offset(env, cpu_cwp_dec(env, env->cwp - 2));
7070
env->wim = new_wim;
7171
#else
72-
save_window_offset(env, cpu_cwp_dec(env, env->cwp - 2));
72+
/*
73+
* cansave is zero if the spill trap handler is triggered by `save` and
74+
* nonzero if triggered by a `flushw`
75+
*/
76+
save_window_offset(env, cpu_cwp_dec(env, env->cwp - env->cansave - 2));
7377
env->cansave++;
7478
env->canrestore--;
7579
#endif

0 commit comments

Comments
 (0)