[PATCH v4 1/2] linux-user: Define TARGET_O_LARGEFILE for aarch64

2023-12-28 Thread Shu-Chun Weng
rch64/m68k fcntl definitions to [arm|aarch64|m68k]/target_fcntl.h") Signed-off-by: Shu-Chun Weng Reviewed-by: Laurent Vivier --- linux-user/aarch64/target_fcntl.h | 1 + 1 file changed, 1 insertion(+) diff --git a/linux-user/aarch64/target_fcntl.h b/linux-user/aarch64/target_fcntl.h i

[PATCH v4 2/2] linux-user: Fix openat() emulation to not modify atime

2023-12-28 Thread Shu-Chun Weng
ealpath(3) and /proc/self/fd/n will resolve into the location of QEMU. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2004 Signed-off-by: Shu-Chun Weng Reviewed-by: Helge Deller --- linux-user/syscall.c | 50 1 file changed, 41 insert

[PATCH v4 0/2] linux-user: openat() fixes

2023-12-28 Thread Shu-Chun Weng
Since v3: - Fix build error: ignoring return value of 'readlink' declared with attribute 'warn_unused_result' [-Werror=unused-result] Since v2: - More robust handling of `readlink()` Since v1: - Eliminate static buffers in do_guest_openat() Shu-Chun Weng (2):

Re: [PATCH v3 2/2] linux-user: Fix openat() emulation to not modify atime

2023-12-28 Thread Shu-Chun Weng
Yup, reproduced on a system with glibc built with fortified source. Sending out version 4. On Thu, Dec 28, 2023 at 7:49 AM Helge Deller wrote: > On 12/8/23 23:42, Shu-Chun Weng wrote: > > Commit b8002058 strengthened openat()'s /proc detection by calling > > realpath(3) on t

Re: [PATCH v3 2/2] linux-user: Fix openat() emulation to not modify atime

2023-12-26 Thread Shu-Chun Weng
ping~ On Fri, Dec 8, 2023 at 2:42 PM Shu-Chun Weng wrote: > Commit b8002058 strengthened openat()'s /proc detection by calling > realpath(3) on the given path, which allows various paths and symlinks > that points to the /proc file system to be intercepted correctly. > &

[PATCH v3 2/2] linux-user: Fix openat() emulation to not modify atime

2023-12-08 Thread Shu-Chun Weng
ealpath(3) and /proc/self/fd/n will resolve into the location of QEMU. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2004 Signed-off-by: Shu-Chun Weng --- linux-user/syscall.c | 47 +++- 1 file changed, 38 insertions(+), 9 deletions(-) dif

[PATCH v3 0/2] linux-user: openat() fixes

2023-12-08 Thread Shu-Chun Weng
Since v2: - More robust handling of `readlink()` Since v1: - Eliminate static buffers in do_guest_openat() Shu-Chun Weng (2): linux-user: Define TARGET_O_LARGEFILE for aarch64 linux-user: Fix openat() emulation to not modify atime linux-user/aarch64/target_fcntl.h | 1 + linux-user

[PATCH v3 1/2] linux-user: Define TARGET_O_LARGEFILE for aarch64

2023-12-08 Thread Shu-Chun Weng
rch64/m68k fcntl definitions to [arm|aarch64|m68k]/target_fcntl.h") Signed-off-by: Shu-Chun Weng Reviewed-by: Laurent Vivier --- linux-user/aarch64/target_fcntl.h | 1 + 1 file changed, 1 insertion(+) diff --git a/linux-user/aarch64/target_fcntl.h b/linux-user/aarch64/target_fcntl.h i

Re: [PATCH 2/2] linux-user: Fix openat() emulation to not modify atime

2023-12-08 Thread Shu-Chun Weng
On Mon, Dec 4, 2023 at 8:58 AM Daniel P. Berrangé wrote: > On Thu, Nov 30, 2023 at 07:21:40PM -0800, Shu-Chun Weng wrote: > > Commit b8002058 strengthened openat()'s /proc detection by calling > > realpath(3) on the given path, which allows various paths and symlinks > >

