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 40B5919932; Mon, 08 Sep 2025 08:47:12 +0000 (UTC) Received: by atuin.qyliss.net (Postfix, from userid 993) id E008C19928; Mon, 08 Sep 2025 08:47:09 +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-b5-smtp.messagingengine.com (fout-b5-smtp.messagingengine.com [202.12.124.148]) by atuin.qyliss.net (Postfix) with ESMTPS id 4382919927 for ; Mon, 08 Sep 2025 08:47:09 +0000 (UTC) Received: from phl-compute-04.internal (phl-compute-04.internal [10.202.2.44]) by mailfout.stl.internal (Postfix) with ESMTP id 30D211D000F4; Mon, 8 Sep 2025 04:47:08 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-04.internal (MEProxy); Mon, 08 Sep 2025 04:47:08 -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=1757321228; x=1757407628; bh=inpWlh0LJp 8jpfsyH54x8h01W+0Z3+HgSD+ZzgMXxnk=; b=kb8UotIdlDoiKMBBgcuOb93Cwb oilmlVYoSCxlfdd1S4cORHMJNRYWVsroPOHocB5hrvviqVpWlMYLR4jkEPyGtOlJ HJI7A7xkExgFtra53sIzqdYlE01qe48xxjyNXMAy3TzMsE5qxHC+69IdecOUQUkh kwBCYS7h6/EIpz2bbuozRAkg/OwJ6OoghrLBg7rIBhcSAF0WUoNtK7GOUWK0rg+a 12YCPLq7zM5HJ38B/Ke+8u5030ytQWBjOV60CKQqzFkLyhl6/QQwJR91c6SgQGuA +PhjVdP3lwrUVXMpc23UC8YcKj8uYEGG/qk9PGWK7iJExQG3ApNa6Bt1q5mQ== 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= 1757321228; x=1757407628; bh=inpWlh0LJp8jpfsyH54x8h01W+0Z3+HgSD+ ZzgMXxnk=; b=lEJymNGa7qzhDb1vD60nEBBHlFjtowmCux+xeAJOOd1xn+ZWS1H NksnxkTrUsXUsk81AoyuMDJfg9A/FU0CzB+jFSEkOiT6s/lwXhYEXTthBvgRvsT3 dZkVLqGnq9MdoDtnWgc9Q7Y4M0PfTJPXcjtYKFGaQCs9WzmeqpuwzR0g1z6XW7Q5 CuDLAMF0PZw0C4l9kupzKatTsyaHUVkZavS/lHBB6w2rAiCyPmFRJ96Qcg0gVgx7 yGQdnckXbg04Kjx+ZPMkHPEjPp7AmJLO4pbYTOLJ3DTCi3LURPHUrzkvJtzFkkLB KhbB7+g83nX4k03og8TGAcus4eHeapwjlXw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdeggddujedtkecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpuffrtefokffrpgfnqfghnecuuegr ihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjug hrpefhvfevufgjfhffkfggtgesghdtreertddttdenucfhrhhomheptehlhihsshgrucft ohhsshcuoehhihesrghlhihsshgrrdhisheqnecuggftrfgrthhtvghrnhepieduffeuie elgfetgfdttddtkeekheekgfehkedufeevteegfeeiffetvdetueevnecuvehluhhsthgv rhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhephhhisegrlhihshhsrgdrih hspdhnsggprhgtphhtthhopedvpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopegu vghmihhosggvnhhouhhrsehgmhgrihhlrdgtohhmpdhrtghpthhtohepuggvvhgvlhessh hpvggtthhruhhmqdhoshdrohhrgh X-ME-Proxy: Feedback-ID: i12284293:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 8 Sep 2025 04:47:07 -0400 (EDT) Received: by mbp.qyliss.net (Postfix, from userid 1000) id C489D1674A75; Mon, 08 Sep 2025 10:47:03 +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: Mon, 08 Sep 2025 10:46:58 +0200 Message-ID: <87segxjpq5.fsf@alyssa.is> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" Message-ID-Hash: WCFOENQP4QKLSAQUY7KYJ75XXMQWX46O X-Message-ID-Hash: WCFOENQP4QKLSAQUY7KYJ75XXMQWX46O 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 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. > 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. So I get why, given the overlayfs idea, it's important for /etc and /var to not be user-writeable, but what I don't understand is: why aren't we checking permissions for other directories, like /bin or /lib? > +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" > > --=20 > 2.51.0 --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEARYKAB0WIQRV/neXydHjZma5XLJbRZGEIw/wogUCaL6YAgAKCRBbRZGEIw/w osgdAP0UnhGtJt7PSJ4f6v+nBOq/iRoHG41tWdqa3CW/lk1r0wEA5cif0xv0Ts6K 0n/f7NA9/tQ4vUL7KAFu0ts9eB+djwo= =Wh3b -----END PGP SIGNATURE----- --=-=-=--