qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v2 0/5] linux-user: A set of misc patches for 4.1
@ 2019-04-24 12:56 Aleksandar Markovic
  2019-04-24 12:56 ` Aleksandar Markovic
                   ` (5 more replies)
  0 siblings, 6 replies; 20+ messages in thread
From: Aleksandar Markovic @ 2019-04-24 12:56 UTC (permalink / raw)
  To: qemu-devel
  Cc: aurelien, amarkovic, arikalo, daniel.santos, jcmvbkbc, lvivier,
	thuth, philmd

From: Aleksandar Markovic <amarkovic@wavecomp.com>

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.

v1->v2:

  - added the patch on setsockopt()'s option IPV6_ADD_MEMBERSHIP
  - improved the commit message of interp_info sanitizing patch

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 (2):
  linux-user: Add support the SIOCSIFPFLAGS and SIOCGIFPFLAGS ioctls
  linux-user: setsockopt(): Add support for the option
    IPV6_ADD_MEMBERSHIP

 linux-user/elfload.c      |  5 +++++
 linux-user/ioctls.h       |  3 +++
 linux-user/syscall.c      | 18 ++++++++++++++++++
 linux-user/syscall_defs.h |  8 +++++++-
 4 files changed, 33 insertions(+), 1 deletion(-)

-- 
2.7.4

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [Qemu-devel] [PATCH v2 0/5] linux-user: A set of misc patches for 4.1
  2019-04-24 12:56 [Qemu-devel] [PATCH v2 0/5] linux-user: A set of misc patches for 4.1 Aleksandar Markovic
@ 2019-04-24 12:56 ` Aleksandar Markovic
  2019-04-24 12:56 ` [Qemu-devel] [PATCH v2 1/5] linux-user: Fix support for the SIOCATMARK and SIOCGPGRP ioctls for eXtensa Aleksandar Markovic
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 20+ messages in thread
From: Aleksandar Markovic @ 2019-04-24 12:56 UTC (permalink / raw)
  To: qemu-devel
  Cc: lvivier, thuth, jcmvbkbc, arikalo, daniel.santos, amarkovic,
	philmd, aurelien

From: Aleksandar Markovic <amarkovic@wavecomp.com>

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.

v1->v2:

  - added the patch on setsockopt()'s option IPV6_ADD_MEMBERSHIP
  - improved the commit message of interp_info sanitizing patch

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 (2):
  linux-user: Add support the SIOCSIFPFLAGS and SIOCGIFPFLAGS ioctls
  linux-user: setsockopt(): Add support for the option
    IPV6_ADD_MEMBERSHIP

 linux-user/elfload.c      |  5 +++++
 linux-user/ioctls.h       |  3 +++
 linux-user/syscall.c      | 18 ++++++++++++++++++
 linux-user/syscall_defs.h |  8 +++++++-
 4 files changed, 33 insertions(+), 1 deletion(-)

-- 
2.7.4



^ permalink raw reply	[flat|nested] 20+ messages in thread

* [Qemu-devel] [PATCH v2 1/5] linux-user: Fix support for the SIOCATMARK and SIOCGPGRP ioctls for eXtensa
  2019-04-24 12:56 [Qemu-devel] [PATCH v2 0/5] linux-user: A set of misc patches for 4.1 Aleksandar Markovic
  2019-04-24 12:56 ` Aleksandar Markovic
@ 2019-04-24 12:56 ` Aleksandar Markovic
  2019-04-24 12:56   ` Aleksandar Markovic
                     ` (2 more replies)
  2019-04-24 12:57 ` [Qemu-devel] [PATCH v2 2/5] linux-user: Add support for the SIOCSPGRP ioctl Aleksandar Markovic
                   ` (3 subsequent siblings)
  5 siblings, 3 replies; 20+ messages in thread
From: Aleksandar Markovic @ 2019-04-24 12:56 UTC (permalink / raw)
  To: qemu-devel
  Cc: aurelien, amarkovic, arikalo, daniel.santos, jcmvbkbc, lvivier,
	thuth, philmd

From: Aleksandar Markovic <amarkovic@wavecomp.com>

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   0x8905
include/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       0x8904

It is visible that eXtensa should have the same definitions as
alpha, mips and sh4 already do. This patch brings that to the
accurate state.

Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
---
 linux-user/syscall_defs.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
index 12c8407..1e86fb9 100644
--- a/linux-user/syscall_defs.h
+++ b/linux-user/syscall_defs.h
@@ -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
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [Qemu-devel] [PATCH v2 1/5] linux-user: Fix support for the SIOCATMARK and SIOCGPGRP ioctls for eXtensa
  2019-04-24 12:56 ` [Qemu-devel] [PATCH v2 1/5] linux-user: Fix support for the SIOCATMARK and SIOCGPGRP ioctls for eXtensa Aleksandar Markovic
@ 2019-04-24 12:56   ` Aleksandar Markovic
  2019-04-24 13:03   ` Aleksandar Markovic
  2019-04-26  5:10   ` Max Filippov
  2 siblings, 0 replies; 20+ messages in thread
From: Aleksandar Markovic @ 2019-04-24 12:56 UTC (permalink / raw)
  To: qemu-devel
  Cc: lvivier, thuth, jcmvbkbc, arikalo, daniel.santos, amarkovic,
	philmd, aurelien

From: Aleksandar Markovic <amarkovic@wavecomp.com>

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   0x8905
include/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       0x8904

