qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Laurent Vivier <laurent@vivier.eu>
To: qemu-devel@nongnu.org
Cc: Laurent Vivier <laurent@vivier.eu>, Riku Voipio <riku.voipio@iki.fi>
Subject: [Qemu-devel] [PATCH 2/3] qemu-binfmt-conf.sh: add persistent (F) flags
Date: Wed, 27 Jun 2018 22:53:16 +0200	[thread overview]
Message-ID: <20180627205317.10343-3-laurent@vivier.eu> (raw)
In-Reply-To: <20180627205317.10343-1-laurent@vivier.eu>

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.

Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
 scripts/qemu-binfmt-conf.sh | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/scripts/qemu-binfmt-conf.sh b/scripts/qemu-binfmt-conf.sh
index 9900554608..00c9c3aa16 100755
--- a/scripts/qemu-binfmt-conf.sh
+++ b/scripts/qemu-binfmt-conf.sh
@@ -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
         ;;
-- 
2.14.4

  parent reply	other threads:[~2018-06-27 20:54 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-27 20:53 [Qemu-devel] [PATCH 0/3] linux-user: manage binfmt F flag Laurent Vivier
2018-06-27 20:53 ` [Qemu-devel] [PATCH 1/3] qemu-binfmt-conf.sh: cleanup --credential Laurent Vivier
2018-06-27 20:53 ` Laurent Vivier [this message]
2018-06-27 20:53 ` [Qemu-devel] [PATCH 3/3] qemu-binfmt-conf.sh: allow to provide a suffix to the interpreter name Laurent Vivier
2018-07-02  2:37 ` [Qemu-devel] [PATCH 0/3] linux-user: manage binfmt F flag no-reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180627205317.10343-3-laurent@vivier.eu \
    --to=laurent@vivier.eu \
    --cc=qemu-devel@nongnu.org \
    --cc=riku.voipio@iki.fi \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).