[PATCH v2 0/2] linux-user: openat() fixes

2023-12-08 Thread Shu-Chun Weng
Since v1: - Eliminate static buffers in do_guest_openat() Shu-Chun Weng (2): linux-user: Define TARGET_O_LARGEFILE for aarch64 linux-user: Fix openat() emulation to not modify atime linux-user/aarch64/target_fcntl.h | 1 + linux-user/syscall.c | 47

[PATCH v2 2/2] linux-user: Fix openat() emulation to not modify atime

2023-12-08 Thread Shu-Chun Weng
ealpath(3) and /proc/self/fd/n will resolve into the location of QEMU. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2004 Signed-off-by: Shu-Chun Weng --- linux-user/syscall.c | 47 +++- 1 file changed, 38 insertions(+), 9 deletions(-) dif

[PATCH v2 1/2] linux-user: Define TARGET_O_LARGEFILE for aarch64

2023-12-08 Thread Shu-Chun Weng
rch64/m68k fcntl definitions to [arm|aarch64|m68k]/target_fcntl.h") Signed-off-by: Shu-Chun Weng Reviewed-by: Laurent Vivier --- linux-user/aarch64/target_fcntl.h | 1 + 1 file changed, 1 insertion(+) diff --git a/linux-user/aarch64/target_fcntl.h b/linux-user/aarch64/target_fcntl.h i

Re: [PATCH 2/2] linux-user: Fix openat() emulation to not modify atime

2023-12-01 Thread Shu-Chun Weng
On Fri, Dec 1, 2023 at 4:42 AM Philippe Mathieu-Daudé wrote: > Hi Shu-Chun, > > On 1/12/23 04:21, Shu-Chun Weng wrote: > > Commit b8002058 strengthened openat()'s /proc detection by calling > > realpath(3) on the given path, which allows various paths and symlinks &g

[PATCH 2/2] linux-user: Fix openat() emulation to not modify atime