It is visible that eXtensa should have the same definitions as
alpha, mips and sh4 already do. This patch brings that to the
accurate state.

Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
---
 linux-user/syscall_defs.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
index 12c8407..1e86fb9 100644
--- a/linux-user/syscall_defs.h
+++ b/linux-user/syscall_defs.h
@@ -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
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [Qemu-devel] [PATCH v2 2/5] linux-user: Add support for the SIOCSPGRP ioctl
  2019-04-24 12:56 [Qemu-devel] [PATCH v2 0/5] linux-user: A set of misc patches for 4.1 Aleksandar Markovic
  2019-04-24 12:56 ` Aleksandar Markovic
  2019-04-24 12:56 ` [Qemu-devel] [PATCH v2 1/5] linux-user: Fix support for the SIOCATMARK and SIOCGPGRP ioctls for eXtensa Aleksandar Markovic
@ 2019-04-24 12:57 ` Aleksandar Markovic
  2019-04-24 12:57   ` Aleksandar Markovic
  2019-04-26  5:14   ` Max Filippov
  2019-04-24 12:57 ` [Qemu-devel] [PATCH v2 3/5] linux-user: Add support the SIOCSIFPFLAGS and SIOCGIFPFLAGS ioctls Aleksandar Markovic
                   ` (2 subsequent siblings)
  5 siblings, 2 replies; 20+ messages in thread
From: Aleksandar Markovic @ 2019-04-24 12:57 UTC (permalink / raw)
  To: qemu-devel
  Cc: aurelien, amarkovic, arikalo, daniel.santos, jcmvbkbc, lvivier,
	thuth, philmd

From: Aleksandar Markovic <amarkovic@wavecomp.com>

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      0x8902

Hence the different definition for alpha, mips, sh4, and extensa.

Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
---
 linux-user/ioctls.h       | 1 +
 linux-user/syscall_defs.h | 3 +++
 2 files changed, 4 insertions(+)

diff --git a/linux-user/ioctls.h b/linux-user/ioctls.h
index ae89516..c37adc5 100644
--- a/linux-user/ioctls.h
+++ b/linux-user/ioctls.h
@@ -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)))
diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
index 1e86fb9..2941231 100644
--- a/linux-user/syscall_defs.h
+++ b/linux-user/syscall_defs.h
@@ -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) */
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [Qemu-devel] [PATCH v2 2/5] linux-user: Add support for the SIOCSPGRP ioctl
  2019-04-24 12:57 ` [Qemu-devel] [PATCH v2 2/5] linux-user: Add support for the SIOCSPGRP ioctl Aleksandar Markovic
@ 2019-04-24 12:57   ` Aleksandar Markovic
  2019-04-26  5:14   ` Max Filippov
  1 sibling, 0 replies; 20+ messages in thread
From: Aleksandar Markovic @ 2019-04-24 12:57 UTC (permalink / raw)
  To: qemu-devel
  Cc: lvivier, thuth, jcmvbkbc, arikalo, daniel.santos, amarkovic,
	philmd, aurelien

From: Aleksandar Markovic <amarkovic@wavecomp.com>

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      0x8902

Hence the different definition for alpha, mips, sh4, and extensa.

Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
---
 linux-user/ioctls.h       | 1 +
 linux-user/syscall_defs.h | 3 +++
 2 files changed, 4 insertions(+)

diff --git a/linux-user/ioctls.h b/linux-user/ioctls.h
index ae89516..c37adc5 100644
--- a/linux-user/ioctls.h
+++ b/linux-user/ioctls.h
@@ -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)))
diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
index 1e86fb9..2941231 100644
--- a/linux-user/syscall_defs.h
+++ b/linux-user/syscall_defs.h
@@ -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) */
 
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [Qemu-devel] [PATCH v2 3/5] linux-user: Add support the SIOCSIFPFLAGS and SIOCGIFPFLAGS ioctls
  2019-04-24 12:56 [Qemu-devel] [PATCH v2 0/5] linux-user: A set of misc patches for 4.1 Aleksandar Markovic
                   ` (2 preceding siblings ...)
  2019-04-24 12:57 ` [Qemu-devel] [PATCH v2 2/5] linux-user: Add support for the SIOCSPGRP ioctl Aleksandar Markovic
@ 2019-04-24 12:57 ` Aleksandar Markovic
  2019-04-24 12:57   ` Aleksandar Markovic
  2019-04-24 12:57 ` [Qemu-devel] [PATCH v2 4/5] linux-user: setsockopt(): Add support for the option IPV6_ADD_MEMBERSHIP Aleksandar Markovic
  2019-04-24 12:57 ` [Qemu-devel] [PATCH v2 5/5] linux-user: Sanitize interp_info and, for mips only, init field fp_abi Aleksandar Markovic
  5 siblings, 1 reply; 20+ messages in thread
From: Aleksandar Markovic @ 2019-04-24 12:57 UTC (permalink / raw)
  To: qemu-devel
  Cc: aurelien, amarkovic, arikalo, daniel.santos, jcmvbkbc, lvivier,
	thuth, philmd, Neng Chen

From: Neng Chen <nchen@wavecomp.com>

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.

Signed-off-by: Neng Chen <nchen@wavecomp.com>
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
Message-Id: <1554839486-3527-1-git-send-email-aleksandar.markovic@rt-rk.com>
---
 linux-user/ioctls.h       | 2 ++
 linux-user/syscall_defs.h | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/linux-user/ioctls.h b/linux-user/ioctls.h
