qemu-commits
[Top][All Lists]
Advanced

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

[Qemu-commits] [qemu/qemu] 9d660a: linux-user: add missing TARGET_SIGRTM


From: Peter Maydell
Subject: [Qemu-commits] [qemu/qemu] 9d660a: linux-user: add missing TARGET_SIGRTMIN for hppa
Date: Fri, 14 Feb 2020 10:00:19 -0800

  Branch: refs/heads/master
  Home:   https://github.com/qemu/qemu
  Commit: 9d660adc3248b81618e7afc1ddef6c9731e1047f
      
https://github.com/qemu/qemu/commit/9d660adc3248b81618e7afc1ddef6c9731e1047f
  Author: Laurent Vivier <address@hidden>
  Date:   2020-02-12 (Wed, 12 Feb 2020)

  Changed paths:
    M linux-user/hppa/target_signal.h

  Log Message:
  -----------
  linux-user: add missing TARGET_SIGRTMIN for hppa

This signal is defined for all other targets and we will need it later

Signed-off-by: Laurent Vivier <address@hidden>
[pm: that this was actually an ABI change in the hppa kernel (at kernel
version 3.17, kernel commit 1f25df2eff5b25f52c139d). Before that
SIGRTMIN was 37...
All our other HPPA TARGET_SIG* values are for the updated
ABI following that commit, so using 32 for SIGRTMIN is
the right thing for us.]
Reviewed-by: Peter Maydell <address@hidden>
Tested-by: Taylor Simpson <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Laurent Vivier <address@hidden>


  Commit: 365510fb860a91dbead7d6c9e5815ef9d4e72062
      
https://github.com/qemu/qemu/commit/365510fb860a91dbead7d6c9e5815ef9d4e72062
  Author: Laurent Vivier <address@hidden>
  Date:   2020-02-12 (Wed, 12 Feb 2020)

  Changed paths:
    M linux-user/signal.c

  Log Message:
  -----------
  linux-user: cleanup signal.c

No functional changes. Prepare the field for future fixes.

Remove memset(.., 0, ...) that is useless on a static array

Signed-off-by: Laurent Vivier <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
Reviewed-by: Peter Maydell <address@hidden>
Tested-by: Taylor Simpson <address@hidden>
Message-Id: <address@hidden>


  Commit: 9fcff3a67f2be53de2d9b27c270ba2a4ecba8810
      
https://github.com/qemu/qemu/commit/9fcff3a67f2be53de2d9b27c270ba2a4ecba8810
  Author: Laurent Vivier <address@hidden>
  Date:   2020-02-12 (Wed, 12 Feb 2020)

  Changed paths:
    M linux-user/signal.c

  Log Message:
  -----------
  linux-user: fix TARGET_NSIG and _NSIG uses

Valid signal numbers are between 1 (SIGHUP) and SIGRTMAX.

System includes define _NSIG to SIGRTMAX + 1, but
QEMU (like kernel) defines TARGET_NSIG to TARGET_SIGRTMAX.

Fix all the checks involving the signal range.

Signed-off-by: Laurent Vivier <address@hidden>
Reviewed-by: Peter Maydell <address@hidden>
Tested-by: Taylor Simpson <address@hidden>
Message-Id: <address@hidden>


  Commit: 6bc024e713fd35eb5fddbe16acd8dc92d27872a9
      
https://github.com/qemu/qemu/commit/6bc024e713fd35eb5fddbe16acd8dc92d27872a9
  Author: Laurent Vivier <address@hidden>
  Date:   2020-02-12 (Wed, 12 Feb 2020)

  Changed paths:
    M linux-user/signal.c
    M linux-user/trace-events

  Log Message:
  -----------
  linux-user: fix use of SIGRTMIN

Some RT signals can be in use by glibc,
it's why SIGRTMIN (34) is generally greater than __SIGRTMIN (32).

So SIGRTMIN cannot be mapped to TARGET_SIGRTMIN.

Instead of swapping only SIGRTMIN and SIGRTMAX, map all the
range [TARGET_SIGRTMIN ... TARGET_SIGRTMAX - X] to
      [__SIGRTMIN + X ... SIGRTMAX ]
(SIGRTMIN is __SIGRTMIN + X).

Signed-off-by: Laurent Vivier <address@hidden>
Reviewed-by: Taylor Simson <address@hidden>
Tested-by: Taylor Simpson <address@hidden>
Reviewed-by: Peter Maydell <address@hidden>
Message-Id: <address@hidden>


  Commit: 6d485a55d0cd8fbb8b4337b298f79ddb0c2a5511
      
