Skip to contentSkip to conversation

Linux user for 3.0 patches

GIT PULL Applied Laurent Vivier 3 participants 10 messages Jul 3, 2018 – Jul 5, 2018 exec and binfmt

lore
Share & tools
lore
#0 lore raw

The following changes since commit ab08440a4ee09032d1a9cb22fdcab23bc7e1c656:

Merge remote-tracking branch 'remotes/rth/tags/pull-tcg-20180702' into staging (2018-07-02 17:57:46 +0100)

are available in the Git repository at:

git://github.com/vivier/qemu.git tags/linux-user-for-3.0-pull-request

for you to fetch changes up to 377e93e9e85e76c7fd7af900ba965743243a6618:

linux-user/strace: Improve recvmsg() output (2018-07-03 16:27:15 +0200)

----------------------------------------------------------------
Some strace cleanups
Minor fixes for setsockopt() and netlink
Manage 'F' flag with qemu-binfmt-conf.sh

----------------------------------------------------------------

Laurent Vivier (5):
qemu-binfmt-conf.sh: cleanup --credential qemu-binfmt-conf.sh: add persistent (F) flags qemu-binfmt-conf.sh: allow to provide a suffix to the interpreter name
linux-user: add netlink CARRIER_UP_COUNT/CARRIER_DOWN_COUNT
linux-user: update do_setsockopt()

Philippe Mathieu-Daudé (2):
linux-user/strace: Improve capget()/capset() output linux-user/strace: Improve recvmsg() output

 linux-user/strace.list      |  6 ++--
 linux-user/syscall.c        |  4 +++
 scripts/qemu-binfmt-conf.sh | 64 ++++++++++++++++++++++++-------------
 3 files changed, 48 insertions(+), 26 deletions(-)
Signature · 1 line
2.17.1
#1 lore raw

[Qemu-devel] [PULL 4/7] linux-user: add netlink CARRIER_UP_COUNT/CARRIER_DOWN_COUNT

Error is reported with libuv test suite:

not ok 311 - udp_multicast_interface6

 # exit code 134
 # Output from process `udp_multicast_interface6`:
 # Unknown host QEMU_IFLA type: 47
 # Unknown host QEMU_IFLA type: 48
 # Unknown host QEMU_IFLA type: 47
 # Unknown host QEMU_IFLA type: 48
 # Unknown host QEMU_IFLA type: 47
 # Unknown host QEMU_IFLA type: 48
 # Unknown host QEMU_IFLA type: 47
 # Unknown host QEMU_IFLA type: 48
 # Unknown host QEMU_IFLA type: 47
 # Unknown host QEMU_IFLA type: 48

Message-Id: <[email protected]>

---
 linux-user/syscall.c | 2 ++
 1 file changed, 2 insertions(+)
linux-user/syscall.c +2 -0
index 2117fb13b4..4460f1e39a 100644
@@ -2522,6 +2522,8 @@ static abi_long host_to_target_data_link_rtattr(struct rtattr *rtattr)
     case QEMU_IFLA_NUM_VF:
     case QEMU_IFLA_GSO_MAX_SEGS:
     case QEMU_IFLA_GSO_MAX_SIZE:
+    case QEMU_IFLA_CARRIER_UP_COUNT:
+    case QEMU_IFLA_CARRIER_DOWN_COUNT:
         u32 = RTA_DATA(rtattr);
         *u32 = tswap32(*u32);
         break;
Signature · 1 line
2.17.1
#2 lore raw

[Qemu-devel] [PULL 5/7] linux-user: update do_setsockopt()

In reply to Laurent Vivier

add IPV6_MULTICAST_HOPS and IPV6_MULTICAST_LOOP that need 32bit value conversion

Message-Id: <[email protected]>

---
 linux-user/syscall.c | 2 ++
 1 file changed, 2 insertions(+)