index c37adc5..76375df 100644
--- a/linux-user/ioctls.h
+++ b/linux-user/ioctls.h
@@ -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)))
diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
index 2941231..8904d35 100644
--- a/linux-user/syscall_defs.h
+++ b/linux-user/syscall_defs.h
@@ -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             */
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [Qemu-devel] [PATCH v2 3/5] linux-user: Add support the SIOCSIFPFLAGS and SIOCGIFPFLAGS ioctls
  2019-04-24 12:57 ` [Qemu-devel] [PATCH v2 3/5] linux-user: Add support the SIOCSIFPFLAGS and SIOCGIFPFLAGS ioctls Aleksandar Markovic
@ 2019-04-24 12:57   ` Aleksandar Markovic
  0 siblings, 0 replies; 20+ messages in thread
From: Aleksandar Markovic @ 2019-04-24 12:57 UTC (permalink / raw)
  To: qemu-devel
  Cc: lvivier, thuth, jcmvbkbc, arikalo, daniel.santos, amarkovic,
	Neng Chen, philmd, aurelien

From: Neng Chen <nchen@wavecomp.com>

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.

Signed-off-by: Neng Chen <nchen@wavecomp.com>
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
Message-Id: <1554839486-3527-1-git-send-email-aleksandar.markovic@rt-rk.com>
---
 linux-user/ioctls.h       | 2 ++
 linux-user/syscall_defs.h | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/linux-user/ioctls.h b/linux-user/ioctls.h
index c37adc5..76375df 100644
--- a/linux-user/ioctls.h
+++ b/linux-user/ioctls.h
@@ -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)))
diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
index 2941231..8904d35 100644
--- a/linux-user/syscall_defs.h
+++ b/linux-user/syscall_defs.h
@@ -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             */
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [Qemu-devel] [PATCH v2 4/5] linux-user: setsockopt(): Add support for the option IPV6_ADD_MEMBERSHIP
  2019-04-24 12:56 [Qemu-devel] [PATCH v2 0/5] linux-user: A set of misc patches for 4.1 Aleksandar Markovic
                   ` (3 preceding siblings ...)
  2019-04-24 12:57 ` [Qemu-devel] [PATCH v2 3/5] linux-user: Add support the SIOCSIFPFLAGS and SIOCGIFPFLAGS ioctls Aleksandar Markovic
@ 2019-04-24 12:57 ` Aleksandar Markovic
  2019-04-24 12:57   ` Aleksandar Markovic
  2019-04-24 13:52   ` Aleksandar Markovic
  2019-04-24 12:57 ` [Qemu-devel] [PATCH v2 5/5] linux-user: Sanitize interp_info and, for mips only, init field fp_abi Aleksandar Markovic
  5 siblings, 2 replies; 20+ messages in thread
From: Aleksandar Markovic @ 2019-04-24 12:57 UTC (permalink / raw)
  To: qemu-devel
  Cc: aurelien, amarkovic, arikalo, daniel.santos, jcmvbkbc, lvivier,
	thuth, philmd, Neng Chen

From: Neng Chen <nchen@wavecomp.com>

Add support for the option IPV6_ADD_MEMBERSHIP of the syscall
setsockopt(). This option controls membership in multicast groups.
Argument is a pointer to a struct ipv6_mreq, which is in turn defined
in a platform-inedependant manner in the Linux kernel file
include/uapi/linux/in6.h as:

The <netinet/in.h> header defines the ipv6_mreq structure, which
includes the following members:

struct in6_addr ipv6mr_multiaddr  /* IPv6 multicast address   */
unsigned int    ipv6mr_interface  /* local interface index    */

struct ipv6_mreq {
    /* IPv6 multicast address of group */
    struct in6_addr  ipv6mr_multiaddr;

    /* local IPv6 address of interface */
    int              ipv6mr_ifindex;
};

The <netinet/in.h> header also defines the in6_addr structure,
which a union of the following structure:

struct in6_addr {
    union {
        __u8    u6_addr8[16];
        __be16  u6_addr16[8];
        __be32  u6_addr32[4];
    } in6_u;

The emulation behavior of IPV6_ADD_MEMBERSHIP is devised based on
the definitions above.

Signed-off-by: Neng Chen <nchen@wavecomp.com>
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
---
 linux-user/syscall.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 96cd4bf..b47a45d 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -1892,6 +1892,24 @@ static abi_long do_setsockopt(int sockfd, int level, int optname,
                                        &pki, sizeof(pki)));
             break;
         }
