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 49CC525827; Thu, 11 Dec 2025 19:04:57 +0000 (UTC) Received: by atuin.qyliss.net (Postfix, from userid 993) id A0BC6257A4; Thu, 11 Dec 2025 19:04:53 +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.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DMARC_MISSING,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS autolearn=unavailable autolearn_force=no version=4.0.1 Received: from fout-a8-smtp.messagingengine.com (fout-a8-smtp.messagingengine.com [103.168.172.151]) by atuin.qyliss.net (Postfix) with ESMTPS id C8FC9257A1 for ; Thu, 11 Dec 2025 19:04:51 +0000 (UTC) Received: from phl-compute-01.internal (phl-compute-01.internal [10.202.2.41]) by mailfout.phl.internal (Postfix) with ESMTP id 386FAEC0603; Thu, 11 Dec 2025 14:04:48 -0500 (EST) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-01.internal (MEProxy); Thu, 11 Dec 2025 14:04:48 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alyssa.is; h=cc :cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm3; t=1765479888; x=1765566288; bh=V/8uZBDrHZ 5TWqG9I86ITyAoqSlr84GSocg65jKE5CI=; b=M405ruDJAMgI8YzzzXJwQQdDzT b+rcWBWy0jNgEK0Kk2JFEc+cYxiEyxpcGIzJB4Anwbh34/QrH/GflR22RBK+QFdq 5TayFuup3EC/MD/fgkhoLNxT0vQT/lpKpjNIW365vP40kF4lHkrY8vXeFxp+A667 0/zFaq4yjGXjuSGjxUaGilaZSO/Hk2FLLF8PrMZPdJW/I+jZW7W4oEkFEJteUfXm WdZohbDcfQ4MfpGEL98/1BejM15wXTdjuGHlzhorp0ylhoAkSlhQJkqTE6tbEgv+ i+oWzfYzPpIYbW5WLA0k1r96aZsoA26Yg9xDCH7RdaV5ZhszEHmceaOGp1RA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t= 1765479888; x=1765566288; bh=V/8uZBDrHZ5TWqG9I86ITyAoqSlr84GSocg 65jKE5CI=; b=ZoKbVT4lJhGMhsNOgrwLIGgqqADMU5IM3UeSPS8KQ+99srLL1ux 4Ix44W7Mtww21cX18oRl2D4qc5/NZGKMgYe4fcz0Z8d3PJZEFT5D9oMt9yPz/vxk pfIeLys60JpTiLfuaTtJkStvHHwjBcYP2bAxkCrHC6+yUnaRFK3jAO8gSR0ggyQa Qs7I5JymBGFl9IIhd9t1CixF0PgWKufQFCvO50wUq686Z3akJsZnFOIVSvZhLqfs 5sHvOjcKWvOqdr4xV3FQmaaPY+cfJmg00emj5+GeVNtaSQe7Q9AYxO6XW4uRFGVd TV7UKSKDg9jmoBiHmotGOonrs0fk+REstXQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddviedutdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpuffrtefokffrpgfnqfghnecuuegr ihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjug hrpefhvfevufgjfhffkfggtgesghdtreertddttdenucfhrhhomheptehlhihsshgrucft ohhsshcuoehhihesrghlhihsshgrrdhisheqnecuggftrfgrthhtvghrnhepieduffeuie elgfetgfdttddtkeekheekgfehkedufeevteegfeeiffetvdetueevnecuvehluhhsthgv rhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhephhhisegrlhihshhsrgdrih hspdhnsggprhgtphhtthhopeefpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopeih uhhrvghkrgestgihsggvrhgthhgrohhsrdguvghvpdhrtghpthhtohepuggvmhhiohgsvg hnohhurhesghhmrghilhdrtghomhdprhgtphhtthhopeguvghvvghlsehsphgvtghtrhhu mhdqohhsrdhorhhg X-ME-Proxy: Feedback-ID: i12284293:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 11 Dec 2025 14:04:47 -0500 (EST) Received: by fw12.qyliss.net (Postfix, from userid 1000) id 9551E6F76C4E; Thu, 11 Dec 2025 20:04:35 +0100 (CET) From: Alyssa Ross To: Demi Marie Obenour , devel@spectrum-os.org Subject: Re: [PATCH] Set restrictive mount options In-Reply-To: <67073f8a-f9c4-4f30-ab23-9309e6d6f585@gmail.com> References: <20251211124806.31226-1-hi@alyssa.is> <67073f8a-f9c4-4f30-ab23-9309e6d6f585@gmail.com> Date: Thu, 11 Dec 2025 20:04:33 +0100 Message-ID: <87fr9gsuv2.fsf@alyssa.is> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" Message-ID-Hash: OSERR62FPTMOQTRT52VDWERVT3GMNZLN X-Message-ID-Hash: OSERR62FPTMOQTRT52VDWERVT3GMNZLN X-MailFrom: hi@alyssa.is 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: Yureka Lilian 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: --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Demi Marie Obenour writes: > On 12/11/25 07:48, Alyssa Ross wrote: >> These are mostly copied from systemd, so should be pretty safe in >> terms of compatibility. >>=20 >> Signed-off-by: Alyssa Ross >> --- >> host/initramfs/etc/fstab | 8 ++++---- >> host/initramfs/etc/init | 2 +- >> host/rootfs/image/etc/fstab | 12 ++++++------ >> img/app/image/etc/fstab | 12 ++++++------ >> img/app/image/etc/mdev/virtiofs | 2 +- >> img/app/image/etc/s6-rc/app/run | 4 ++-- >> img/app/scripts/start-virtiofsd.elb | 2 +- >> vm/app/systemd-sysupdate/download-update | 2 +- >> vm/sys/net/image/etc/fstab | 12 ++++++------ >> 9 files changed, 28 insertions(+), 28 deletions(-) >>=20 >> diff --git a/host/initramfs/etc/fstab b/host/initramfs/etc/fstab >> index 3dfb05ab..9f43a1a9 100644 >> --- a/host/initramfs/etc/fstab >> +++ b/host/initramfs/etc/fstab >> @@ -1,5 +1,5 @@ >> # SPDX-License-Identifier: CC0-1.0 >> -# SPDX-FileCopyrightText: 2021 Alyssa Ross >> -devtmpfs /dev devtmpfs defaults 0 0 >> -proc /proc proc defaults 0 0 >> -sysfs /sys sysfs defaults 0 0 >> +# SPDX-FileCopyrightText: 2021-2025 Alyssa Ross >> +devtmpfs /dev devtmpfs nosuid 0 0 > > Should this also be noexec? I don't think anything has any business > executing something out of devtmpfs. > >> +proc /proc proc nosuid,nodev,noexec 0 0 >> +sysfs /sys sysfs nosuid,nodev,noexec 0 0 >> diff --git a/host/initramfs/etc/init b/host/initramfs/etc/init >> index 71948874..723d2e1b 100755 >> --- a/host/initramfs/etc/init >> +++ b/host/initramfs/etc/init >> @@ -42,7 +42,7 @@ if { >>=20=20 >> background { rm /dev/rootfs /dev/verity } >>=20=20 >> -if { mount /dev/mapper/root-verity /mnt/root } >> +if { mount -o nosuid,nodev /dev/mapper/root-verity /mnt/root } >> wait { $mdevd_pid } >>=20=20 >> if { mount --move /proc /mnt/root/proc } >> diff --git a/host/rootfs/image/etc/fstab b/host/rootfs/image/etc/fstab >> index 6230d910..5c23a374 100644 >> --- a/host/rootfs/image/etc/fstab >> +++ b/host/rootfs/image/etc/fstab >> @@ -1,7 +1,7 @@ >> # SPDX-License-Identifier: CC0-1.0 >> -# SPDX-FileCopyrightText: 2020-2021 Alyssa Ross >> -proc /proc proc defaults 0 0 >> -devpts /dev/pts devpts gid=3D5,mode=3D620 0 0 >> -tmpfs /dev/shm tmpfs defaults 0 0 >> -sysfs /sys sysfs defaults 0 0 >> -tmpfs /tmp tmpfs defaults 0 0 >> +# SPDX-FileCopyrightText: 2020-2021, 2025 Alyssa Ross >> +proc /proc proc nosuid,nodev,noexec 0 0 >> +devpts /dev/pts devpts nosuid,noexec,gid=3D5,mode=3D620 0 0 >> +tmpfs /dev/shm tmpfs nosuid,nodev 0 0 >> +sysfs /sys sysfs nosuid,nodev,noexec 0 0 >> +tmpfs /tmp tmpfs nosuid,nodev 0 0 > > Should this be noexec as well? > >> diff --git a/img/app/image/etc/fstab b/img/app/image/etc/fstab >> index 2dd1f4d8..5f78ab87 100644 >> --- a/img/app/image/etc/fstab >> +++ b/img/app/image/etc/fstab >> @@ -1,8 +1,8 @@ >> # SPDX-License-Identifier: CC0-1.0 >> # SPDX-FileCopyrightText: 2020-2022, 2025 Alyssa Ross >> -proc /proc proc defaults 0 0 >> -devpts /dev/pts devpts gid=3D5,mode=3D620 0 0 >> -tmpfs /dev/shm tmpfs defaults 0 0 >> -sysfs /sys sysfs defaults 0 0 >> -tmpfs /tmp tmpfs defaults 0 0 >> -tmpfs /home/user tmpfs mode=3D0700,uid=3D1000,gid=3D1000 0 0 >> +proc /proc proc nosuid,nodev,noexec 0 0 >> +devpts /dev/pts devpts nosuid,noexec,gid=3D5,mode=3D620 0 0 >> +tmpfs /dev/shm tmpfs nosuid,nodev 0 0 >> +sysfs /sys sysfs nosuid,nodev,noexec 0 0 >> +tmpfs /tmp tmpfs nosuid,nodev 0 0 >> +tmpfs /home/user tmpfs nodev,mode=3D0700,uid=3D1000,gid=3D1000 0 0 >> diff --git a/img/app/image/etc/mdev/virtiofs b/img/app/image/etc/mdev/vi= rtiofs >> index c1fd2834..b6e505bc 100755 >> --- a/img/app/image/etc/mdev/virtiofs >> +++ b/img/app/image/etc/mdev/virtiofs >> @@ -7,6 +7,6 @@ background { >> # virtiofs filesystems, so we only supported a single, hardcoded >> # filesystem tag for now. >> if { mkdir -p /run/virtiofs/virtiofs0 } >> - if { mount -t virtiofs virtiofs0 /run/virtiofs/virtiofs0 } >> + if { mount -t virtiofs -o nodev virtiofs0 /run/virtiofs/virtiofs0 } >> /etc/mdev/listen virtiofs0 >> } >> diff --git a/img/app/image/etc/s6-rc/app/run b/img/app/image/etc/s6-rc/a= pp/run >> index 0ba1f374..997897de 100755 >> --- a/img/app/image/etc/s6-rc/app/run >> +++ b/img/app/image/etc/s6-rc/app/run >> @@ -17,7 +17,7 @@ foreground { >> if { modprobe loop } >> if { >> backtick -E offset { /run/virtiofs/virtiofs0/config/run --appim= age-offset } >> - mount -o offset=3D${offset} /run/virtiofs/virtiofs0/config/run = /mnt >> + mount -o offset=3D${offset},nodev /run/virtiofs/virtiofs0/confi= g/run /mnt >> } >> s6-setuidgid user >> export APPIMAGE /run/virtiofs/virtiofs0/config/run >> @@ -42,7 +42,7 @@ foreground { >> nix { >> if { >> mount -t overlay >> - -o ro,lowerdir=3D/nix/store:/run/virtiofs/virtiofs0/config/nix/store >> + -o ro,nosuid,nodev,lowerdir=3D/nix/store:/run/virtiofs/virtiofs0/con= fig/nix/store >> store /nix/store >> } >>=20=20 >> diff --git a/img/app/scripts/start-virtiofsd.elb b/img/app/scripts/start= -virtiofsd.elb >> index e4d265f0..cedce9ae 100755 >> --- a/img/app/scripts/start-virtiofsd.elb >> +++ b/img/app/scripts/start-virtiofsd.elb >> @@ -6,7 +6,7 @@ s6-ipcserver-socketbinder -B build/virtiofsd.sock >> background { >> if { mkdir -p build/fs } >> unshare -rUm >> - if { mount -t tmpfs fs build/fs } >> + if { mount -t tmpfs -o nosuid,nodev fs build/fs } >> if { mkdir build/fs/config } >> if { importas -Si CONFIG mount --rbind -- ${CONFIG}/fs build/fs/confi= g } >> importas -SsD virtiofsd VIRTIOFSD >> diff --git a/vm/app/systemd-sysupdate/download-update b/vm/app/systemd-s= ysupdate/download-update >> index facf7f52..b397f238 100755 >> --- a/vm/app/systemd-sysupdate/download-update >> +++ b/vm/app/systemd-sysupdate/download-update >> @@ -5,7 +5,7 @@ >> export LC_ALL C >> export LANGUAGE C >> unshare -mr >> -if { mount -toverlay -olowerdir=3D/run/virtiofs/virtiofs0/etc:/etc -- o= verlay /etc } >> +if { mount -toverlay -o nosuid,nodev,lowerdir=3D/run/virtiofs/virtiofs0= /etc:/etc -- overlay /etc } > > Feel free to add noexec and nosymfollow to this. Unless I am very > much mistaken, the updater should be fine with both. > >> backtick tmpdir { mktemp -d /tmp/sysupdate-XXXXXX } >> # Not a useless use of cat: if there are NUL bytes in the URL >> # busybox's awk might misbehave. >> diff --git a/vm/sys/net/image/etc/fstab b/vm/sys/net/image/etc/fstab >> index a0b62fa5..4c240544 100644 >> --- a/vm/sys/net/image/etc/fstab >> +++ b/vm/sys/net/image/etc/fstab >> @@ -1,8 +1,8 @@ >> # SPDX-License-Identifier: CC0-1.0 >> -# SPDX-FileCopyrightText: 2020-2021 Alyssa Ross >> +# SPDX-FileCopyrightText: 2020-2021, 2025 Alyssa Ross >> # SPDX-FileCopyrightText: 2025 Yureka Lilian >> -proc /proc proc defaults 0 0 >> -devpts /dev/pts devpts gid=3D5,mode=3D620 0 0 >> -tmpfs /dev/shm tmpfs defaults 0 0 >> -sysfs /sys sysfs defaults 0 0 >> -bpffs /sys/fs/bpf bpf defaults 0 0 >> +proc /proc proc nosuid,nodev,noexec 0 0 >> +devpts /dev/pts devpts nosuid,noexec,gid=3D5,mode=3D620 0 0 >> +tmpfs /dev/shm tmpfs nosuid,nodev 0 0 >> +sysfs /sys sysfs nosuid,nodev,noexec 0 0 >> +bpffs /sys/fs/bpf bpf nosuid,nodev,noexec,mode=3D700 0 0 >>=20 >> base-commit: e32cdde75ef9ec554c1c40bba7f4a75dcaaa779f > > There might be additional improvements that can be made, but > those can come later, so: > > Acked-by: Demi Marie Obenour > > with or without the suggested changes. Alright, I'll test and commit this with the updater changes, and follow up separately on the others. --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEARYKAB0WIQQGoGac7QfI+H5ZtFCZddwkt31pFQUCaTsVwQAKCRCZddwkt31p FVGTAP9y6b2nyKDAT9BoXvPpgMBp2Xi8jHtTYY/mf3NVTw50YgD+JP0Gqb7yYLxh RNmOD5l+A2DKhJImyZbSYcetfJpDtQ8= =iB0V -----END PGP SIGNATURE----- --=-=-=--