https://github.com/qemu/qemu/commit/6d485a55d0cd8fbb8b4337b298f79ddb0c2a5511
  Author: Laurent Vivier <address@hidden>
  Date:   2020-02-12 (Wed, 12 Feb 2020)

  Changed paths:
    M linux-user/syscall.c

  Log Message:
  -----------
  linux-user: implement TARGET_SO_PEERSEC

"The purpose of this option is to allow an application to obtain the
security credentials of a Unix stream socket peer.  It is analogous to
SO_PEERCRED (which provides authentication using standard Unix credentials
of pid, uid and gid), and extends this concept to other security
models." -- https://lwn.net/Articles/62370/

Until now it was passed to the kernel with an "int" argument and
fails when it was supported by the host because the parameter is
like a filename: it is always a \0-terminated string with no embedded
\0 characters, but is not guaranteed to be ASCII or UTF-8.

I've tested the option with the following program:

    /*
     * cc -o getpeercon getpeercon.c
     */

    #include <stdio.h>
    #include <sys/types.h>
    #include <sys/socket.h>
    #include <netinet/in.h>
    #include <arpa/inet.h>

    int main(void)
    {
        int fd;
        struct sockaddr_in server, addr;
        int ret;
        socklen_t len;
        char buf[256];

        fd = socket(PF_INET, SOCK_STREAM, 0);
        if (fd == -1) {
            perror("socket");
            return 1;
        }

        server.sin_family = AF_INET;
        inet_aton("127.0.0.1", &server.sin_addr);
        server.sin_port = htons(40390);

        connect(fd, (struct sockaddr*)&server, sizeof(server));

        len = sizeof(buf);
        ret = getsockopt(fd, SOL_SOCKET, SO_PEERSEC, buf, &len);
        if (ret == -1) {
            perror("getsockopt");
            return 1;
        }
        printf("%d %s\n", len, buf);
        return 0;
    }

On host:

  $ ./getpeercon
  33 system_u:object_r:unlabeled_t:s0

With qemu-aarch64/bionic without the patch:

  $ ./getpeercon
  getsockopt: Numerical result out of range

With the patch:

  $ ./getpeercon
  33 system_u:object_r:unlabeled_t:s0

Bug: https://bugs.launchpad.net/qemu/+bug/1823790
Reported-by: Matthias Lüscher <address@hidden>
Tested-by: Matthias Lüscher <address@hidden>
Signed-off-by: Laurent Vivier <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
Tested-by: Philippe Mathieu-Daudé <address@hidden>
Message-Id: <address@hidden>


  Commit: 71cd1bccf3bfc4a77434595c3e987daa4e8ff574
      
https://github.com/qemu/qemu/commit/71cd1bccf3bfc4a77434595c3e987daa4e8ff574
  Author: Peter Maydell <address@hidden>
  Date:   2020-02-14 (Fri, 14 Feb 2020)

  Changed paths:
    M linux-user/hppa/target_signal.h
    M linux-user/signal.c
    M linux-user/syscall.c
    M linux-user/trace-events

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

Implement TARGET_SO_PEERSEC
Fix rt signals management

# gpg: Signature made Thu 13 Feb 2020 12:20:50 GMT
# gpg:                using RSA key CD2F75DDC8E3A4DC2E4F5173F30C38BD3F2FBE3C
# gpg:                issuer "address@hidden"
# gpg: Good signature from "Laurent Vivier <address@hidden>" [full]
# gpg:                 aka "Laurent Vivier <address@hidden>" [full]
# gpg:                 aka "Laurent Vivier (Red Hat) <address@hidden>" [full]
# Primary key fingerprint: CD2F 75DD C8E3 A4DC 2E4F  5173 F30C 38BD 3F2F BE3C

* remotes/vivier2/tags/linux-user-for-5.0-pull-request:
  linux-user: implement TARGET_SO_PEERSEC
  linux-user: fix use of SIGRTMIN
  linux-user: fix TARGET_NSIG and _NSIG uses
  linux-user: cleanup signal.c
  linux-user: add missing TARGET_SIGRTMIN for hppa

Signed-off-by: Peter Maydell <address@hidden>

# Conflicts:
#       linux-user/signal.c


Compare: https://github.com/qemu/qemu/compare/bc882694a3c7...71cd1bccf3bf



reply via email to

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