+        case IPV6_ADD_MEMBERSHIP:
+        {
+            struct ipv6_mreq ipv6mreq;
+
+            if (optlen < sizeof(ipv6mreq)) {
+                return -TARGET_EINVAL;
+            }
+
+            if (copy_from_user(&ipv6mreq, optval_addr, sizeof(ipv6mreq))) {
+                return -TARGET_EFAULT;
+            }
+
+            ipv6mreq.ipv6mr_interface = tswap32(ipv6mreq.ipv6mr_interface);
+
+            ret = get_errno(setsockopt(sockfd, level, optname,
+                                       &ipv6mreq, sizeof(ipv6mreq)));
+            break;
+        }
         default:
             goto unimplemented;
         }
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [Qemu-devel] [PATCH v2 4/5] linux-user: setsockopt(): Add support for the option IPV6_ADD_MEMBERSHIP
  2019-04-24 12:57 ` [Qemu-devel] [PATCH v2 4/5] linux-user: setsockopt(): Add support for the option IPV6_ADD_MEMBERSHIP Aleksandar Markovic
@ 2019-04-24 12:57   ` Aleksandar Markovic
  2019-04-24 13:52   ` Aleksandar Markovic
  1 sibling, 0 replies; 20+ messages in thread
From: Aleksandar Markovic @ 2019-04-24 12:57 UTC (permalink / raw)
  To: qemu-devel
  Cc: lvivier, thuth, jcmvbkbc, arikalo, daniel.santos, amarkovic,
	Neng Chen, philmd, aurelien

From: Neng Chen <nchen@wavecomp.com>

Add support for the option IPV6_ADD_MEMBERSHIP of the syscall
setsockopt(). This option controls membership in multicast groups.
Argument is a pointer to a struct ipv6_mreq, which is in turn defined
in a platform-inedependant manner in the Linux kernel file
include/uapi/linux/in6.h as:

The <netinet/in.h> header defines the ipv6_mreq structure, which
includes the following members:

struct in6_addr ipv6mr_multiaddr  /* IPv6 multicast address   */
unsigned int    ipv6mr_interface  /* local interface index    */

struct ipv6_mreq {
    /* IPv6 multicast address of group */
    struct in6_addr  ipv6mr_multiaddr;

    /* local IPv6 address of interface */
    int              ipv6mr_ifindex;
};

The <netinet/in.h> header also defines the in6_addr structure,
which a union of the following structure:

struct in6_addr {
    union {
        __u8    u6_addr8[16];
        __be16  u6_addr16[8];
        __be32  u6_addr32[4];
    } in6_u;

The emulation behavior of IPV6_ADD_MEMBERSHIP is devised based on
the definitions above.

Signed-off-by: Neng Chen <nchen@wavecomp.com>
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
---
 linux-user/syscall.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 96cd4bf..b47a45d 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -1892,6 +1892,24 @@ static abi_long do_setsockopt(int sockfd, int level, int optname,
                                        &pki, sizeof(pki)));
             break;
         }
+        case IPV6_ADD_MEMBERSHIP:
+        {
+            struct ipv6_mreq ipv6mreq;
+
+            if (optlen < sizeof(ipv6mreq)) {
+                return -TARGET_EINVAL;
+            }
+
+            if (copy_from_user(&ipv6mreq, optval_addr, sizeof(ipv6mreq))) {
+                return -TARGET_EFAULT;
+            }
+
+            ipv6mreq.ipv6mr_interface = tswap32(ipv6mreq.ipv6mr_interface);
+
+            ret = get_errno(setsockopt(sockfd, level, optname,
+                                       &ipv6mreq, sizeof(ipv6mreq)));
+            break;
+        }
         default:
             goto unimplemented;
         }
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [Qemu-devel] [PATCH v2 5/5] linux-user: Sanitize interp_info and, for mips only, init field fp_abi
  2019-04-24 12:56 [Qemu-devel] [PATCH v2 0/5] linux-user: A set of misc patches for 4.1 Aleksandar Markovic
                   ` (4 preceding siblings ...)
  2019-04-24 12:57 ` [Qemu-devel] [PATCH v2 4/5] linux-user: setsockopt(): Add support for the option IPV6_ADD_MEMBERSHIP Aleksandar Markovic
@ 2019-04-24 12:57 ` Aleksandar Markovic
  2019-04-24 12:57   ` Aleksandar Markovic
  5 siblings, 1 reply; 20+ messages in thread
From: Aleksandar Markovic @ 2019-04-24 12:57 UTC (permalink / raw)
  To: qemu-devel
  Cc: aurelien, amarkovic, arikalo, daniel.santos, jcmvbkbc, lvivier,
	thuth, philmd

From: Daniel Santos <daniel.santos@pobox.com>

Sanitize interp_info structure in load_elf_binary() and, for MIPS only,
init its field fp_abi to MIPS_ABI_FP_UNKNOWN. This fixes appearances of
"Unexpected FPU mode" message in some MIPS use cases. Currently, this
bug is a complete stopper for some MIPS binaries.

In load_elf_binary(), struct image_info interp_info is used without
being properly initialized. One result is that when the ELF's program
header doesn't contain an entry for the ABI flags, then the value of
the struct image_info's fp_abi field is set to whatever happened to
be in stack memory at the time.

Backporting to 4.0 and, if possible, to 3.1 is recommended.

Fixes: https://bugs.launchpad.net/qemu/+bug/1825002

Signed-off-by: Daniel Santos <daniel.santos@pobox.com>
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 linux-user/elfload.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index c1a2602..7f09d57 100644
--- a/linux-user/elfload.c
+++ b/linux-user/elfload.c
@@ -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,
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [Qemu-devel] [PATCH v2 5/5] linux-user: Sanitize interp_info and, for mips only, init field fp_abi
  2019-04-24 12:57 ` [Qemu-devel] [PATCH v2 5/5] linux-user: Sanitize interp_info and, for mips only, init field fp_abi Aleksandar Markovic