linux-user/syscall.c +2 -0
index 4460f1e39a..50e20fb659 100644
@@ -3019,6 +3019,8 @@ static abi_long do_setsockopt(int sockfd, int level, int optname,
         case IPV6_V6ONLY:
         case IPV6_RECVPKTINFO:
         case IPV6_UNICAST_HOPS:
+        case IPV6_MULTICAST_HOPS:
+        case IPV6_MULTICAST_LOOP:
         case IPV6_RECVERR:
         case IPV6_RECVHOPLIMIT:
         case IPV6_2292HOPLIMIT:
Signature · 1 line
2.17.1
#3 lore raw

[Qemu-devel] [PULL 2/7] qemu-binfmt-conf.sh: add persistent (F) flags

In reply to Laurent Vivier

Since kernel commit 948b701a607f
(binfmt_misc: add persistent opened binary handler for containers) kernel allows to load the interpreter at the configuration time.

In case of chroot, it allows to have the interpreter in the host root filesystem and not to copy it to the chroot filesystem.

Message-Id: <[email protected]>

---
 scripts/qemu-binfmt-conf.sh | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
scripts/qemu-binfmt-conf.sh +13 -1
index 9900554608..00c9c3aa16 100755
@@ -161,6 +161,7 @@ usage() {
     cat <<EOF
 Usage: qemu-binfmt-conf.sh [--qemu-path PATH][--debian][--systemd CPU]
                            [--help][--credential yes|no][--exportdir PATH]
+                           [--persistent yes|no]
 
        Configure binfmt_misc to use qemu interpreter
 
@@ -176,6 +177,9 @@ Usage: qemu-binfmt-conf.sh [--qemu-path PATH][--debian][--systemd CPU]
                      (default: $SYSTEMDDIR or $DEBIANDIR)
        --credential: if yes, credential and security tokens are
                      calculated according to the binary to interpret
+       --persistent: if yes, the interpreter is loaded when binfmt is
+                     configured and remains in memory. All future uses
+                     are cloned from the open file.
 
     To import templates with update-binfmts, use :
 
@@ -245,6 +249,9 @@ qemu_generate_register() {
     if [ "$CREDENTIAL" = "yes" ] ; then
         flags="OC"
     fi
+    if [ "$PERSISTENT" = "yes" ] ; then
+        flags="${flags}F"
+    fi
 
     echo ":qemu-$cpu:M::$magic:$mask:$qemu:$flags"
 }
@@ -304,8 +311,9 @@ DEBIANDIR="/usr/share/binfmts"
 
 QEMU_PATH=/usr/local/bin
 CREDENTIAL=no
+PERSISTENT=no
 
-options=$(getopt -o ds:Q:e:hc: -l debian,systemd:,qemu-path:,exportdir:,help,credential: -- "$@")
+options=$(getopt -o ds:Q:e:hc:p: -l debian,systemd:,qemu-path:,exportdir:,help,credential:,persistent: -- "$@")
 eval set -- "$options"
 
 while true ; do
@@ -353,6 +361,10 @@ while true ; do
         shift
         CREDENTIAL="$1"
         ;;
+    -p|--persistent)
+        shift
+        PERSISTENT="$1"
+        ;;
     *)
         break
         ;;
Signature · 1 line
2.17.1
#4 lore raw

[Qemu-devel] [PULL 6/7] linux-user/strace: Improve capget()/capset() output

In reply to Laurent Vivier

From: Philippe Mathieu-Daudé <[email protected]>

Message-Id: <[email protected]>

---
 linux-user/strace.list | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
linux-user/strace.list +2 -2
index 2bc5ba04d4..afe4db07f3 100644
@@ -59,10 +59,10 @@
 { TARGET_NR_cacheflush, "cacheflush" , NULL, NULL, NULL },
 #endif
 #ifdef TARGET_NR_capget
-{ TARGET_NR_capget, "capget" , NULL, NULL, NULL },
+{ TARGET_NR_capget, "capget" , "%s(%p,%p)", NULL, NULL },
 #endif
 #ifdef TARGET_NR_capset
-{ TARGET_NR_capset, "capset" , NULL, NULL, NULL },
+{ TARGET_NR_capset, "capset" , "%s(%p,%p)", NULL, NULL },
 #endif
 #ifdef TARGET_NR_chdir
 { TARGET_NR_chdir, "chdir" , NULL, print_chdir, NULL },
Signature · 1 line
2.17.1
#5 lore raw

[Qemu-devel] [PULL 7/7] linux-user/strace: Improve recvmsg() output

In reply to Laurent Vivier

From: Philippe Mathieu-Daudé <[email protected]>

Message-Id: <[email protected]>

---
 linux-user/strace.list | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
linux-user/strace.list +1 -1
index afe4db07f3..ff8bb19f5f 100644
@@ -1107,7 +1107,7 @@
 { TARGET_NR_recvmmsg, "recvmmsg" , NULL, NULL, NULL },
 #endif
 #ifdef TARGET_NR_recvmsg
-{ TARGET_NR_recvmsg, "recvmsg" , NULL, NULL, NULL },
+{ TARGET_NR_recvmsg, "recvmsg" , "%s(%d,%p,%#x)", NULL, NULL },
 #endif
 #ifdef TARGET_NR_remap_file_pages
 { TARGET_NR_remap_file_pages, "remap_file_pages" , NULL, NULL, NULL },
Signature · 1 line
2.17.1
#6 lore raw

[Qemu-devel] [PULL 1/7] qemu-binfmt-conf.sh: cleanup --credential

In reply to Laurent Vivier

move credential value to its own variable to be able to manage more flags

Message-Id: <[email protected]>

