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 158A921976; Fri, 19 Sep 2025 17:50:41 +0000 (UTC) Received: by atuin.qyliss.net (Postfix, from userid 993) id 4783A219D2; Fri, 19 Sep 2025 17:50:38 +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-b4-smtp.messagingengine.com (fout-b4-smtp.messagingengine.com [202.12.124.147]) by atuin.qyliss.net (Postfix) with ESMTPS id 7681D219CE for ; Fri, 19 Sep 2025 17:50:36 +0000 (UTC) Received: from phl-compute-02.internal (phl-compute-02.internal [10.202.2.42]) by mailfout.stl.internal (Postfix) with ESMTP id 54C541D0010E; Fri, 19 Sep 2025 13:50:34 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-02.internal (MEProxy); Fri, 19 Sep 2025 13:50:34 -0400 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=1758304234; x=1758390634; bh=eilGS8LRIG dpk0qhbr3F+8y2AvGCU+oBdIrP4s5/Uxc=; b=ga3JHH1dIvfz3wBei4BLySnwf+ 9ZE1kRCVxxwSCyE1k3kbViYugNWn7Frhk3p3Z12yf7QWkThuAnHfSh3WgZmx2cZH /3fvAjJ73qypYJS4KCECkXeOpvLU2NFhDVVOeIOR7r02RS1BYOSUWjn47/cCp8aB Mai03kAqd3CcKwICdcOrw5DEFInl/yOdnL9zoryCz2XKNS5QXOYS+8+hwse23d4G u9qEgTScucRNxOhTlRPtcCFnzoU100OAYDwLDWdHbmWetL+p2cRzHIohfZj7k8Nn YNavtr25OVCPtvylnUymrhx26aTLPtSvDh6a9AZPo1G1Ec+ymwtiFCta+cFg== 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= 1758304234; x=1758390634; bh=eilGS8LRIGdpk0qhbr3F+8y2AvGCU+oBdIr P4s5/Uxc=; b=W45HZlMErOBXKEIQOX3t4qoSDcXvDDCQHA6IztrAq3E1D8DlzYo vP2Bt7XIlDKTqjphMDJPh93e/0sUqZwGG/kgDDq8JYvY7kb6ZPMZ4hEFXwrGbx5o wn1SETff3mV/GS7LLjv9ys/x2y706gKaVvOF9bKZdyQF76qdHA1paSkFNxfh5Rp5 P1ab7KhPZKnZagB8Z3C1o1/p0RaFRT/l3mfS6nniDHRJ8fcHLs6Om16JekFiavQE eofSkHfL1zMAjy4quVYj2P66fYbaHa021bLWcbhbEkFw3a6nMKjV1ijWSAZ0Oq/3 anPe1FxlQSRkjX8cExKVPGR5Sundl35iU4A== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdeggdegleekhecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpuffrtefokffrpgfnqfghnecuuegr ihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjug hrpefhvfevufgjfhffkfggtgesghdtreertddtjeenucfhrhhomheptehlhihsshgrucft ohhsshcuoehhihesrghlhihsshgrrdhisheqnecuggftrfgrthhtvghrnhepteehvedugf ejgfehhfeijeduleekleejgedvkeeuuefhhfegvdevfeetveegteeinecuvehluhhsthgv rhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhephhhisegrlhihshhsrgdrih hspdhnsggprhgtphhtthhopedvpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopegu vghmihhosggvnhhouhhrsehgmhgrihhlrdgtohhmpdhrtghpthhtohepuggvvhgvlhessh hpvggtthhruhhmqdhoshdrohhrgh X-ME-Proxy: Feedback-ID: i12284293:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 19 Sep 2025 13:50:33 -0400 (EDT) Received: by mbp.qyliss.net (Postfix, from userid 1000) id 846091FD4F7C; Fri, 19 Sep 2025 19:50:32 +0200 (CEST) From: Alyssa Ross To: Demi Marie Obenour Subject: Re: [PATCH 07/20] scripts/make-erofs.sh: Standardize file modes in images In-Reply-To: <20250904-systemd-v1-7-2a63b790a913@gmail.com> References: <20250904-systemd-v1-0-2a63b790a913@gmail.com> <20250904-systemd-v1-7-2a63b790a913@gmail.com> Date: Fri, 19 Sep 2025 19:50:31 +0200 Message-ID: <87348is55k.fsf@alyssa.is> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" Message-ID-Hash: WJ6LA2R3YRB4WY5XAO227QHXDL2MHG6O X-Message-ID-Hash: WJ6LA2R3YRB4WY5XAO227QHXDL2MHG6O 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: Spectrum OS Development 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; charset=utf-8 Content-Transfer-Encoding: quoted-printable Demi Marie Obenour writes: > Enforce that anything under /var or /etc is 0755 for directories and > executable files and 0644 for anything else. Enforce that anything else > is 0555 for directories and executable files and 0444 for anything else. > This avoids depending on factors that may depend on the build > environment, such as the user's umask. > > This requires that /var always exist, so add it to img/app/Makefile. > > Signed-off-by: Demi Marie Obenour > --- > host/rootfs/Makefile | 3 ++- > img/app/Makefile | 2 +- > scripts/make-erofs.sh | 21 +++++++++++++++++++++ > 3 files changed, 24 insertions(+), 2 deletions(-) > > diff --git a/host/rootfs/Makefile b/host/rootfs/Makefile > index f677fe580f2e2be58113457e63468d97f49a49f6..dce78e60bc1a8c18f5f448aaa= 9aeed2c8a7da04e 100644 > --- a/host/rootfs/Makefile > +++ b/host/rootfs/Makefile > @@ -97,7 +97,8 @@ DIRS =3D \ > ext \ > run \ > proc \ > - sys > + sys \ > + var >=20=20 > FIFOS =3D etc/s6-linux-init/run-image/service/s6-svscan-log/fifo >=20=20 > diff --git a/img/app/Makefile b/img/app/Makefile > index 9665a6b7158f2d8b183831202a4559ae06d53d16..c6b9a23ce8796582d6e2f5121= c30c2269975aa2d 100644 > --- a/img/app/Makefile > +++ b/img/app/Makefile > @@ -57,7 +57,7 @@ VM_FILES =3D \ > etc/wireplumber/wireplumber.conf.d/99_spectrum.conf \ > etc/xdg/xdg-desktop-portal/portals.conf >=20=20 > -VM_DIRS =3D dev run proc sys tmp \ > +VM_DIRS =3D dev run proc sys tmp var \ > etc/s6-linux-init/run-image/service \ > etc/s6-linux-init/run-image/user \ > etc/s6-linux-init/run-image/wait > diff --git a/scripts/make-erofs.sh b/scripts/make-erofs.sh > index 66abd1f388524c19cd3a1113415892d0d72e3f82..d566a4ac7b30f55338fe9b8b6= a94702686f6ddd1 100755 > --- a/scripts/make-erofs.sh > +++ b/scripts/make-erofs.sh > @@ -95,4 +95,25 @@ while read -r arg1; do > cp -RT -- "$arg1" "$root/$arg2" > done >=20=20 > +# Ensure that the permissions in the image are independent > +# of those in the git repository or Nix store, except for > +# the executable bit. In particular, the mode of those > +# outside the Nix store might depend on the user's umask. > +# While the image itself is strictly read-only, it makes > +# sense to populate an overlayfs over /etc and /var, and > +# this overlayfs should be writable by root and readable > +# by all users. The remaining paths should not be writable > +# by anyone, but should be world-readable. > +find "$root" \ > + -path "$root/nix/store" -prune -o \ > + -path "$root/etc" -prune -o \ > + -path "$root/var" -prune -o \ > + -type l -o \ > + -type d -a -perm 0555 -o \ > + -type f -a -perm 0444 -o \ > + -execdir chmod ugo-w,ugo+rX -- '{}' + > +find "$root/etc" "$root/var" ! -type l -execdir chmod u+w,go-w,ugo+rX --= '{}' + > +chmod 0755 "$root" > + > +# Make the erofs image. > mkfs.erofs -x-1 -b4096 --all-root "$@" "$root" The idea here is reproducibility, right? Can the body mention that? And can we limit it to just doing r-Xr-Xr-X for now, and then worry about the overlayfs stuff later if we need to? (This also means we don't have to add /var until we need it.) I'd also like to stick to POSIX features for standard utilities where possible, which it should be here. (I know cp -T isn't POSIX. =F0=9F=A4=AB) --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEARYKAB0WIQRV/neXydHjZma5XLJbRZGEIw/wogUCaM2X5wAKCRBbRZGEIw/w oqmrAQDUpUANQaPD11iSGJUplrFZSCKREZDEOruOUlBfseVKRAEAhMfUFHzRH4Yx te/sGEt/c06oHUGUdFa71pmZbUem+AI= =uKwk -----END PGP SIGNATURE----- --=-=-=--