@ 2019-04-24 12:57   ` Aleksandar Markovic
  0 siblings, 0 replies; 20+ messages in thread
From: Aleksandar Markovic @ 2019-04-24 12:57 UTC (permalink / raw)
  To: qemu-devel
  Cc: lvivier, thuth, jcmvbkbc, arikalo, daniel.santos, amarkovic,
	philmd, aurelien

From: Daniel Santos <daniel.santos@pobox.com>

Sanitize interp_info structure in load_elf_binary() and, for MIPS only,
init its field fp_abi to MIPS_ABI_FP_UNKNOWN. This fixes appearances of
"Unexpected FPU mode" message in some MIPS use cases. Currently, this
bug is a complete stopper for some MIPS binaries.

In load_elf_binary(), struct image_info interp_info is used without
being properly initialized. One result is that when the ELF's program
header doesn't contain an entry for the ABI flags, then the value of
the struct image_info's fp_abi field is set to whatever happened to
be in stack memory at the time.

Backporting to 4.0 and, if possible, to 3.1 is recommended.

Fixes: https://bugs.launchpad.net/qemu/+bug/1825002

Signed-off-by: Daniel Santos <daniel.santos@pobox.com>
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 linux-user/elfload.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index c1a2602..7f09d57 100644
--- a/linux-user/elfload.c
+++ b/linux-user/elfload.c
@@ -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,
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 20+ messages in thread

* Re: [Qemu-devel] [PATCH v2 1/5] linux-user: Fix support for the SIOCATMARK and SIOCGPGRP ioctls for eXtensa
  2019-04-24 12:56 ` [Qemu-devel] [PATCH v2 1/5] linux-user: Fix support for the SIOCATMARK and SIOCGPGRP ioctls for eXtensa Aleksandar Markovic
  2019-04-24 12:56   ` Aleksandar Markovic
@ 2019-04-24 13:03   ` Aleksandar Markovic
  2019-04-24 13:03     ` Aleksandar Markovic
  2019-04-26  5:10   ` Max Filippov
  2 siblings, 1 reply; 20+ messages in thread
From: Aleksandar Markovic @ 2019-04-24 13:03 UTC (permalink / raw)
  To: Aleksandar Markovic, qemu-devel@nongnu.org, jcmvbkbc@gmail.com
  Cc: aurelien@aurel32.net, Aleksandar Rikalo, daniel.santos@pobox.com,
	lvivier@redhat.com, thuth@redhat.com, philmd@redhat.com

> From: Aleksandar Markovic <aleksandar.markovic@rt-rk.com>
> Subject: [PATCH v2 1/5] linux-user: Fix support for the SIOCATMARK and SIOCGPGRP ioctls for eXtensa
>
> Fix support for the SIOCATMARK and SIOCGPGRP ioctls for eXtensa by
> correcting corresponding macro definition.

Hello, Xtensa folks!

This patch was devised while looking at some MIPS scenarios, but, in fact,
it affects Xtensa platform only (found by inspecting relevant Linux kernel
headers).

Could someone form Xtensa Ack ot Not-Ack this patch?

Sincerely, Aleksandar

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [Qemu-devel] [PATCH v2 1/5] linux-user: Fix support for the SIOCATMARK and SIOCGPGRP ioctls for eXtensa
  2019-04-24 13:03   ` Aleksandar Markovic
@ 2019-04-24 13:03     ` Aleksandar Markovic
  0 siblings, 0 replies; 20+ messages in thread
From: Aleksandar Markovic @ 2019-04-24 13:03 UTC (permalink / raw)
  To: Aleksandar Markovic, qemu-devel@nongnu.org, jcmvbkbc@gmail.com
  Cc: lvivier@redhat.com, thuth@redhat.com, Aleksandar Rikalo,
	daniel.santos@pobox.com, philmd@redhat.com, aurelien@aurel32.net

> From: Aleksandar Markovic <aleksandar.markovic@rt-rk.com>
> Subject: [PATCH v2 1/5] linux-user: Fix support for the SIOCATMARK and SIOCGPGRP ioctls for eXtensa
>
> Fix support for the SIOCATMARK and SIOCGPGRP ioctls for eXtensa by
> correcting corresponding macro definition.

Hello, Xtensa folks!

This patch was devised while looking at some MIPS scenarios, but, in fact,
it affects Xtensa platform only (found by inspecting relevant Linux kernel
headers).

Could someone form Xtensa Ack ot Not-Ack this patch?

Sincerely, Aleksandar

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [Qemu-devel] [PATCH v2 4/5] linux-user: setsockopt(): Add support for the option IPV6_ADD_MEMBERSHIP
  2019-04-24 12:57 ` [Qemu-devel] [PATCH v2 4/5] linux-user: setsockopt(): Add support for the option IPV6_ADD_MEMBERSHIP Aleksandar Markovic
  2019-04-24 12:57   ` Aleksandar Markovic
@ 2019-04-24 13:52   ` Aleksandar Markovic
  2019-04-24 13:52     ` Aleksandar Markovic
  1 sibling, 1 reply; 20+ messages in thread
From: Aleksandar Markovic @ 2019-04-24 13:52 UTC (permalink / raw)
  To: Aleksandar Markovic, qemu-devel@nongnu.org
  Cc: aurelien@aurel32.net, Aleksandar Rikalo, daniel.santos@pobox.com,
	jcmvbkbc@gmail.com, lvivier@redhat.com, thuth@redhat.com,
	philmd@redhat.com, Neng Chen