---
 scripts/qemu-binfmt-conf.sh | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)
scripts/qemu-binfmt-conf.sh +9 -10
index d7eefda0b8..9900554608 100755
@@ -241,7 +241,12 @@ qemu_check_systemd() {
 }
 
 qemu_generate_register() {
-    echo ":qemu-$cpu:M::$magic:$mask:$qemu:$FLAGS"
+    flags=""
+    if [ "$CREDENTIAL" = "yes" ] ; then
+        flags="OC"
+    fi
+
+    echo ":qemu-$cpu:M::$magic:$mask:$qemu:$flags"
 }
 
 qemu_register_interpreter() {
@@ -260,10 +265,8 @@ package qemu-$cpu
 interpreter $qemu
 magic $magic
 mask $mask
+credential $CREDENTIAL
 EOF
-    if [ "$FLAGS" = "OC" ] ; then
-        echo "credentials yes" >> "$EXPORTDIR/qemu-$cpu"
-    fi
 }
 
 qemu_set_binfmts() {
@@ -300,7 +303,7 @@ SYSTEMDDIR="/etc/binfmt.d"
 DEBIANDIR="/usr/share/binfmts"
 
 QEMU_PATH=/usr/local/bin
-FLAGS=""
+CREDENTIAL=no
 
 options=$(getopt -o ds:Q:e:hc: -l debian,systemd:,qemu-path:,exportdir:,help,credential: -- "$@")
 eval set -- "$options"
@@ -348,11 +351,7 @@ while true ; do
         ;;
     -c|--credential)
         shift
-        if [ "$1" = "yes" ] ; then
-            FLAGS="OC"
-        else
-            FLAGS=""
-        fi
+        CREDENTIAL="$1"
         ;;
     *)
         break
Signature · 1 line
2.17.1
#7 lore raw

[Qemu-devel] [PULL 3/7] qemu-binfmt-conf.sh: allow to provide a suffix to the interpreter name

In reply to Laurent Vivier

some distros provide a qemu-CPU-static binary beside the qemu-CPU one. This change allows to use it by providing "--qemu-suffix -static" to the script.

Message-Id: <[email protected]>

---
 scripts/qemu-binfmt-conf.sh | 41 ++++++++++++++++++++++---------------
 1 file changed, 24 insertions(+), 17 deletions(-)
scripts/qemu-binfmt-conf.sh +24 -17
index 00c9c3aa16..23df00ae30 100755
@@ -161,25 +161,26 @@ usage() {
     cat <<EOF
 Usage: qemu-binfmt-conf.sh [--qemu-path PATH][--debian][--systemd CPU]
                            [--help][--credential yes|no][--exportdir PATH]
-                           [--persistent yes|no]
+                           [--persistent yes|no][--qemu-suffix SUFFIX]
 
        Configure binfmt_misc to use qemu interpreter
 
-       --help:       display this usage
-       --qemu-path:  set path to qemu interpreter ($QEMU_PATH)
-       --debian:     don't write into /proc,
-                     instead generate update-binfmts templates
-       --systemd:    don't write into /proc,
-                     instead generate file for systemd-binfmt.service
-                     for the given CPU. If CPU is "ALL", generate a
-                     file for all known cpus
-       --exportdir:  define where to write configuration files
-                     (default: $SYSTEMDDIR or $DEBIANDIR)
-       --credential: if yes, credential and security tokens are
-                     calculated according to the binary to interpret
-       --persistent: if yes, the interpreter is loaded when binfmt is
-                     configured and remains in memory. All future uses
-                     are cloned from the open file.
+       --help:        display this usage
+       --qemu-path:   set path to qemu interpreter ($QEMU_PATH)
+       --qemu-suffix: add a suffix to the default interpreter name
+       --debian:      don't write into /proc,
+                      instead generate update-binfmts templates
+       --systemd:     don't write into /proc,
+                      instead generate file for systemd-binfmt.service
+                      for the given CPU. If CPU is "ALL", generate a
+                      file for all known cpus
+       --exportdir:   define where to write configuration files
+                      (default: $SYSTEMDDIR or $DEBIANDIR)
+       --credential:  if yes, credential and security tokens are
+                      calculated according to the binary to interpret
+       --persistent:  if yes, the interpreter is loaded when binfmt is
+                      configured and remains in memory. All future uses
+                      are cloned from the open file.
 
     To import templates with update-binfmts, use :
 
@@ -297,6 +298,7 @@ qemu_set_binfmts() {
             qemu="$QEMU_PATH/qemu-i386"
         fi
 
+        qemu="$qemu$QEMU_SUFFIX"
         if [ "$host_family" != "$family" ] ; then
             $BINFMT_SET
         fi
@@ -312,8 +314,9 @@ DEBIANDIR="/usr/share/binfmts"
 QEMU_PATH=/usr/local/bin
 CREDENTIAL=no
 PERSISTENT=no
+QEMU_SUFFIX=""
 
-options=$(getopt -o ds:Q:e:hc:p: -l debian,systemd:,qemu-path:,exportdir:,help,credential:,persistent: -- "$@")
+options=$(getopt -o ds:Q:S:e:hc:p: -l debian,systemd:,qemu-path:,qemu-suffix:,exportdir:,help,credential:,persistent: -- "$@")
 eval set -- "$options"
 
 while true ; do
@@ -349,6 +352,10 @@ while true ; do
         shift
         QEMU_PATH="$1"
         ;;
+    -F|--qemu-suffix)
+        shift
+        QEMU_SUFFIX="$1"
+        ;;
     -e|--exportdir)
         shift
         EXPORTDIR="$1"
