Some strace cleanups

Minor fixes for setsockopt() and netlink
 Manage 'F' flag with qemu-binfmt-conf.sh
 -----BEGIN PGP SIGNATURE-----
 
 iQIcBAABAgAGBQJbO6WMAAoJEPMMOL0/L748NiQP/3q1pF1SUJBq0lyjS3EeG77V
 8Mt5gWcFvAZsg4/oKY1ORMv26CsRQw1PHT4K+Q0JkKqk9nZxy6HXjqr/q+oB1DOI
 athg3CS4eZ9/oDBb4GYBwVP62qgTyH7B/pWGb+HqpZUIkC58IWtetVzjKZQVc7ys
 iuidY84dF5gfKZpcKxRem3V+g8LC5lMNw7+4/0iy9XO876td4RCYgcsxLZa1r9iy
 rKt1Swiqol5nHj0WYk3+oEDgKFBsUxWGTZxbNRWO2BcJKYcIaaGGzyizSju//YHy
 KPqS1CEPRUsyMhl12Ejh+fd9gK2Kjb86fHZrw68WoWqSy7pkfC15NbA+mZak3/fp
 08andBpi+Ej24nj1pIFU03/dBkNVP/EbKhkPuinb3wUeFGk3hJaoyw6Reu0lQWsc
 HEIyqF2NgBb41PVTE2DCTl0lsdEv2HdQoQeJWTaoHPzpvLKnV8GEUpaVJCKBcXTC
 oGaU2CdbpcFAr7/mz94R5VccLAvgLR+j3Njdl5tcmMe+reLRgVJkXqrkjRgrP+1t
 ue9zrB38u28wvCp2vrY7W6X3ca9y2R2sv5Kf9KDGDNnshp4XA/BoI8QEA9D7GMap
 V4aVTf1EdADh++/qBzkwxUxCykXS53uF7D/ddsPWzwLtKivSb7K1Y0DML/dPlcjO
 ruS4n5zokoArchgkiNfq
 =ddQH
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/vivier2/tags/linux-user-for-3.0-pull-request' into staging

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

# gpg: Signature made Tue 03 Jul 2018 17:34:20 BST
# gpg:                using RSA key F30C38BD3F2FBE3C
# gpg: Good signature from "Laurent Vivier <lvivier@redhat.com>"
# gpg:                 aka "Laurent Vivier <laurent@vivier.eu>"
# gpg:                 aka "Laurent Vivier (Red Hat) <lvivier@redhat.com>"
# Primary key fingerprint: CD2F 75DD C8E3 A4DC 2E4F  5173 F30C 38BD 3F2F BE3C

* remotes/vivier2/tags/linux-user-for-3.0-pull-request:
  linux-user/strace: Improve recvmsg() output
  linux-user/strace: Improve capget()/capset() output
  linux-user: update do_setsockopt()
  linux-user: add netlink CARRIER_UP_COUNT/CARRIER_DOWN_COUNT
  qemu-binfmt-conf.sh: allow to provide a suffix to the interpreter name
  qemu-binfmt-conf.sh: add persistent (F) flags
  qemu-binfmt-conf.sh: cleanup --credential

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2018-07-04 22:38:10 +01:00
commit fe8d2d5737
3 changed files with 48 additions and 26 deletions

View file

@ -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 },
@ -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 },

View file

@ -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;
@ -3017,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:

View file

@ -165,21 +165,26 @@ usage() {
cat <<EOF
Usage: qemu-binfmt-conf.sh [--qemu-path PATH][--debian][--systemd CPU]
[--help][--credential yes|no][--exportdir PATH]
[--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
--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 :
@ -245,7 +250,15 @@ qemu_check_systemd() {
}
qemu_generate_register() {
echo ":qemu-$cpu:M::$magic:$mask:$qemu:$FLAGS"
flags=""
if [ "$CREDENTIAL" = "yes" ] ; then
flags="OC"
fi
if [ "$PERSISTENT" = "yes" ] ; then
flags="${flags}F"
fi
echo ":qemu-$cpu:M::$magic:$mask:$qemu:$flags"
}
qemu_register_interpreter() {
@ -264,10 +277,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() {
@ -291,6 +302,7 @@ qemu_set_binfmts() {
qemu="$QEMU_PATH/qemu-i386"
fi
qemu="$qemu$QEMU_SUFFIX"
if [ "$host_family" != "$family" ] ; then
$BINFMT_SET
fi
@ -304,9 +316,11 @@ SYSTEMDDIR="/etc/binfmt.d"
DEBIANDIR="/usr/share/binfmts"
QEMU_PATH=/usr/local/bin
FLAGS=""
CREDENTIAL=no
PERSISTENT=no
QEMU_SUFFIX=""
options=$(getopt -o ds:Q:e:hc: -l debian,systemd:,qemu-path:,exportdir:,help,credential: -- "$@")
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
@ -342,6 +356,10 @@ while true ; do
shift
QEMU_PATH="$1"
;;
-F|--qemu-suffix)
shift
QEMU_SUFFIX="$1"
;;
-e|--exportdir)
shift
EXPORTDIR="$1"
@ -352,11 +370,11 @@ while true ; do
;;
-c|--credential)
shift
if [ "$1" = "yes" ] ; then
FLAGS="OC"
else
FLAGS=""
fi
CREDENTIAL="$1"
;;
-p|--persistent)
shift
PERSISTENT="$1"
;;
*)
break