> 
> ________________________________________
> From: Aleksandar Markovic <aleksandar.markovic@rt-rk.com>
> Sent: Wednesday, April 24, 2019 2:57 PM
> To: qemu-devel@nongnu.org
> Cc: aurelien@aurel32.net; Aleksandar Markovic; Aleksandar Rikalo; daniel.santos@pobox.com; jcmvbkbc@gmail.com; lvivier@redhat.com; thuth@redhat.com; philmd@redhat.com; Neng Chen
> Subject: [PATCH v2 4/5] linux-user: setsockopt(): Add support for the option IPV6_ADD_MEMBERSHIP
> 


Hello, Loraine,


I am just a submitter for this patch (the author is my colegue
Neng Chen), and I see that this patch really fills in some missing
functionality in linux-user, however I would like to ask you for
your opinion on the following:

1) Should the field ipv6mr_multiaddr also be subject to some
big/little endian conversion, or the current solution is sufficient?

2) Should we complete setsockopt() functionality with other remaining
not implemented options at this moment, while we are already on
implementing IPV6_ADD_MEMBERSHIP support?

Thanks,
Aleksandar


> From: Neng Chen <nchen@wavecomp.com>
> 
> Add support for the option IPV6_ADD_MEMBERSHIP of the syscall
> setsockopt(). This option controls membership in multicast groups.
> Argument is a pointer to a struct ipv6_mreq, which is in turn defined
> in a platform-inedependant manner in the Linux kernel file
> include/uapi/linux/in6.h as:
> 
> The <netinet/in.h> header defines the ipv6_mreq structure, which
> includes the following members:
> 
> struct in6_addr ipv6mr_multiaddr  /* IPv6 multicast address   */
> unsigned int    ipv6mr_interface  /* local interface index    */
> 
> struct ipv6_mreq {
>     /* IPv6 multicast address of group */
>     struct in6_addr  ipv6mr_multiaddr;
> 
>     /* local IPv6 address of interface */
>     int              ipv6mr_ifindex;
> };
> 
> The <netinet/in.h> header also defines the in6_addr structure,
> which a union of the following structure:
> 
> struct in6_addr {
>     union {
>         __u8    u6_addr8[16];
>         __be16  u6_addr16[8];
>         __be32  u6_addr32[4];
>     } in6_u;
> 
> The emulation behavior of IPV6_ADD_MEMBERSHIP is devised based on
> the definitions above.
> 
> Signed-off-by: Neng Chen <nchen@wavecomp.com>
> Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
> ---
>  linux-user/syscall.c | 18 ++++++++++++++++++
>  1 file changed, 18 insertions(+)
> 
> diff --git a/linux-user/syscall.c b/linux-user/syscall.c
> index 96cd4bf..b47a45d 100644
> --- a/linux-user/syscall.c
> +++ b/linux-user/syscall.c
> @@ -1892,6 +1892,24 @@ static abi_long do_setsockopt(int sockfd, int level, int optname,
>                                         &pki, sizeof(pki)));
>              break;
>          }
> +        case IPV6_ADD_MEMBERSHIP:
> +        {
> +            struct ipv6_mreq ipv6mreq;
> +
> +            if (optlen < sizeof(ipv6mreq)) {
> +                return -TARGET_EINVAL;
> +            }
> +
> +            if (copy_from_user(&ipv6mreq, optval_addr, sizeof(ipv6mreq))) {
> +                return -TARGET_EFAULT;
> +            }
> +
> +            ipv6mreq.ipv6mr_interface = tswap32(ipv6mreq.ipv6mr_interface);
> +
> +            ret = get_errno(setsockopt(sockfd, level, optname,
> +                                       &ipv6mreq, sizeof(ipv6mreq)));
> +            break;
> +        }
>          default:
>              goto unimplemented;
>          }
> --
> 2.7.4
> 
> 

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [Qemu-devel] [PATCH v2 4/5] linux-user: setsockopt(): Add support for the option IPV6_ADD_MEMBERSHIP
  2019-04-24 13:52   ` Aleksandar Markovic
@ 2019-04-24 13:52     ` Aleksandar Markovic
  0 siblings, 0 replies; 20+ messages in thread
From: Aleksandar Markovic @ 2019-04-24 13:52 UTC (permalink / raw)
  To: Aleksandar Markovic, qemu-devel@nongnu.org
  Cc: lvivier@redhat.com, thuth@redhat.com, jcmvbkbc@gmail.com,
	Aleksandar Rikalo, daniel.santos@pobox.com, Neng Chen,
	philmd@redhat.com, aurelien@aurel32.net

> 
> ________________________________________
> From: Aleksandar Markovic <aleksandar.markovic@rt-rk.com>
> Sent: Wednesday, April 24, 2019 2:57 PM
> To: qemu-devel@nongnu.org
> Cc: aurelien@aurel32.net; Aleksandar Markovic; Aleksandar Rikalo; daniel.santos@pobox.com; jcmvbkbc@gmail.com; lvivier@redhat.com; thuth@redhat.com; philmd@redhat.com; Neng Chen
> Subject: [PATCH v2 4/5] linux-user: setsockopt(): Add support for the option IPV6_ADD_MEMBERSHIP
> 


Hello, Loraine,


I am just a submitter for this patch (the author is my colegue
Neng Chen), and I see that this patch really fills in some missing
functionality in linux-user, however I would like to ask you for
your opinion on the following:

1) Should the field ipv6mr_multiaddr also be subject to some
big/little endian conversion, or the current solution is sufficient?