Signature · 1 line
2.17.1
#8 lore raw
In reply to Laurent Vivier
This series seems to have some coding style problems. See output below for more information:

Hi,

This series seems to have some coding style problems. See output below for more information:

Type: series
Message-id: [email protected]
Subject: [Qemu-devel] [PULL 0/7] Linux user for 3.0 patches

=== TEST SCRIPT BEGIN ===
#!/bin/bash

BASE=base
n=1
total=$(git log --oneline $BASE.. | wc -l)
failed=0

git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram

commits="$(git log --format=%H --reverse $BASE..)" for c in $commits; do

    echo "Checking PATCH $n/$total: $(git log -n 1 --format=%s $c)..."
    if ! git show $c --format=email | ./scripts/checkpatch.pl --mailback -; then
        failed=1
        echo
    fi
    n=$((n+1))

done

exit $failed
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
Switched to a new branch 'test'
b5c1e944b9 linux-user/strace: Improve recvmsg() output
b9c50502fd linux-user/strace: Improve capget()/capset() output 17c4fd8620 linux-user: update do_setsockopt()
f90cf93e26 linux-user: add netlink CARRIER_UP_COUNT/CARRIER_DOWN_COUNT 06f47f9723 qemu-binfmt-conf.sh: allow to provide a suffix to the interpreter name 55dacf9bb6 qemu-binfmt-conf.sh: add persistent (F) flags
1e59cd7ad3 qemu-binfmt-conf.sh: cleanup --credential

=== OUTPUT BEGIN ===
Checking PATCH 1/7: qemu-binfmt-conf.sh: cleanup --credential...
Checking PATCH 2/7: qemu-binfmt-conf.sh: add persistent (F) flags...
ERROR: line over 90 characters
#56: FILE: scripts/qemu-binfmt-conf.sh:320:
+options=$(getopt -o ds:Q:e:hc:p: -l debian,systemd:,qemu-path:,exportdir:,help,credential:,persistent: -- "$@")

total: 1 errors, 0 warnings, 45 lines checked

Your patch has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.

Checking PATCH 3/7: qemu-binfmt-conf.sh: allow to provide a suffix to the interpreter name...
ERROR: line over 90 characters
#77: FILE: scripts/qemu-binfmt-conf.sh:323:
+options=$(getopt -o ds:Q:S:e:hc:p: -l debian,systemd:,qemu-path:,qemu-suffix:,exportdir:,help,credential:,persistent: -- "$@")

total: 1 errors, 0 warnings, 69 lines checked

Your patch has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.

Checking PATCH 4/7: linux-user: add netlink CARRIER_UP_COUNT/CARRIER_DOWN_COUNT... Checking PATCH 5/7: linux-user: update do_setsockopt()...
Checking PATCH 6/7: linux-user/strace: Improve capget()/capset() output... Checking PATCH 7/7: linux-user/strace: Improve recvmsg() output... === OUTPUT END ===

Test command exited with code: 1

---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to [email protected]

#9 lore raw
In reply to Laurent Vivier
Quoted 10 lines · Laurent Vivier

The following changes since commit ab08440a4ee09032d1a9cb22fdcab23bc7e1c656:

Merge remote-tracking branch 'remotes/rth/tags/pull-tcg-20180702' into staging (2018-07-02 17:57:46 +0100)

are available in the Git repository at:

git://github.com/vivier/qemu.git tags/linux-user-for-3.0-pull-request

for you to fetch changes up to 377e93e9e85e76c7fd7af900ba965743243a6618:

Quoted 8 lines

linux-user/strace: Improve recvmsg() output (2018-07-03 16:27:15 +0200)

----------------------------------------------------------------
Some strace cleanups
Minor fixes for setsockopt() and netlink
Manage 'F' flag with qemu-binfmt-conf.sh

----------------------------------------------------------------

Applied, thanks.

-- PMM