qemu-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-commits] [qemu/qemu] 71e244: linux-user: Use EPROTONOSUPPORT for u


From: Peter Maydell
Subject: [Qemu-commits] [qemu/qemu] 71e244: linux-user: Use EPROTONOSUPPORT for unimplemented ...
Date: Tue, 14 Jul 2020 13:30:30 -0700

  Branch: refs/heads/master
  Home:   https://github.com/qemu/qemu
  Commit: 71e2443e4ca1540db63c0bbf58ae78944c97e993
      
https://github.com/qemu/qemu/commit/71e2443e4ca1540db63c0bbf58ae78944c97e993
  Author: Josh Kunz <jkz@google.com>
  Date:   2020-07-13 (Mon, 13 Jul 2020)

  Changed paths:
    M linux-user/syscall.c

  Log Message:
  -----------
  linux-user: Use EPROTONOSUPPORT for unimplemented netlink protocols

Linux uses the EPROTONOSUPPORT error code[1] if the users requests a
netlink socket with an unsupported netlink protocol. This change
switches linux-user to use the same code as Linux, instead of
EPFNOSUPPORT (which AFAIK is just an anachronistic version of
EAFNOSUPPORT).

Tested by compiling all linux-user targets on x86.

[1]:
https://github.com/torvalds/linux/blob/bfe91da29bfad9941d5d703d45e29f0812a20724/net/netlink/af_netlink.c#L683

Signed-off-by: Josh Kunz <jkz@google.com>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20200707001036.1671982-1-jkz@google.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>


  Commit: d8c08b1e6c7b1a5be1ec70e339437823a41b1946
      
https://github.com/qemu/qemu/commit/d8c08b1e6c7b1a5be1ec70e339437823a41b1946
  Author: Matus Kysel <mkysel@tachyum.com>
  Date:   2020-07-13 (Mon, 13 Jul 2020)

  Changed paths:
    M linux-user/syscall.c

  Log Message:
  -----------
  linux-user: refactor ipc syscall and support of semtimedop syscall

Refactoring ipc syscall for s390x and SPARC, so it matches glibc implementation

We should add support of semtimedop syscall as new version of glibc
2.31 uses semop based on semtimedop
(commit: 
https://gitlab.com/freedesktop-sdk/mirrors/sourceware/glibc/-/commit/765cdd0bffd77960ae852104fc4ea5edcdb8aed3
 ).

Signed-off-by: Matus Kysel <mkysel@tachyum.com>
Message-Id: <20200626124612.58593-2-mkysel@tachyum.com>
Message-Id: <20200626124612.58593-3-mkysel@tachyum.com>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
[lv: merged PATCH 1 & 2 to avoid build break on PATCH 1]
Signed-off-by: Laurent Vivier <laurent@vivier.eu>


  Commit: 4c1850c130a31e6f3cc896a5ba5fb7a602540bc9
      
https://github.com/qemu/qemu/commit/4c1850c130a31e6f3cc896a5ba5fb7a602540bc9
  Author: Laurent Vivier <laurent@vivier.eu>
  Date:   2020-07-13 (Mon, 13 Jul 2020)

  Changed paths:
    M linux-user/strace.c

  Log Message:
  -----------
  linux-user: Fix Coverity CID 1430271 / CID 1430272

In new functions print_ioctl() and print_syscall_ret_ioctl(), we don't
check if lock_user() returns NULL and this would cause a segfault in
thunk_print().

If lock_user() returns NULL don't call thunk_print() but prints only the
value of the (invalid) pointer.

Tested with:

    # cat ioctl.c
    #include <unistd.h>
    #include <sys/ioctl.h>

    int main(void)
    {
        int ret;

        ret = ioctl(STDOUT_FILENO, TCGETS, 0xdeadbeef);
        ret = ioctl(STDOUT_FILENO, TCSETSF, 0xdeadbeef);
        return 0;
    }
    # QEMU_STRACE= ./ioctl
    ...
    578 ioctl(1,TCGETS,0xdeadbeef) = -1 errno=2 (Bad address)
    578 ioctl(1,TCSETSF,0xdeadbeef) = -1 errno=2 (Bad address)
    ...
    # QEMU_STRACE= passwd
    ...
    623 ioctl(0,TCGETS,0x3fffed04) = 0 ({})
    623 ioctl(0,TCSETSF,{}) = 0
    ...