2023-11-30 Thread Shu-Chun Weng
ealpath(3) and /proc/self/fd/n will resolve into the location of QEMU. Signed-off-by: Shu-Chun Weng --- linux-user/syscall.c | 42 +- 1 file changed, 33 insertions(+), 9 deletions(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index e384e1424

[PATCH 1/2] linux-user: Define TARGET_O_LARGEFILE for aarch64

2023-11-30 Thread Shu-Chun Weng
In 050a1ba, when moving the macros from preprocessor-guarding to file-based definition, TARGET_O_LARGEFILE appeared to have been accidentally left off. This may have correctness implication, but so far I was only confused by strace's output. Signed-off-by: Shu-Chun Weng --- linux-user/aa

[PATCH 0/2] linux-user: openat() fixes

2023-11-30 Thread Shu-Chun Weng
Shu-Chun Weng (2): linux-user: Define TARGET_O_LARGEFILE for aarch64 linux-user: Fix openat() emulation to not modify atime linux-user/aarch64/target_fcntl.h | 1 + linux-user/syscall.c | 42 --- 2 files changed, 34 insertions(+), 9 deletions(-)

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

2020-12-18 Thread Shu-Chun Weng via
of the memory region. This change clones the ioctl framework into ethtool-specific dispatch logic in its own file. A number of definitions previously only visible in syscall.c are thus exported to syscall_defs.h to be used in the new files. Signed-off-by: Shu-Chun Weng --- linux-user/ethtool.c

[PATCH 1/2] thunk: supports flexible arrays

2020-12-18 Thread Shu-Chun Weng via
passed to `MK_FLEXIBLE_ARRAY` means the number of element is specified by field number 2 (0-index). Signed-off-by: Shu-Chun Weng --- include/exec/user/thunk.h | 24 ++ thunk.c | 152 +- 2 files changed, 174 insertions(+), 2 deletions(-) di

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

2020-12-18 Thread Shu-Chun Weng via
set was previously sent out under "[PATCH 0/6] fcntl, sockopt, and ioctl options" and the following revisions, but did not get any feedback. Shu-Chun Weng (2): thunk: supports flexible arrays linux-user: Add support for SIOCETHTOOL ioctl include/exec/user/thunk.h | 24 +

[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 ne

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

2020-12-18 Thread Shu-Chun Weng via
nu.org/archive/html/qemu-devel/2020-12/msg05149.html Rebase to master on Dec 18, 2020 Shu-Chun Weng (2): linux-user: Update SO_TIMESTAMP to SO_TIMESTAMP_OLD/NEW linux-user: setsockopt() SO_TIMESTAMPNS and SO_TIMESTAMPING linux-user/alpha/sockbits.h| 21 +- linux-user/generic/sock

[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

[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

[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:

[PATCH v3 0/4] fcntl and sockopt options

2020-12-18 Thread Shu-Chun Weng via
/setsockopt v1 -> v2: Address comments on the first 5 (was 3) patches. Fix style problems. v2 -> v3: Split off first four reviewed changes into own group per https://lists.nongnu.org/archive/html/qemu-devel/2020-12/msg05149.html Rebase to master on Dec 18, 2020 Shu-Chun Weng (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

Re: [PATCH v2 5/8] linux-user: Update SO_TIMESTAMP to SO_TIMESTAMP_OLD/NEW

2020-12-17 Thread Shu-Chun Weng
them off into a new thread. Shu-Chun On Thu, Sep 17, 2020 at 12:29 AM Shu-Chun Weng wrote: > Ping -- any comments on the four patches start with this? > https://patchew.org/QEMU/cover.1597129029.git@google.com/ > > On Tue, Aug 11, 2020 at 12:10 AM Shu-Chun Weng wrote: > >&g

Re: [PATCH v2 6/8] linux-user: setsockopt() SO_TIMESTAMPNS and SO_TIMESTAMPING

2020-12-17 Thread Shu-Chun Weng
Ping -- any comments on https://patchew.org/QEMU/cover.1597129029.git@google.com/c1fdce46c35527ea9da34ca26eab4efcdac407db.1597129029.git@google.com/ On Tue, Aug 11, 2020 at 12:10 AM Shu-Chun Weng wrote: > This change supports SO_TIMESTAMPNS_OLD/NEW and SO_TIMESTAMPING_OLD/NEW &g

Re: [PATCH v2 7/8] thunk: supports flexible arrays

2020-12-17 Thread Shu-Chun Weng
Ping -- any comments on https://patchew.org/QEMU/cover.1597129029.git@google.com/e0754f52180aee6418eae8b3b8aa5981fcac12fd.1597129029.git@google.com/ On Tue, Aug 11, 2020 at 2:39 PM Shu-Chun Weng wrote: > Forgot to +riku.voi...@iki.fi when generating v2. > > On Tue, Aug 11, 2020

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

2020-12-17 Thread Shu-Chun Weng
devel/2020-08/msg02044.html https://lists.nongnu.org/archive/html/qemu-devel/2020-08/msg02051.html https://lists.nongnu.org/archive/html/qemu-devel/2020-08/msg01946.html Shu-Chun On Tue, Sep 29, 2020 at 4:29 PM Laurent Vivier wrote: > Le 11/08/2020 à 09:09, Shu-Chun Weng a écrit : > >

[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_SPEC

[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: [PATCH v2] linux-user: Add most IFTUN ioctls

2020-09-28 Thread Shu-Chun Weng
On Sat, Sep 26, 2020 at 9:44 AM Laurent Vivier wrote: > Le 24/07/2020 à 01:10, Shu-Chun Weng a écrit : > > The three options handling `struct sock_fprog` (TUNATTACHFILTER, > > TUNDETACHFILTER, and TUNGETFILTER) are not implemented. Linux kernel > > keeps a user space poi

Re: [PATCH v2 5/8] linux-user: Update SO_TIMESTAMP to SO_TIMESTAMP_OLD/NEW

2020-09-17 Thread Shu-Chun Weng
Ping -- any comments on the four patches start with this? https://patchew.org/QEMU/cover.1597129029.git@google.com/ On Tue, Aug 11, 2020 at 12:10 AM Shu-Chun Weng wrote: > Both guest options map to host SO_TIMESTAMP while keeping a global bit to > remember if the guest expects the

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

2020-09-17 Thread Shu-Chun Weng
Ping -- this one was broken off into its own patch from v1 due to the amount of addition. Hence I did not add Review-by. On Tue, Aug 11, 2020 at 12:10 AM Shu-Chun Weng wrote: > Signed-off-by: Shu-Chun Weng > --- > v1 -> v2: > New: Add all IPV6 options to do_print_sockopt()

Re: [PATCH 0/2] Instruction set detection for clang.

2020-09-17 Thread Shu-Chun Weng
Ping. On Wed, Aug 5, 2020 at 4:23 PM Shu-Chun Weng wrote: > Ping: https://patchew.org/QEMU/cover.1595463707.git@google.com/ > > On Wed, Jul 22, 2020 at 5:27 PM Shu-Chun Weng wrote: > >> Currently when configuring QEMU with clang, AVX2, AVX512F, ATOMIC64, and >> AT

Re: [PATCH v2] linux-user: Add most IFTUN ioctls

2020-09-17 Thread Shu-Chun Weng
Ping. On Wed, Aug 5, 2020 at 4:22 PM Shu-Chun Weng wrote: > Ping: https://patchew.org/QEMU/20200723231020.769893-1-...@google.com/ > > On Thu, Jul 23, 2020 at 4:10 PM Shu-Chun Weng wrote: > >> The three options handling `struct sock_fprog` (TUNATTACHFILTER, >> TUNDETACH

Re: [PATCH v3 1/1] cputlb: Make store_helper less fragile to compiler optimizations

2020-08-14 Thread Shu-Chun Weng
-new-pass-manager`. > > The inline recursion problem can be fixed solely by marking > helper_ret_stb_mmu as noinline, so the compiler does not make an > incorrect decision about which functions to inline. > > In addition, extract store_helper_unaligned as a noinline subroutine

Re: [PATCH v2 7/8] thunk: supports flexible arrays

2020-08-11 Thread Shu-Chun Weng
Forgot to +riku.voi...@iki.fi when generating v2. On Tue, Aug 11, 2020 at 12:10 AM Shu-Chun Weng wrote: > 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 { >

Re: [PATCH v2 2/8] linux-user: add missing UDP get/setsockopt option

2020-08-11 Thread Shu-Chun Weng
guest architectures that use 16-bit int type? Shu-Chun On Tue, Aug 11, 2020 at 7:21 AM Laurent Vivier wrote: > Le 11/08/2020 à 09:09, Shu-Chun Weng a écrit : > > SOL_UDP manipulate options at UDP level. All six options currently > defined > > in linux source include/uap

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

2020-08-11 Thread Shu-Chun Weng
of the memory region. This change clones the ioctl framework into ethtool-specific dispatch logic in its own file. A number of definitions previously only visible in syscall.c are thus exported to syscall_defs.h to be used in the new files. Signed-off-by: Shu-Chun Weng --- v1 -> v2: Fix st

[PATCH v2 6/8] linux-user: setsockopt() SO_TIMESTAMPNS and SO_TIMESTAMPING

2020-08-11 Thread Shu-Chun Weng
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 v2 5/8] linux-user: Update SO_TIMESTAMP to SO_TIMESTAMP_OLD/NEW

2020-08-11 Thread Shu-Chun Weng
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 ne

[PATCH v2 7/8] thunk: supports flexible arrays

2020-08-11 Thread Shu-Chun Weng
passed to `MK_FLEXIBLE_ARRAY` means the number of element is specified by field number 2 (0-index). Signed-off-by: Shu-Chun Weng --- v1 -> v2: Fix style problems. include/exec/user/thunk.h | 24 ++ thunk.c | 152 +- 2 files changed, 1

[PATCH v2 3/8] linux-user: add missing IPv6 get/setsockopt option

2020-08-11 Thread Shu-Chun Weng
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

[PATCH v2 1/8] linux-user: Support F_ADD_SEALS and F_GET_SEALS fcntls

2020-08-11 Thread Shu-Chun Weng
Also reorder blocks so that they are all in the same order everywhere. Signed-off-by: Shu-Chun Weng --- v1 -> v2: Updated print_fcntl(). linux-user/strace.c | 55 --- linux-user/syscall.c | 10 +++ linux-user/syscall_defs.h |

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

2020-08-11 Thread Shu-Chun Weng
Signed-off-by: Shu-Chun Weng --- v1 -> v2: New: Add all IPV6 options to do_print_sockopt(), including the newly supported IPV6_ADDR_PREFERENCES. linux-user/strace.c | 108 1 file changed, 108 insertions(+) diff --git a/linux-user/strace.

[PATCH v2 2/8] linux-user: add missing UDP get/setsockopt option

2020-08-11 Thread Shu-Chun Weng
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(). linux-user/strac

[PATCH v2 0/8] fcntl, sockopt, and ioctl options

2020-08-11 Thread Shu-Chun Weng
flexible arrays [PATCH v2 8/8] linux-user: Add support for SIOCETHTOOL ioctl Updated https://lists.nongnu.org/archive/html/qemu-devel/2019-08/msg05090.html v1 -> v2: Address comments on the first 5 (was 3) patches. Fix style problems. Shu-Chun Weng (8): linux-user: Support F_ADD_SEALS

Re: [PATCH 0/2] Instruction set detection for clang.

2020-08-05 Thread Shu-Chun Weng
Ping: https://patchew.org/QEMU/cover.1595463707.git@google.com/ On Wed, Jul 22, 2020 at 5:27 PM Shu-Chun Weng wrote: > Currently when configuring QEMU with clang, AVX2, AVX512F, ATOMIC64, and > ATOMIC128 are all disabled because the detection code is GCC-only. With > these > tw

Re: [PATCH v2] linux-user: Add most IFTUN ioctls

2020-08-05 Thread Shu-Chun Weng
Ping: https://patchew.org/QEMU/20200723231020.769893-1-...@google.com/ On Thu, Jul 23, 2020 at 4:10 PM Shu-Chun Weng wrote: > The three options handling `struct sock_fprog` (TUNATTACHFILTER, > TUNDETACHFILTER, and TUNGETFILTER) are not implemented. Linux kernel > keeps a user space p

Re: [PATCH 0/6] fcntl, sockopt, and ioctl options

2020-08-05 Thread Shu-Chun Weng
Ping! Patchew: https://patchew.org/QEMU/cover.1595461447.git@google.com/ On Wed, Jul 22, 2020 at 5:19 PM Shu-Chun Weng wrote: > Hi Laurent, > > This is a series of 6 patches in 4 groups, putting into a single thread for > easier tracking. > > [PATCH 1/6] linux-user: Suppo

Re: [PATCH v2] cputlb: Make store_helper less fragile to compiler optimizations

2020-07-27 Thread Shu-Chun Weng
Jul 27, 2020 at 11:51 AM Richard Henderson < richard.hender...@linaro.org> wrote: > On 7/24/20 12:51 PM, Shu-Chun Weng wrote: > > This change has no functional change. > > > > There is a potential link error with "undefined symbol: > > qemu_build_not_reached&qu

[PATCH v2] cputlb: Make store_helper less fragile to compiler optimizations

2020-07-24 Thread Shu-Chun Weng
} Since a byte store cannot span across more than one page, this is a no-op. Moreover, there is no more recursion making it more robust against potential optimizations. Signed-off-by: Shu-Chun Weng --- v1: https://patchew.org/QEMU/20200318062057.224953-1-...@google.com/ v1 -> v2: Restru

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

2020-07-23 Thread Shu-Chun Weng
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: Title changed from "

Re: [PATCH 1/2] configure: avx2 and avx512f detection for clang

2020-07-22 Thread Shu-Chun Weng
Huth wrote: > On 23/07/2020 02.27, Shu-Chun Weng wrote: > > Since clang does not support "#pragma GCC", the instruction sets are > > always disabled. In this change, we > > > > 1. wrap "#pragma GCC" inside "#ifndef __clang__", > >

[PATCH 1/2] configure: avx2 and avx512f detection for clang

2020-07-22 Thread Shu-Chun Weng
and annotate each function with `__attribute__((target(*)))` which is recognized by both gcc and clang. Signed-off-by: Shu-Chun Weng --- configure | 16 ++-- util/bufferiszero.c | 33 +++-- 2 files changed, 37 insertions(+), 12 deletions(-) diff

[PATCH 0/2] Instruction set detection for clang.

2020-07-22 Thread Shu-Chun Weng
Currently when configuring QEMU with clang, AVX2, AVX512F, ATOMIC64, and ATOMIC128 are all disabled because the detection code is GCC-only. With these two patches, I am able to configure, build, and run tests with clang with all of the above enabled. Shu-Chun Weng (2): configure: avx2 and

[PATCH 2/2] configure: atomic64/128 detection for clang

2020-07-22 Thread Shu-Chun Weng
work. However, clang does not recognize them. Replace the existing usages with the `_n` versions (or no suffix) which are the documented API. Signed-off-by: Shu-Chun Weng --- configure | 18 +- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/configure b/configure

[PATCH 3/6] linux-user: Update SO_TIMESTAMP to SO_TIMESTAMP_OLD/NEW

2020-07-22 Thread Shu-Chun Weng
Both guest options map to host SO_TIMESTAMP while keeping a bit in fd_trans to remember if the guest expects the old or the new format. Added a multiarch test to verify. Signed-off-by: Shu-Chun Weng --- linux-user/alpha/sockbits.h| 8 +- linux-user/fd-trans.h

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

2020-07-22 Thread Shu-Chun Weng
Signed-off-by: Shu-Chun Weng --- linux-user/syscall.c | 10 ++ linux-user/syscall_defs.h | 14 -- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 1211e759c2..f97337b0b4 100644 --- a/linux-user/syscall.c

[PATCH 4/6] linux-user: setsockopt() SO_TIMESTAMPNS and SO_TIMESTAMPING

2020-07-22 Thread Shu-Chun Weng
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 2/6] linux-user: add missing UDP and IPv6 get/setsockopt options

2020-07-22 Thread Shu-Chun Weng
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 | 10

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

2020-07-22 Thread Shu-Chun Weng
of the memory region. This change clones the ioctl framework into ethtool-specific dispatch logic in its own file. A number of definitions previously only visible in syscall.c are thus exported to syscall_defs.h to be used in the new files. Signed-off-by: Shu-Chun Weng --- linux-user

[PATCH 0/6] fcntl, sockopt, and ioctl options

2020-07-22 Thread Shu-Chun Weng
/msg05090.html Shu-Chun Weng (6): linux-user: Support F_ADD_SEALS and F_GET_SEALS fcntls linux-user: add missing UDP and IPv6 get/setsockopt options linux-user: Update SO_TIMESTAMP to SO_TIMESTAMP_OLD/NEW linux-user: setsockopt() SO_TIMESTAMPNS and SO_TIMESTAMPING thunk: supports flexible

[PATCH 5/6] thunk: supports flexible arrays

2020-07-22 Thread Shu-Chun Weng
passed to `MK_FLEXIBLE_ARRAY` means the number of element is specified by field number 2 (0-index). Signed-off-by: Shu-Chun Weng --- include/exec/user/thunk.h | 20 + thunk.c | 151 +- 2 files changed, 169 insertions(+), 2 deletions(-) di

Re: [PATCH] Makes softmmu compile with clang at HEAD

2020-03-30 Thread Shu-Chun Weng
Ping. On Tue, Mar 17, 2020 at 11:21 PM Shu-Chun Weng wrote: > With clang at HEAD, linking fails with "undefined symbol: > qemu_build_not_reached". It's because `store_helper` and > `helper_ret_stb_mmu` are mutually recursive and clang inlined latter > inside the form

[PATCH] Makes softmmu compile with clang at HEAD

2020-03-17 Thread Shu-Chun Weng
enting constant propogation. Signed-off-by: Shu-Chun Weng --- accel/tcg/cputlb.c | 1 + 1 file changed, 1 insertion(+) diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c index e3b5750c3b..a7c812ed72 100644 --- a/accel/tcg/cputlb.c +++ b/accel/tcg/cputlb.c @@ -2050,6 +2050,7 @@ store_helper(CP

Re: [PATCH] Fix unsigned integer underflow in fd-trans.c

2019-10-18 Thread Shu-Chun Weng
it's bounded by nlmsg_len. Shu-Chun On Fri, Oct 18, 2019 at 12:26 AM Laurent Vivier wrote: > > Le 18/10/2019 à 02:19, Shu-Chun Weng a écrit : > > In any of these `*_for_each_*` functions, the last entry in the buffer (so > > the > > "remaining length in the buff

Re: [PATCH] Fix unsigned integer underflow in fd-trans.c

2019-10-18 Thread Shu-Chun Weng
te: > Le 18/10/2019 à 02:19, Shu-Chun Weng a écrit : > > In any of these `*_for_each_*` functions, the last entry in the buffer > (so the > > "remaining length in the buffer" `len` is equal to the length of the > > entry `nlmsg_len`/`nla_len`/etc) has size th

[PATCH] Fix unsigned integer underflow in fd-trans.c

2019-10-17 Thread Shu-Chun Weng
than `len`. Since `len` is unsigned (`size_t`), it underflows and the loop will read pass the buffer. This may manifest as random EINVAL or EOPNOTSUPP error on IO or network system calls. Signed-off-by: Shu-Chun Weng --- linux-user/fd-trans.c | 51 +-- 1 fi

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 op

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 th

[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

[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

[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
buf); main_thread_tid = gettid(); snprintf(buf, sizeof(buf), "/proc/self/task/%ld", main_thread_tid); print_info("Main", buf); snprintf(buf, sizeof(buf), "/proc/%ld/task/%ld", (long) getpid(), main_thread_tid); print_info("Main", buf); if ((ret =

[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

[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

[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

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

2019-08-16 Thread Shu-Chun Weng via Qemu-devel
MK_STRUCT() and MK_PTR() macros with an appropriate argument, as it was done for existing similar cases. Signed-off-by: Shu-Chun Weng --- linux-user/ioctls.h | 1 + linux-user/syscall_defs.h | 2 ++ 2 files changed, 3 insertions(+) diff --git a/linux-user/ioctls.h b/linux-user/ioctls.h

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

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

2019-08-16 Thread Shu-Chun Weng via Qemu-devel
MK_STRUCT() and MK_PTR() macros with an appropriate argument, as it was done for existing similar cases. Signed-off-by: Shu-Chun Weng --- linux-user/ioctls.h | 1 + linux-user/syscall_defs.h | 2 ++ 2 files changed, 3 insertions(+) diff --git a/linux-user/ioctls.h b/linux-user/ioctls.h