public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Anton Mikanovich <amikan@ilbers.de>
To: isar-users@googlegroups.com
Cc: Anton Mikanovich <amikan@ilbers.de>
Subject: [PATCH] meta: do not share dev mounts
Date: Fri, 10 Jun 2022 11:44:37 +0300	[thread overview]
Message-ID: <20220610084437.7490-1-amikan@ilbers.de> (raw)

As /dev was mounted into bootstrap/rootfs/buildchroot in shared mode
it made the first ended task unmount /dev/shm or /dev/pts for all other
tasks executed at the moment.
To prevent mounts corruption make /dev to be mounted as private.
This will protect mountpoints from all the propagations during the task
execution.

Signed-off-by: Anton Mikanovich <amikan@ilbers.de>
---
 meta/classes/buildchroot.bbclass                    | 2 +-
 meta/classes/rootfs.bbclass                         | 2 +-
 meta/recipes-core/isar-bootstrap/isar-bootstrap.inc | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/meta/classes/buildchroot.bbclass b/meta/classes/buildchroot.bbclass
index af391df..1148966 100644
--- a/meta/classes/buildchroot.bbclass
+++ b/meta/classes/buildchroot.bbclass
@@ -42,7 +42,7 @@ buildchroot_do_mounts() {
                 mount --bind '${CCACHE_DIR}' '${BUILDCHROOT_DIR}/ccache'
         fi
         mountpoint -q '${BUILDCHROOT_DIR}/dev' ||
-            ( mount --bind /dev '${BUILDCHROOT_DIR}/dev' &&
+            ( mount -o bind,private /dev '${BUILDCHROOT_DIR}/dev' &&
               mount -t tmpfs none '${BUILDCHROOT_DIR}/dev/shm' &&
               mount --bind /dev/pts '${BUILDCHROOT_DIR}/dev/pts' )
         mountpoint -q '${BUILDCHROOT_DIR}/proc' ||
diff --git a/meta/classes/rootfs.bbclass b/meta/classes/rootfs.bbclass
index 2f4ea00..bf8b6db 100644
--- a/meta/classes/rootfs.bbclass
+++ b/meta/classes/rootfs.bbclass
@@ -34,7 +34,7 @@ rootfs_do_mounts() {
     sudo -s <<'EOSUDO'
         set -e
         mountpoint -q '${ROOTFSDIR}/dev' || \
-            ( mount --bind /dev '${ROOTFSDIR}/dev' &&
+            ( mount -o bind,private /dev '${ROOTFSDIR}/dev' &&
               mount -t tmpfs none '${ROOTFSDIR}/dev/shm' &&
               mount --bind /dev/pts '${ROOTFSDIR}/dev/pts' )
         mountpoint -q '${ROOTFSDIR}/proc' || \
diff --git a/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc b/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
index 7b4def1..a453b36 100644
--- a/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
+++ b/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
@@ -369,7 +369,7 @@ do_bootstrap() {
         "${ROOTFSDIR}/chroot-setup.sh" "setup" "${ROOTFSDIR}"
 
         # update APT
-        mount --bind /dev ${ROOTFSDIR}/dev
+        mount -o bind,private /dev ${ROOTFSDIR}/dev
         mount --bind /dev/pts ${ROOTFSDIR}/dev/pts
         mount -t tmpfs none "${ROOTFSDIR}/dev/shm"
         mount -t proc none ${ROOTFSDIR}/proc
-- 
2.30.2


             reply	other threads:[~2022-06-10  8:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-10  8:44 Anton Mikanovich [this message]
2022-06-17 17:07 ` Anton Mikanovich

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=20220610084437.7490-1-amikan@ilbers.de \
    --to=amikan@ilbers.de \
    --cc=isar-users@googlegroups.com \
    /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