Reported-by: Peter Maydell <peter.maydell@linaro.org>
Fixes: 79482e5987c8 ("linux-user: Add strace support for printing arguments of 
ioctl()")
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>


  Commit: d9679ee592dd181854a39ed05db4038c0a6bbf80
      
https://github.com/qemu/qemu/commit/d9679ee592dd181854a39ed05db4038c0a6bbf80
  Author: Laurent Vivier <laurent@vivier.eu>
  Date:   2020-07-13 (Mon, 13 Jul 2020)

  Changed paths:
    M linux-user/fd-trans.c

  Log Message:
  -----------
  linux-user: add new netlink types

Only implement IFLA_PERM_ADDRESS to fix the following error:

  Unknown host QEMU_IFLA type: 54

The couple of other ones, IFLA_PROP_LIST and IFLA_ALT_IFNAME, have
been introduced to be used with RTM_NEWLINKPROP, RTM_DELLINKPROP and
RTM_GETLINKPROP that are not implemented by QEMU.

Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20200709072332.890440-1-laurent@vivier.eu>


  Commit: 65b261a63a48fbb3b11193361d4ea0c38a3c3dfd
      
https://github.com/qemu/qemu/commit/65b261a63a48fbb3b11193361d4ea0c38a3c3dfd
  Author: Laurent Vivier <laurent@vivier.eu>
  Date:   2020-07-13 (Mon, 13 Jul 2020)

  Changed paths:
    M linux-user/fd-trans.c

  Log Message:
  -----------
  linux-user: add netlink RTM_SETLINK command

This command is needed to be able to boot systemd in a container.

  $ sudo systemd-nspawn -D /chroot/armhf/sid/ -b
  Spawning container sid on /chroot/armhf/sid.
  Press ^] three times within 1s to kill container.
  systemd 245.6-2 running in system mode.
  Detected virtualization systemd-nspawn.
  Detected architecture arm.

  Welcome to Debian GNU/Linux bullseye/sid!

  Set hostname to <virt-arm>.
  Failed to enqueue loopback interface start request: Operation not supported
  Caught <SEGV>, dumped core as pid 3.
  Exiting PID 1...
  Container sid failed with error code 255.

Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20200709072332.890440-2-laurent@vivier.eu>


  Commit: 6733d57035d1c4a67070b8d737334c28e5c63bc6
      
https://github.com/qemu/qemu/commit/6733d57035d1c4a67070b8d737334c28e5c63bc6
  Author: Laurent Vivier <laurent@vivier.eu>
  Date:   2020-07-14 (Tue, 14 Jul 2020)

  Changed paths:
    M linux-user/strace.c

  Log Message:
  -----------
  linux-user: fix the errno value in print_syscall_err()

errno of the target is returned as a negative value by the syscall,
not in the host errno variable.

The emulation of the target syscall can return an error while the
host doesn't set an errno value. Target errnos and host errnos can
also differ in some cases.

Fixes: c84be71f6854 ("linux-user: Extend strace support to enable argument 
printing after syscall execution")
Cc: Filip.Bozuta@syrmia.com
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Filip Bozuta <Filip.Bozuta@syrmia.com>
Message-Id: <20200708152435.706070-2-laurent@vivier.eu>


  Commit: 42b16184d016d48d167229a1ddb89b3671c77440
      
https://github.com/qemu/qemu/commit/42b16184d016d48d167229a1ddb89b3671c77440
  Author: Laurent Vivier <laurent@vivier.eu>
  Date:   2020-07-14 (Tue, 14 Jul 2020)

  Changed paths:
    M linux-user/strace.c

  Log Message:
  -----------
  linux-user: fix print_syscall_err() when syscall returned value is negative

print_syscall_err() relies on the sign of the returned value to know
if it is an errno value or not.

But in some cases the returned value can have the most signicant bit
set without being an errno.

This patch restores previous behaviour that was also checking if
we can decode the errno to validate it.

This patch fixes this kind of problem (qemu-m68k):

  root@sid:/# QEMU_STRACE= ls
  3 brk(NULL) = -1 errno=21473607683 uname(0x407fff8a) = 0

to become:

  root@sid:/# QEMU_STRACE= ls
  3 brk(NULL) = 0x8001e000
  3 uname(0xffffdf8a) = 0

Fixes: c84be71f6854 ("linux-user: Extend strace support to enable argument 
printing after syscall execution")
Cc: Filip.Bozuta@syrmia.com
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20200708152435.706070-3-laurent@vivier.eu>


  Commit: 8bfa25a46ff1082f75e7052875b5d435119dcf49
      
https://github.com/qemu/qemu/commit/8bfa25a46ff1082f75e7052875b5d435119dcf49
  Author: Peter Maydell <peter.maydell@linaro.org>
  Date:   2020-07-14 (Tue, 14 Jul 2020)

  Changed paths:
    M linux-user/fd-trans.c
    M linux-user/strace.c
    M linux-user/syscall.c

  Log Message:
  -----------
  Merge remote-tracking branch 
'remotes/vivier2/tags/linux-user-for-5.1-pull-request' into staging

linux-user branch 20200714

Fix strace errno management
Fix Coverity erros in ioctl straces
Fix some netlinks errors
Fix semtimedop

# gpg: Signature made Tue 14 Jul 2020 08:31:56 BST
# gpg:                using RSA key CD2F75DDC8E3A4DC2E4F5173F30C38BD3F2FBE3C
# gpg:                issuer "laurent@vivier.eu"
# gpg: Good signature from "Laurent Vivier <lvivier@redhat.com>" [full]
# gpg:                 aka "Laurent Vivier <laurent@vivier.eu>" [full]
# gpg:                 aka "Laurent Vivier (Red Hat) <lvivier@redhat.com>" 
[full]
# Primary key fingerprint: CD2F 75DD C8E3 A4DC 2E4F  5173 F30C 38BD 3F2F BE3C

* remotes/vivier2/tags/linux-user-for-5.1-pull-request:
  linux-user: fix print_syscall_err() when syscall returned value is negative
  linux-user: fix the errno value in print_syscall_err()
  linux-user: add netlink RTM_SETLINK command
  linux-user: add new netlink types
  linux-user: Fix Coverity CID 1430271 / CID 1430272
  linux-user: refactor ipc syscall and support of semtimedop syscall
  linux-user: Use EPROTONOSUPPORT for unimplemented netlink protocols

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>


Compare: https://github.com/qemu/qemu/compare/d2628b1eb761...8bfa25a46ff1



reply via email to

[Prev in Thread] Current Thread [Next in Thread]