From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from atuin.qyliss.net (localhost [IPv6:::1]) by atuin.qyliss.net (Postfix) with ESMTP id 0B10B10A68; Wed, 03 Dec 2025 15:55:54 +0000 (UTC) Received: by atuin.qyliss.net (Postfix, from userid 993) id C0DB4109BB; Wed, 03 Dec 2025 15:55:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on atuin.qyliss.net X-Spam-Level: X-Spam-Status: No, score=-0.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DMARC_PASS,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=4.0.1 Received: from mail-yw1-x1130.google.com (mail-yw1-x1130.google.com [IPv6:2607:f8b0:4864:20::1130]) by atuin.qyliss.net (Postfix) with ESMTPS id B6E95109B9 for ; Wed, 03 Dec 2025 15:55:49 +0000 (UTC) Received: by mail-yw1-x1130.google.com with SMTP id 00721157ae682-786635a8ce4so50958787b3.2 for ; Wed, 03 Dec 2025 07:55:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1764777347; x=1765382147; darn=spectrum-os.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=pRNUkIapxd/ejNx/pehzdHSqys762Ftt9Y3+dOYZGl0=; b=M9AYKs+4aWllJ/3WXcU4oen1tEecs13ycTWUx94WPXggUKAgP+VKVAphEJUG9XxzE+ Kn/YiHh/27BHhT+xUBT4dJ2WcERnVDbLe3AzZMiByDQf8lRxcXxNbeDNlDKI0QrEnkYJ 6rmt1JYdje8tvoXeSZ4QeEqPWL0mfVc74aTcPtxIqN/pZcMp29EQrw/KYWMbnHOS3XAH Q5mNHZIL5/vswc5hkPaQOkgviMcpg6Vsw8B+WubXiGL/UZ3qj/ERwxclWF2EtWQSLhf0 90D57VCFsBDWHHgt4PUlAJaNeMUTf+GeImeaFzgJMwCjoLXiCV17VTel0mDsXNwGvFYu 3OEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764777347; x=1765382147; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=pRNUkIapxd/ejNx/pehzdHSqys762Ftt9Y3+dOYZGl0=; b=X/AYF5WAvjcUIBrNn/6A+KE704PHj8Q2Thv07bLYcsRzNy1C6fl/A6f5PcEFaiRRhj 2i8eKEITfG+qjbuHHZy7EDLhxHV/Xc3rCLKW5P8bGMSsxFJyxo7WnSQx/Ug7NclS7d/C /I+H3QcC6hRltOS5WZ1yLyAiOhHb5A9Jd5kPl3P621JKT7aPz5Nxxnjzene/3V1C7K0j 83ZA7DIGq9lvFkU2hu57H+CjGcTDD5E/Bod9Z9xgGfq39VGjAcKzyT9TFAxqtvjOUmfM J+JWaJe1nPnLXECXZ0w1FdcUn9SE0NVF/gxkZbtl9p0AoESsp+9KKrihh78awEHFYe6W v7GQ== X-Gm-Message-State: AOJu0YxRwrMSMhTE1BhzCVKN+wEFHrHdSDsXqdtyVIrgwa6HFC4ln9gI qETNkW5s906AsU0ryilzc3x7P5dz8COC2QzgtV6uXAkbrE8LZ2WDEqhs9fKiSA== X-Gm-Gg: ASbGnctsRr2WE+HUEyf2WwN5cEh1F4yPt7tyKwu5HqQe2y8NE2tObqcC+tCP0HmG4M9 rmge1KigCda835PhAkCsVTYLMTk1Gwkq4WYBs7v9EgIAOCMz6zToLLAD5chmwKBxGgylDEqJEVH wJVoa+pk8o1vMdK5wSW5glZGapsK0pfyxOC4t8sZXnFBBYPlV5K0tN1TY5aWmMgGr0UONIEiZ5p m0UOZT551aJPux8i50x6/bGv5CJlE2af4rNuJB43twZAqExH9evfK8J658pZCSq8OhnALXg7O9Z PckHm/mvQBYHbWjIex5kUho7I8fGjbMeiS81dgb9XPVU0tHJheSGqbH5tCuBygIFKJJxdB6G8e+ 5f/mQornbUV+bHfn6EY9LkVHOJxGn5gDkyTnrxtYc/O8XtzjPPIXNbNrhX94KIwxwteRmjkFnwb 2w7K3X+mb95vgA2RoB+cK+QVyRK5BKqKVqtKbftNuFeUom3sCcZ8vzuxlFXX1D1m5hMG1BjEcax LBOGSjTXSFnoAfYrwXOwrWCVtSoTDSKX88= X-Google-Smtp-Source: AGHT+IHnvXxhCbOps+/y5SPJLYVJ3EAc5qW6L6XuKBetk2noNqCFlYJXsXAIBEHIYufEjlydavDJsg== X-Received: by 2002:a05:690c:e3eb:b0:787:f341:6b06 with SMTP id 00721157ae682-78c0bf620c2mr25521727b3.24.1764777347006; Wed, 03 Dec 2025 07:55:47 -0800 (PST) Received: from localhost.localdomain (h96-60-249-169.cncrtn.broadband.dynamic.tds.net. [96.60.249.169]) by smtp.gmail.com with UTF8SMTPSA id 00721157ae682-78ad100e94fsm76035507b3.32.2025.12.03.07.55.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Dec 2025 07:55:46 -0800 (PST) From: Demi Marie Obenour Date: Wed, 03 Dec 2025 10:54:55 -0500 Subject: [PATCH v3 1/5] host/rootfs: Sandbox crosvm MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20251203-sandbox-v3-1-f16ae06a251e@gmail.com> References: <20251203-sandbox-v3-0-f16ae06a251e@gmail.com> In-Reply-To: <20251203-sandbox-v3-0-f16ae06a251e@gmail.com> To: Spectrum OS Development X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1764777294; l=3641; i=demiobenour@gmail.com; s=20250729; h=from:subject:message-id; bh=w6ihnU1WcHlRn9xTwR+rMHE08C9unQiEiAgsuVv7mk4=; b=bzL8v5XbMEpcH7ucjmHyQPcp/giFt+bUIDbW4h010xG0nvkNVx7R1ClxG4v5fsqZMmg1gjZFs oK/8KgGIKUHAoaIxoW1tbSO0GLIp676q430Qrulej3RCxk7dDYgQyas X-Developer-Key: i=demiobenour@gmail.com; a=ed25519; pk=X57Q4/YQDj9t4SBeKaDwvXYKB6quZJVx/DE2Ly2out0= Message-ID-Hash: 4A2WZW5N6CWJMJQDYB44ZHKDNCF7BVBS X-Message-ID-Hash: 4A2WZW5N6CWJMJQDYB44ZHKDNCF7BVBS X-MailFrom: demiobenour@gmail.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-devel.spectrum-os.org-0; header-match-devel.spectrum-os.org-1; header-match-devel.spectrum-os.org-2; header-match-devel.spectrum-os.org-3; header-match-devel.spectrum-os.org-4; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Demi Marie Obenour , Alyssa Ross X-Mailman-Version: 3.3.9 Precedence: list List-Id: Patches and low-level development discussion Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: This means that a breach of crosvm is not guaranteed to be fatal. The Wayland socket is still only accessible by root, so crosvm must run as root. The known container escape via /proc/self/exe is blocked by bwrap being on a read-only filesystem. Container escapes via /proc are blocked by remounting /proc read-only. Crosvm does not have CAP_SYS_ADMIN so it cannot change mounts. The two remaining steps are: - Run crosvm as an unprivileged user. - Enable seccomp to block most system calls. The latter should be done from within crosvm itself. Signed-off-by: Demi Marie Obenour --- host/rootfs/default.nix | 4 +-- .../template/data/service/vhost-user-gpu/run | 29 ++++++++++++++++++++++ 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/host/rootfs/default.nix b/host/rootfs/default.nix index ca2084f26d58be5e0e1695634e125032c50f82b2..4716bb7298515b2940cad09bb55e42c196ce7ebc 100644 --- a/host/rootfs/default.nix +++ b/host/rootfs/default.nix @@ -10,7 +10,7 @@ pkgsMusl.callPackage ( { spectrum-host-tools, spectrum-router , lib, stdenvNoCC, nixos, runCommand, writeClosure, erofs-utils, s6-rc -, btrfs-progs, busybox, cloud-hypervisor, cosmic-files, crosvm +, btrfs-progs, bubblewrap, busybox, cloud-hypervisor, cosmic-files, crosvm , cryptsetup, dejavu_fonts, dbus, execline, foot, fuse3, iproute2 , inotify-tools, jq, kmod, mdevd, mesa, mount-flatpak, s6 , s6-linux-init, socat, systemd, util-linuxMinimal, virtiofsd @@ -25,7 +25,7 @@ let trivial; packages = [ - btrfs-progs cloud-hypervisor cosmic-files crosvm cryptsetup dbus + btrfs-progs bubblewrap cloud-hypervisor cosmic-files crosvm cryptsetup dbus execline fuse3 inotify-tools iproute2 jq kmod mdevd mount-flatpak s6 s6-linux-init s6-rc socat spectrum-host-tools spectrum-router util-linuxMinimal virtiofsd xdg-desktop-portal-spectrum-host diff --git a/host/rootfs/image/etc/s6-linux-init/run-image/service/vm-services/template/data/service/vhost-user-gpu/run b/host/rootfs/image/etc/s6-linux-init/run-image/service/vm-services/template/data/service/vhost-user-gpu/run index 0b4f6a00bc7aed0e721454d584d3bcd47fb18e2a..19d5a61388e6f49c7f722814d6de47227b02da01 100755 --- a/host/rootfs/image/etc/s6-linux-init/run-image/service/vm-services/template/data/service/vhost-user-gpu/run +++ b/host/rootfs/image/etc/s6-linux-init/run-image/service/vm-services/template/data/service/vhost-user-gpu/run @@ -1,9 +1,38 @@ #!/bin/execlineb -P # SPDX-License-Identifier: EUPL-1.2+ # SPDX-FileCopyrightText: 2025 Alyssa Ross +# SPDX-FileCopyrightText: 2025 Demi Marie Obenour s6-ipcserver -1a 0700 -C 1 -b 1 env/crosvm.sock +bwrap + --unshare-all + # --unshare-all only implies --unshare-user-try. + # Make this more than a "try". + --unshare-user + --bind /run/user/0/wayland-1 /run/user/0/wayland-1 + --ro-bind /usr /usr + --ro-bind /lib /lib + --tmpfs /tmp + --dev /dev + --tmpfs /dev/shm + --ro-bind /nix /nix + --disable-userns + --proc /proc + --ro-bind /proc/sys /proc/sys + --tmpfs /proc/scsi + --remount-ro /proc/scsi + --tmpfs /proc/acpi + --remount-ro /proc/acpi + --tmpfs /proc/fs + --remount-ro /proc/fs + --tmpfs /proc/irq + --remount-ro /proc/irq + --ro-bind /dev/null /proc/timer_list + --ro-bind /dev/null /proc/kcore + --ro-bind /dev/null /proc/kallsyms + --ro-bind /dev/null /proc/sysrq-trigger + -- crosvm --no-syslog device gpu --fd 0 --wayland-sock /run/user/0/wayland-1 -- 2.52.0