[PATCH 2/2] linux-user: Add support for SIOCETHTOOL ioctl

2020-12-18 Thread Shu-Chun Weng via
The ioctl numeric values are platform-independent and determined by the file include/uapi/linux/sockios.h in Linux kernel source code: #define SIOCETHTOOL 0x8946 These ioctls get (or set) various structures pointed by the field ifr_data in the structure ifreq depending on the first 4 bytes of

[PATCH 1/2] thunk: supports flexible arrays

2020-12-18 Thread Shu-Chun Weng via
Flexible arrays may appear in the last field of a struct and are heavily used in the ioctl(SIOCETHTOOL) system call on Linux. E.g. struct ethtool_regs { __u32 cmd; __u32 version; /* driver-specific, indicates different chips/revs */ __u32 len; /* bytes */ __u8da

[PATCH 0/2] thunk, linux-user: Add support for SIOCETHTOOL ioctl

2020-12-18 Thread Shu-Chun Weng via
Hi Riku and Laurent, These two patches together implements the SIOCETHTOOL ioctl operations. Many of the kernel structures in this operations make use of flexible arrays (array with no size / zero size at the end of the structure), so I extended thunk to handle these fields natively. This patch s

[PATCH v3 2/2] linux-user: setsockopt() SO_TIMESTAMPNS and SO_TIMESTAMPING

2020-12-18 Thread Shu-Chun Weng via
This change supports SO_TIMESTAMPNS_OLD/NEW and SO_TIMESTAMPING_OLD/NEW for setsocketopt() with SOL_SOCKET. Based on the SO_TIMESTAMP_OLD/NEW framework. The three pairs share the same flag `SOCK_TSTAMP_NEW` in linux kernel for deciding if the old or the new format is used. Signed-off-by: Shu-Chun

[PATCH v3 1/2] linux-user: Update SO_TIMESTAMP to SO_TIMESTAMP_OLD/NEW

2020-12-18 Thread Shu-Chun Weng via
Both guest options map to host SO_TIMESTAMP while keeping a global bit to remember if the guest expects the old or the new format. Don't support programs mixing two formats. Added a multiarch test to verify. Signed-off-by: Shu-Chun Weng --- v1 -> v2: Only keep track of old or new format global

[PATCH v3 0/2] linux-user: SO_TIMESTAMP/NS/ING sockopt

2020-12-18 Thread Shu-Chun Weng via
Hi Laurent, This is the two timestamp-related patches splitted off per https://lists.nongnu.org/archive/html/qemu-devel/2020-12/msg05149.html v1 -> v2: Address comments on the first 5 (was 3) patches. Fix style problems. v2 -> v3: Split off into own group per https://lists.nongnu.org/arc

[PATCH v3 4/4] linux-user: Add IPv6 options to do_print_sockopt()

2020-12-18 Thread Shu-Chun Weng via
Signed-off-by: Shu-Chun Weng Reviewed-by: Laurent Vivier --- v1 -> v2: New: Add all IPV6 options to do_print_sockopt(), including the newly supported IPV6_ADDR_PREFERENCES. v2 -> v3: Rebase to master on Dec 18, 2020 linux-user/strace.c | 108

[PATCH v3 3/4] linux-user: add missing IPv6 get/setsockopt option

2020-12-18 Thread Shu-Chun Weng via
IPV6_ADDR_PREFERENCES (RFC5014: Source address selection) was not supported. Signed-off-by: Shu-Chun Weng Reviewed-by: Laurent Vivier --- v1 -> v2: Split out IPV6 options into own patch. do_print_sockopt() changes added in a separate patch since a large number of unrelated changes are invo

[PATCH v3 2/4] linux-user: add missing UDP get/setsockopt option

2020-12-18 Thread Shu-Chun Weng via
SOL_UDP manipulate options at UDP level. All six options currently defined in linux source include/uapi/linux/udp.h take integer values. Signed-off-by: Shu-Chun Weng Reviewed-by: Laurent Vivier --- v1 -> v2: Split out SOL_UDP into own patch. Updated do_print_sockopt(). v2 -> v3: Rebase to

[PATCH v3 0/4] fcntl and sockopt options

2020-12-18 Thread Shu-Chun Weng via
Hi Laurent, This is a series of 4 patches in 2 groups, putting into a single thread for easier tracking. [PATCH v3 1/4] linux-user: Support F_ADD_SEALS and F_GET_SEALS fcntls An incidental follow up on https://lists.nongnu.org/archive/html/qemu-devel/2019-09/msg01925.html [PATCH v3 2/4] linu

[PATCH v3 1/4] linux-user: Support F_ADD_SEALS and F_GET_SEALS fcntls

2020-12-18 Thread Shu-Chun Weng via
Also reorder blocks so that they are all in the same order everywhere. Signed-off-by: Shu-Chun Weng --- v1 -> v2: Updated print_fcntl(). v2 -> v3: Rebase to master on Dec 18, 2020 linux-user/strace.c | 39 --- linux-user/syscall.c | 10 +++

[PATCH v4] linux-user: Add most IFTUN ioctls

2020-09-28 Thread Shu-Chun Weng via
The three options handling `struct sock_fprog` (TUNATTACHFILTER, TUNDETACHFILTER, and TUNGETFILTER) are not implemented. Linux kernel keeps a user space pointer in them which we cannot correctly handle. Signed-off-by: Josh Kunz Signed-off-by: Shu-Chun Weng --- v2->v3: IOCTL_SPECIAL(TUNSETTXFIL

[PATCH v3] linux-user: Add most IFTUN ioctls

2020-09-28 Thread Shu-Chun Weng via
The three options handling `struct sock_fprog` (TUNATTACHFILTER, TUNDETACHFILTER, and TUNGETFILTER) are not implemented. Linux kernel keeps a user space pointer in them which we cannot correctly handle. Signed-off-by: Josh Kunz Signed-off-by: Shu-Chun Weng --- v3: IOCTL_SPECIAL(TUNSETTXFILTER)

Re: [Qemu-devel] [PATCH 0/2] Adding some setsockopt() options

2019-09-06 Thread Shu-Chun Weng via Qemu-devel
Ping. Patchwork links: http://patchwork.ozlabs.org/patch/1151884/ http://patchwork.ozlabs.org/patch/1151883/ On Thu, Aug 22, 2019 at 4:14 PM Shu-Chun Weng wrote: > Shu-Chun Weng (2): > linux-user: add missing UDP and IPv6 setsockopt options > linux-user: time stamping options for setsockopt

Re: [Qemu-devel] [PATCH] linux-user: hijack open() for thread directories

2019-09-06 Thread Shu-Chun Weng via Qemu-devel
Ping. Any comments on this? Patchwork: http://patchwork.ozlabs.org/patch/1151167/ On Wed, Aug 21, 2019 at 1:19 PM Shu-Chun Weng wrote: > Besides /proc/self|, files under /proc/thread-self and > /proc/self|/task/ also expose host information to the guest > program. This patch adds them to the hij

[Qemu-devel] [PATCH 1/2] linux-user: add missing UDP and IPv6 setsockopt options

2019-08-22 Thread Shu-Chun Weng via Qemu-devel
UDP: SOL_UDP manipulate options at UDP level. All six options currently defined in linux source include/uapi/linux/udp.h take integer values. IPv6: IPV6_ADDR_PREFERENCES (RFC5014: Source address selection) was not supported. Signed-off-by: Shu-Chun Weng --- linux-user/syscall.c | 6 +- 1 fi

[Qemu-devel] [PATCH 2/2] linux-user: time stamping options for setsockopt()

2019-08-22 Thread Shu-Chun Weng via Qemu-devel
This change supports SO_TIMESTAMPNS and SO_TIMESTAMPING for setsocketopt() with SOL_SOCKET. The TARGET_SO_TIMESTAMP{NS,ING} constants are already defined for alpha, hppa, and sparc. In include/uapi/asm-generic/socket.h: In arch/mips/include/uapi/asm/socket.h: Signed-off-by: Shu-Chun Weng --- l

[Qemu-devel] [PATCH 0/2] Adding some setsockopt() options

2019-08-22 Thread Shu-Chun Weng via Qemu-devel
Shu-Chun Weng (2): linux-user: add missing UDP and IPv6 setsockopt options linux-user: time stamping options for setsockopt() linux-user/generic/sockbits.h | 4 linux-user/mips/sockbits.h| 4 linux-user/syscall.c | 16 +--- 3 files changed, 21 insertions(+

[Qemu-devel] [PATCH] linux-user: hijack open() for thread directories

2019-08-21 Thread Shu-Chun Weng via Qemu-devel
Besides /proc/self|, files under /proc/thread-self and /proc/self|/task/ also expose host information to the guest program. This patch adds them to the hijack infrastracture. Note that is_proc_myself() does not check if the matches the current thread and is thus only suitable for procfs files that

[Qemu-devel] [PATCH] linux-user: erroneous fd_trans_unregister call

2019-08-19 Thread Shu-Chun Weng via Qemu-devel
timer_getoverrun returns the "overrun count" for the timer, which is not a file descriptor and thus should not call fd_trans_unregister on it. Signed-off-by: Shu-Chun Weng --- linux-user/syscall.c | 1 - 1 file changed, 1 deletion(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c inde

[Qemu-devel] [PATCH v3] linux-user: add memfd_create

2019-08-19 Thread Shu-Chun Weng via Qemu-devel
Add support for the memfd_create syscall. If the host does not have the libc wrapper, translate to a direct syscall with NC-macro. Buglink: https://bugs.launchpad.net/qemu/+bug/1734792 Signed-off-by: Shu-Chun Weng --- include/qemu/memfd.h | 4 linux-user/syscall.c | 12 util/m

[Qemu-devel] [PATCH v2] linux-user: add memfd_create

2019-08-19 Thread Shu-Chun Weng via Qemu-devel
Add support for the memfd_create syscall. If the host does not have the libc wrapper, translate to a direct syscall with NC-macro. Buglink: https://bugs.launchpad.net/qemu/+bug/1734792 Signed-off-by: Shu-Chun Weng --- include/qemu/memfd.h | 4 linux-user/syscall.c | 11 +++ util/me

[Qemu-devel] [PATCH v2] linux-user: Add support for SIOCETHTOOL ioctl

2019-08-16 Thread Shu-Chun Weng via Qemu-devel
The ioctl numeric values are platform-independent and determined by the file include/uapi/linux/sockios.h in Linux kernel source code: #define SIOCETHTOOL 0x8946 These ioctls get (or set) the field ifr_data of type char* in the structure ifreq. Such functionality is achieved in QEMU by using

Re: [Qemu-devel] [PATCH] Add support for ethtool via TARGET_SIOCETHTOOL ioctls.

2019-08-16 Thread Shu-Chun Weng via Qemu-devel
Shu-Chun On Fri, Aug 16, 2019 at 3:37 PM Aleksandar Markovic < aleksandar.m.m...@gmail.com> wrote: > > 16.08.2019. 23.28, "Shu-Chun Weng via Qemu-devel" > је написао/ла: > > > > The ioctl numeric values are platform-independent and determined by > >

[Qemu-devel] [PATCH] linux-user: add memfd_create

2019-08-16 Thread Shu-Chun Weng via Qemu-devel
Add support for the memfd_create syscall. If the host does not have the libc wrapper, translate to a direct syscall with NC-macro. Buglink: https://bugs.launchpad.net/qemu/+bug/1734792 Signed-off-by: Shu-Chun Weng --- include/qemu/memfd.h | 4 linux-user/syscall.c | 11 +++ util/me

[Qemu-devel] [PATCH] Add support for ethtool via TARGET_SIOCETHTOOL ioctls.

2019-08-16 Thread Shu-Chun Weng via Qemu-devel
The ioctl numeric values are platform-independent and determined by the file include/uapi/linux/sockios.h in Linux kernel source code: #define SIOCETHTOOL 0x8946 These ioctls get (or set) the field ifr_data of type char* in the structure ifreq. Such functionality is achieved in QEMU by using