2) Should we complete setsockopt() functionality with other remaining
not implemented options at this moment, while we are already on
implementing IPV6_ADD_MEMBERSHIP support?

Thanks,
Aleksandar


> From: Neng Chen <nchen@wavecomp.com>
> 
> Add support for the option IPV6_ADD_MEMBERSHIP of the syscall
> setsockopt(). This option controls membership in multicast groups.
> Argument is a pointer to a struct ipv6_mreq, which is in turn defined
> in a platform-inedependant manner in the Linux kernel file
> include/uapi/linux/in6.h as:
> 
> The <netinet/in.h> header defines the ipv6_mreq structure, which
> includes the following members:
> 
> struct in6_addr ipv6mr_multiaddr  /* IPv6 multicast address   */
> unsigned int    ipv6mr_interface  /* local interface index    */
> 
> struct ipv6_mreq {
>     /* IPv6 multicast address of group */
>     struct in6_addr  ipv6mr_multiaddr;
> 
>     /* local IPv6 address of interface */
>     int              ipv6mr_ifindex;
> };
> 
> The <netinet/in.h> header also defines the in6_addr structure,
> which a union of the following structure:
> 
> struct in6_addr {
>     union {
>         __u8    u6_addr8[16];
>         __be16  u6_addr16[8];
>         __be32  u6_addr32[4];
>     } in6_u;
> 
> The emulation behavior of IPV6_ADD_MEMBERSHIP is devised based on
> the definitions above.
> 
> Signed-off-by: Neng Chen <nchen@wavecomp.com>
> Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
> ---
>  linux-user/syscall.c | 18 ++++++++++++++++++
>  1 file changed, 18 insertions(+)
> 
> diff --git a/linux-user/syscall.c b/linux-user/syscall.c
> index 96cd4bf..b47a45d 100644
> --- a/linux-user/syscall.c
> +++ b/linux-user/syscall.c
> @@ -1892,6 +1892,24 @@ static abi_long do_setsockopt(int sockfd, int level, int optname,
>                                         &pki, sizeof(pki)));
>              break;
>          }
> +        case IPV6_ADD_MEMBERSHIP:
> +        {
> +            struct ipv6_mreq ipv6mreq;
> +
> +            if (optlen < sizeof(ipv6mreq)) {
> +                return -TARGET_EINVAL;
> +            }
> +
> +            if (copy_from_user(&ipv6mreq, optval_addr, sizeof(ipv6mreq))) {
> +                return -TARGET_EFAULT;
> +            }
> +
> +            ipv6mreq.ipv6mr_interface = tswap32(ipv6mreq.ipv6mr_interface);
> +
> +            ret = get_errno(setsockopt(sockfd, level, optname,
> +                                       &ipv6mreq, sizeof(ipv6mreq)));
> +            break;
> +        }
>          default:
>              goto unimplemented;
>          }
> --
> 2.7.4
> 
> 

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [Qemu-devel] [PATCH v2 1/5] linux-user: Fix support for the SIOCATMARK and SIOCGPGRP ioctls for eXtensa
  2019-04-24 12:56 ` [Qemu-devel] [PATCH v2 1/5] linux-user: Fix support for the SIOCATMARK and SIOCGPGRP ioctls for eXtensa Aleksandar Markovic
  2019-04-24 12:56   ` Aleksandar Markovic
  2019-04-24 13:03   ` Aleksandar Markovic
@ 2019-04-26  5:10   ` Max Filippov
  2019-04-26  5:10     ` Max Filippov
  2 siblings, 1 reply; 20+ messages in thread
From: Max Filippov @ 2019-04-26  5:10 UTC (permalink / raw)
  To: Aleksandar Markovic
  Cc: qemu-devel, Aurelien Jarno, Aleksandar Markovic,
	Aleksandar Rikalo, daniel.santos, Laurent Vivier, Thomas Huth,
	Philippe Mathieu-Daudé

On Wed, Apr 24, 2019 at 5:57 AM Aleksandar Markovic
<aleksandar.markovic@rt-rk.com> wrote:
> From: Aleksandar Markovic <amarkovic@wavecomp.com>
>
> Fix support for the SIOCATMARK and SIOCGPGRP ioctls for eXtensa by

xtensa is the official name of this architecture, please fix the spelling
here...

> 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   0x8905
> include/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       0x8904
>
> It is visible that eXtensa should have the same definitions as

...here, and in the subject line.

> alpha, mips and sh4 already do. This patch brings that to the
> accurate state.
>
> Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
> ---
>  linux-user/syscall_defs.h | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

Acked-by: Max Filippov <jcmvbkbc@gmail.com>

-- 
Thanks.
-- Max

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [Qemu-devel] [PATCH v2 1/5] linux-user: Fix support for the SIOCATMARK and SIOCGPGRP ioctls for eXtensa
  2019-04-26  5:10   ` Max Filippov
