linux-user: A set of misc patches for 4.1
cover linux-user: A set of misc patches for 4.1
From: Aleksandar Markovic <[email protected]>
This is a collection of misc patches for kinux user that I recently collected. Most of them originate from problems observed on target mips. However, all of them actually fix problems on multiple targets.
Aleksandar Markovic (2):
linux-user: Fix support for the SIOCATMARK and SIOCGPGRP ioctls for
eXtensa
linux-user: Add support for the SIOCSPGRP ioctl
Daniel Santos (1):
linux-user: Sanitize interp_info and, for mips only, init field fp_abi
Neng Chen (1):
linux-user: Add support the SIOCSIFPFLAGS and SIOCGIFPFLAGS ioctls
linux-user/elfload.c | 5 +++++ linux-user/ioctls.h | 3 +++ linux-user/syscall_defs.h | 8 +++++++- 3 files changed, 15 insertions(+), 1 deletion(-)
Signature · 1 line
2.7.4
PATCH 1/4 linux-user: Fix support for the SIOCATMARK and SIOCGPGRP ioctls for eXtensa
From: Aleksandar Markovic <[email protected]>
Fix support for the SIOCATMARK and SIOCGPGRP ioctls for eXtensa by correcting corresponding macro definition.
Values for TARGET_SIOCATMARK and TARGET_SIOCGPGRP are determined by Linux kernel. Following relevant lines are from kernel source tree:
arch/ia64/include/uapi/asm/sockios.h:#define SIOCATMARK 0x8905
arch/mips/include/uapi/asm/sockios.h:#define SIOCATMARK _IOR('s', 7, int)
arch/parisc/include/uapi/asm/sockios.h:#define SIOCATMARK 0x8905
arch/sh/include/uapi/asm/sockios.h:#define SIOCATMARK _IOR('s', 7, int)
arch/xtensa/include/uapi/asm/sockios.h:#define SIOCATMARK _IOR('s', 7, int)
arch/alpha/include/uapi/asm/sockios.h:#define SIOCATMARK _IOR('s', 7, int)
arch/sparc/include/uapi/asm/sockios.h:#define SIOCATMARK 0x8905include/uapi/asm-generic/sockios.h:#define SIOCATMARK 0x8905
arch/ia64/include/uapi/asm/sockios.h:#define SIOCGPGRP 0x8904
arch/mips/include/uapi/asm/sockios.h:#define SIOCGPGRP _IOR('s', 9, pid_t)
arch/parisc/include/uapi/asm/sockios.h:#define SIOCGPGRP 0x8904
arch/sh/include/uapi/asm/sockios.h:#define SIOCGPGRP _IOR('s', 9, pid_t)
arch/xtensa/include/uapi/asm/sockios.h:#define SIOCGPGRP _IOR('s', 9, pid_t)
arch/alpha/include/uapi/asm/sockios.h:#define SIOCGPGRP _IOR('s', 9, pid_t)
arch/sparc/include/uapi/asm/sockios.h:#define SIOCGPGRP 0x8904
include/uapi/asm-generic/sockios.h:#define SIOCGPGRP 0x8904It is visible that eXtensa should have the same definitions as alpha, mips and sh4 already do. This patch brings that to the accurate state.
--- linux-user/syscall_defs.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
linux-user/syscall_defs.h +2 -1
@@ -736,7 +736,8 @@ struct target_pollfd {#define TARGET_KDSETLED 0x4B32/* set led state [lights, not flags] */ #define TARGET_KDSIGACCEPT 0x4B4E -#if defined(TARGET_ALPHA ) || defined(TARGET_MIPS ) || defined(TARGET_SH4 ) +#if defined(TARGET_ALPHA ) || defined(TARGET_MIPS ) || defined(TARGET_SH4 ) || \ + defined(TARGET_XTENSA )#define TARGET_SIOCATMARK TARGET_IOR('s', 7, int)#define TARGET_SIOCGPGRP TARGET_IOR('s', 9, pid_t)#else
Signature · 1 line
2.7.4
PATCH 2/4 linux-user: Add support for the SIOCSPGRP ioctl
In reply to Aleksandar MarkovicFrom: Aleksandar Markovic <[email protected]>
Add support for setting the process (or process group) to receive SIGIO or SIGURG signals when I/O becomes possible or urgent data is available, using SIOCSPGRP ioctl.
The ioctl numeric values for SIOCSPGRP are platform-dependent and are determined by following files in Linux kernel source tree:
arch/ia64/include/uapi/asm/sockios.h:#define SIOCSPGRP 0x8902
arch/mips/include/uapi/asm/sockios.h:#define SIOCSPGRP _IOW('s', 8, pid_t)
arch/parisc/include/uapi/asm/sockios.h:#define SIOCSPGRP 0x8902
arch/sh/include/uapi/asm/sockios.h:#define SIOCSPGRP _IOW('s', 8, pid_t)
arch/xtensa/include/uapi/asm/sockios.h:#define SIOCSPGRP _IOW('s', 8, pid_t)
arch/alpha/include/uapi/asm/sockios.h:#define SIOCSPGRP _IOW('s', 8, pid_t)
arch/sparc/include/uapi/asm/sockios.h:#define SIOCSPGRP 0x8902
include/uapi/asm-generic/sockios.h:#define SIOCSPGRP 0x8902Hence the different definition for alpha, mips, sh4, and extensa.
--- linux-user/ioctls.h | 1 + linux-user/syscall_defs.h | 3 +++ 2 files changed, 4 insertions(+)
linux-user/ioctls.h +1 -0
@@ -218,6 +218,7 @@ IOCTL(SIOCSRARP, IOC_W, MK_PTR(MK_STRUCT(STRUCT_arpreq))) IOCTL(SIOCGRARP, IOC_R, MK_PTR(MK_STRUCT(STRUCT_arpreq))) IOCTL(SIOCGIWNAME, IOC_W | IOC_R, MK_PTR(MK_STRUCT(STRUCT_char_ifreq))) + IOCTL(SIOCSPGRP, IOC_W, MK_PTR(TYPE_INT)) /* pid_t */ IOCTL(SIOCGPGRP, IOC_R, MK_PTR(TYPE_INT)) /* pid_t */ IOCTL(SIOCGSTAMP, IOC_R, MK_PTR(MK_STRUCT(STRUCT_timeval)))IOCTL (SIOCGSTAMPNS ,IOC_R ,MK_PTR (MK_STRUCT (STRUCT_timespec)))
linux-user/syscall_defs.h +3 -0
@@ -739,11 +739,14 @@ struct target_pollfd {#if defined(TARGET_ALPHA ) || defined(TARGET_MIPS ) || defined(TARGET_SH4 ) || \ defined(TARGET_XTENSA )#define TARGET_SIOCATMARK TARGET_IOR('s', 7, int) +#define TARGET_SIOCSPGRP TARGET_IOW('s', 8, pid_t)#define TARGET_SIOCGPGRP TARGET_IOR('s', 9, pid_t)#else #define TARGET_SIOCATMARK 0x8905 +#define TARGET_SIOCSPGRP 0x8902#define TARGET_SIOCGPGRP 0x8904#endif +#define TARGET_SIOCGSTAMP 0x8906/* Get stamp (timeval) */ #define TARGET_SIOCGSTAMPNS 0x8907/* Get stamp (timespec) */
Signature · 1 line
2.7.4
PATCH 3/4 linux-user: Add support the SIOCSIFPFLAGS and SIOCGIFPFLAGS ioctls
In reply to Aleksandar MarkovicFrom: Neng Chen <[email protected]>
Add support for setting and getting extended (private) flags of a network device via SIOCSIFPFLAGS and SIOCGIFPFLAGS ioctls.
The ioctl numeric value is platform-independent and determined by the file include/uapi/linux/sockios.h in Linux kernel source code:
#define SIOCSIFPFLAGS 0x8934
The ioctls set and get field ifr_flags of type short in the structure ifreq. Such functionality in QEMU is achieved using MK_STRUCT() and MK_PTR() macros with an appropriate argument.
Message-Id: <[email protected]>
--- linux-user/ioctls.h | 2 ++ linux-user/syscall_defs.h | 2 ++ 2 files changed, 4 insertions(+)
linux-user/ioctls.h +2 -0
@@ -206,6 +206,8 @@ IOCTL(SIOCADDMULTI, IOC_W, MK_PTR(MK_STRUCT(STRUCT_sockaddr_ifreq))) IOCTL(SIOCDELMULTI, IOC_W, MK_PTR(MK_STRUCT(STRUCT_sockaddr_ifreq))) IOCTL(SIOCGIFINDEX, IOC_W | IOC_R, MK_PTR(MK_STRUCT(STRUCT_int_ifreq))) + IOCTL(SIOCSIFPFLAGS, IOC_W, MK_PTR(MK_STRUCT(STRUCT_short_ifreq))) + IOCTL(SIOCGIFPFLAGS, IOC_W | IOC_R, MK_PTR(MK_STRUCT(STRUCT_short_ifreq))) IOCTL(SIOCSIFLINK, 0, TYPE_NULL)IOCTL_SPECIAL (SIOCGIFCONF ,IOC_W |IOC_R , do_ioctl_ifconf,MK_PTR (MK_STRUCT (STRUCT_ifconf)))
linux-user/syscall_defs.h +2 -0
@@ -781,6 +781,8 @@ struct target_pollfd {#define TARGET_SIOCADDMULTI 0x8931/* Multicast address lists */ #define TARGET_SIOCDELMULTI 0x8932#define TARGET_SIOCGIFINDEX 0x8933 +#define TARGET_SIOCSIFPFLAGS 0x8934/* set extended flags */ +#define TARGET_SIOCGIFPFLAGS 0x8935/* get extended flags */ /* Bridging control calls */ #define TARGET_SIOCGIFBR 0x8940/* Bridging support */
Signature · 1 line
2.7.4
PATCH 4/4 linux-user: Sanitize interp_info and, for mips only, init field fp_abi
In reply to Aleksandar MarkovicFrom: Daniel Santos <[email protected]>
Sanitize interp_info structure in load_elf_binary() and, for mips only, init its field fp_abi. This fixes appearances of "Unexpected FPU mode" message in some MIPS use cases.
--- linux-user/elfload.c | 5 +++++ 1 file changed, 5 insertions(+)
linux-user/elfload.c +5 -0
@@ -2698,6 +2698,11 @@ int load_elf_binary(struct linux_binprm *bprm, struct image_info *info)char *elf_interpreter =NULL ;char *scratch; +memset (&interp_info,0 ,sizeof (interp_info)); +#ifdef TARGET_MIPS + interp_info.fp_abi =MIPS_ABI_FP_UNKNOWN ; +#endif + info->start_mmap = (abi_ulong )ELF_START_MMAP ; load_elf_image(bprm->filename, bprm->fd, info,
Signature · 1 line
2.7.4
Re: [Qemu-devel] [PATCH 4/4] linux-user: Sanitize interp_info and, for mips only, init field fp_abi
Hi Aleksandar,
Quoted 6 lines · Aleksandar Markovic
From: Daniel Santos <[email protected]>
Sanitize
interp_infostructure inload_elf_binary()and, for mips only, init its fieldfp_abi. This fixes appearances of "Unexpected FPU mode" message in some MIPS use cases.
Please add:
Quoted 13 lines
Signed-off-by Daniel Santos <[email protected]>Signed-off-by Aleksandar Markovic <[email protected]>--- linux-user/elfload.c | 5 +++++ 1 file changed, 5 insertions(+)linux-user/elfload.c +0
-0@@ -2698,6 +2698,11 @@ int load_elf_binary(struct linux_binprm *bprm, struct image_info *info)char *elf_interpreter =NULL ;
linux-user/elfload.c int load_elf_binary(struct linux_binprm *bprm, struct image_info *info) · line 2708
Quoted 10 lines
linux-user/elfload.c +5
-0char *scratch; +memset (&interp_info,0 ,sizeof (interp_info)); +#ifdef TARGET_MIPS + interp_info.fp_abi =MIPS_ABI_FP_UNKNOWN ; +#endif + info->start_mmap = (abi_ulong )ELF_START_MMAP ; load_elf_image(bprm->filename, bprm->fd, info,
Re: [Qemu-devel] [PATCH 4/4] linux-user: Sanitize interp_info and, for mips only, init field fp_abi
Quoted 8 lines
From: Philippe Mathieu-Daudé <[email protected]>
Subject: Re: [Qemu-devel] [PATCH 4/4] linux-user: Sanitizeinterp_infoand, for mips only, init fieldfp_abiHi Aleksandar,
Quoted 2 lines · Aleksandar Markovic
From: Daniel Santos <[email protected]>
Quoted 9 lines
Quoted 4 lines
Sanitize
interp_infostructure inload_elf_binary()and, for mips only, init its fieldfp_abi. This fixes appearances of "Unexpected FPU mode" message in some MIPS use cases.Please add:
Will do, Philippe. Thanks a bunch!
Aleksandar