@ 2019-04-26  5:10     ` Max Filippov
  0 siblings, 0 replies; 20+ messages in thread
From: Max Filippov @ 2019-04-26  5:10 UTC (permalink / raw)
  To: Aleksandar Markovic
  Cc: Laurent Vivier, Thomas Huth, Aleksandar Rikalo, qemu-devel,
	daniel.santos, Aleksandar Markovic, Philippe Mathieu-Daudé,
	Aurelien Jarno

On Wed, Apr 24, 2019 at 5:57 AM Aleksandar Markovic
<aleksandar.markovic@rt-rk.com> wrote:
> From: Aleksandar Markovic <amarkovic@wavecomp.com>
>
> Fix support for the SIOCATMARK and SIOCGPGRP ioctls for eXtensa by

xtensa is the official name of this architecture, please fix the spelling
here...

> 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   0x8905
> include/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       0x8904
>
> It is visible that eXtensa should have the same definitions as

...here, and in the subject line.

> alpha, mips and sh4 already do. This patch brings that to the
> accurate state.
>
> Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
> ---
>  linux-user/syscall_defs.h | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

Acked-by: Max Filippov <jcmvbkbc@gmail.com>

-- 
Thanks.
-- Max


^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [Qemu-devel] [PATCH v2 2/5] linux-user: Add support for the SIOCSPGRP ioctl
  2019-04-24 12:57 ` [Qemu-devel] [PATCH v2 2/5] linux-user: Add support for the SIOCSPGRP ioctl Aleksandar Markovic
  2019-04-24 12:57   ` Aleksandar Markovic
@ 2019-04-26  5:14   ` Max Filippov
  2019-04-26  5:14     ` Max Filippov
  1 sibling, 1 reply; 20+ messages in thread
From: Max Filippov @ 2019-04-26  5:14 UTC (permalink / raw)
  To: Aleksandar Markovic
  Cc: qemu-devel, Aurelien Jarno, Aleksandar Markovic,
	Aleksandar Rikalo, daniel.santos, Laurent Vivier, Thomas Huth,
	Philippe Mathieu-Daudé

On Wed, Apr 24, 2019 at 5:58 AM Aleksandar Markovic
<aleksandar.markovic@rt-rk.com> wrote:
>
> From: Aleksandar Markovic <amarkovic@wavecomp.com>
>
> 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      0x8902
>
> Hence the different definition for alpha, mips, sh4, and extensa.

Typo: xtensa.

> Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
> ---
>  linux-user/ioctls.h       | 1 +
>  linux-user/syscall_defs.h | 3 +++
>  2 files changed, 4 insertions(+)

Reviewed-by: Max Filippov <jcmvbkbc@gmail.com>

-- 
Thanks.
-- Max

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [Qemu-devel] [PATCH v2 2/5] linux-user: Add support for the SIOCSPGRP ioctl
  2019-04-26  5:14   ` Max Filippov
@ 2019-04-26  5:14     ` Max Filippov
  0 siblings, 0 replies; 20+ messages in thread
From: Max Filippov @ 2019-04-26  5:14 UTC (permalink / raw)
  To: Aleksandar Markovic
  Cc: Laurent Vivier, Thomas Huth, Aleksandar Rikalo, qemu-devel,
	daniel.santos, Aleksandar Markovic, Philippe Mathieu-Daudé,
	Aurelien Jarno

On Wed, Apr 24, 2019 at 5:58 AM Aleksandar Markovic
<aleksandar.markovic@rt-rk.com> wrote:
>
> From: Aleksandar Markovic <amarkovic@wavecomp.com>
>
> 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      0x8902
>
> Hence the different definition for alpha, mips, sh4, and extensa.

Typo: xtensa.

> Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
> ---
>  linux-user/ioctls.h       | 1 +
>  linux-user/syscall_defs.h | 3 +++
>  2 files changed, 4 insertions(+)

Reviewed-by: Max Filippov <jcmvbkbc@gmail.com>

-- 
Thanks.
-- Max


^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2019-04-26  5:15 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-04-24 12:56 [Qemu-devel] [PATCH v2 0/5] linux-user: A set of misc patches for 4.1 Aleksandar Markovic
2019-04-24 12:56 ` Aleksandar Markovic
2019-04-24 12:56 ` [Qemu-devel] [PATCH v2 1/5] linux-user: Fix support for the SIOCATMARK and SIOCGPGRP ioctls for eXtensa Aleksandar Markovic
2019-04-24 12:56   ` Aleksandar Markovic
2019-04-24 13:03   ` Aleksandar Markovic
2019-04-24 13:03     ` Aleksandar Markovic
2019-04-26  5:10   ` Max Filippov
2019-04-26  5:10     ` Max Filippov
2019-04-24 12:57 ` [Qemu-devel] [PATCH v2 2/5] linux-user: Add support for the SIOCSPGRP ioctl Aleksandar Markovic
2019-04-24 12:57   ` Aleksandar Markovic
2019-04-26  5:14   ` Max Filippov
2019-04-26  5:14     ` Max Filippov
2019-04-24 12:57 ` [Qemu-devel] [PATCH v2 3/5] linux-user: Add support the SIOCSIFPFLAGS and SIOCGIFPFLAGS ioctls Aleksandar Markovic
2019-04-24 12:57   ` Aleksandar Markovic
2019-04-24 12:57 ` [Qemu-devel] [PATCH v2 4/5] linux-user: setsockopt(): Add support for the option IPV6_ADD_MEMBERSHIP Aleksandar Markovic
2019-04-24 12:57   ` Aleksandar Markovic
2019-04-24 13:52   ` Aleksandar Markovic
2019-04-24 13:52     ` Aleksandar Markovic
2019-04-24 12:57 ` [Qemu-devel] [PATCH v2 5/5] linux-user: Sanitize interp_info and, for mips only, init field fp_abi Aleksandar Markovic
2019-04-24 12:57   ` Aleksandar Markovic

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).