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 C226C27E0B; Tue, 29 Jul 2025 00:33:30 +0000 (UTC) Received: by atuin.qyliss.net (Postfix, from userid 993) id E79CC27DA0; Tue, 29 Jul 2025 00:33:28 +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-qt1-x836.google.com (mail-qt1-x836.google.com [IPv6:2607:f8b0:4864:20::836]) by atuin.qyliss.net (Postfix) with ESMTPS id 7F97827D9E for ; Tue, 29 Jul 2025 00:33:28 +0000 (UTC) Received: by mail-qt1-x836.google.com with SMTP id d75a77b69052e-4ab8e2c85d7so65889721cf.2 for ; Mon, 28 Jul 2025 17:33:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1753749207; x=1754354007; darn=spectrum-os.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=erJdTVVFI531ffsGbXumfF7WKHOMr7QmEnNaW/FD/L4=; b=m+SOhz31RnI4+1N8AAesA7ciYsh2NfB65QyxDKLJTJYAT1tU1vY4QGxKQ+7O0nB+SB 7sf60G6E1nk/cUcPpp3xd7LhNhYZV3tkEVLUUz/S+BOWDQMnLfYraIRFUsbSEL0+RoNd H/UKoLm6kOqLFvsYEgCpuRzPXZcsIKt23CrDRDkrPSq90O8OxGmdRzy35cbsFDzfaFlj uGfQYpFZnM1XJGGiGoyU4rRToiMhOJcbPCW22zKKU+GX5X+8eoQX4tXzPGrMQtjjl+UE SNpxKGNwVlPn9CaDgoLotIaRZJphRw1vFTsYumZiShT+KsxT6pg824PNMBRlV/fu9AHT 6+rQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1753749207; x=1754354007; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=erJdTVVFI531ffsGbXumfF7WKHOMr7QmEnNaW/FD/L4=; b=ZNMBrrIW9lty09n0pvyvmKzb6LCIq22MyxyrLpxC84GM5EDnbodJRdod+N2unSoHXY nzJY4P9Gn+L3sqr/CSkxl2q5V5qOW+3cOIo99RQzsaJFKMXAv5O9LS1+WfSU24yI/dsA KJrmzczc8d/ddPwMFJFQTFzo0xj9N0oEXBPbj+2l047xzuBC57GmeFcKvtfKsVXeSrr8 DsIv05MTSxa/cuLR/RGdfAbD5mhsgZ++Z7Ys6f5TcBIJLH5xfXQQx9/SzuFnc+XC7JBJ Oj1Ai/uRGyYNAYtVCR4SGMpK97euvIJqe46b1v6USHD48j9UU7HAjGZLPVRuxBaVOP4B zbGw== X-Gm-Message-State: AOJu0YwpHqQmZjaDVoC0KDnu7+H7AHQ7Qc5d7/2Q7ZUfzdYCNwwZlzQP 3+jBAnTHO3wW1dL02sY3HcKVDcQT8ZFij3mDfHxBViKG/YYw32EmFdY3bsSuEg== X-Gm-Gg: ASbGncuwXDJYHORsB7qZBE2Y7kyUn6M0FRR/mYVe6Mis/cF0dK/grwq+suDnwbDUdQc 3/rD5zw90udse7lG1MqrBcOZOsbfDX/zdYLYJBRowc2DQ7MJHf/RcY5Xv2CAsjjP24o+/zo6LD4 WuA9J+/Ob5UVCFFXp11zfRg0D1TsV9gpbHLL51P4Wk76pN1z0l962wZUv6TSCH1BQKRP0pioN81 b4UrObXmIGOLttUq61n90RJTgdZ8tfAFV6W9sH+MyN4dmEXKjRs7yuxUrvyrcOQYSD8S4fXD/I6 xLjCcDxacKOubIXPxKL06mmZCQQWZnO53WFrf0pi+AeZG7jbzA9a2S9JLfpPFf0VzKN/w5zsvGO kru1VGv0jbZ2CF1fnZbBdPk9Ox1M= X-Google-Smtp-Source: AGHT+IF0XAVWstzAAApQfRfU9Yih2kk8ol2RANbf9mDEMwEj698rAng4IzTjmi5saNWShd+YtPCOug== X-Received: by 2002:ac8:7f94:0:b0:4ab:825d:60d6 with SMTP id d75a77b69052e-4ae8ed76d22mr158916311cf.8.1753749207093; Mon, 28 Jul 2025 17:33:27 -0700 (PDT) Received: from very-personal ([89.187.178.201]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-4ae9966c433sm41746611cf.54.2025.07.28.17.33.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Jul 2025 17:33:26 -0700 (PDT) From: Demi Marie Obenour To: Spectrum OS Development Subject: [PATCH v9 1/2] img/app: Create needed directories in early boot Date: Mon, 28 Jul 2025 20:33:00 -0400 Message-ID: <06b54ea129fc57e52ba5edba0369a84e87d9d727.1753748336.git.demiobenour@gmail.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: References: <20250728231303.2416-1-demiobenour@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: BFECVI2FE65YVKTVTORZLZIHXITYXY6F X-Message-ID-Hash: BFECVI2FE65YVKTVTORZLZIHXITYXY6F 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 moves various calls to mkdir(1) to very early boot, before any services are running. This has two advantages: 1. These directories are guaranteed to exist. Code can just assume that they are there without checking for them. 2. Malicious code running as an unprivileged user cannot create directories under /tmp before legitimate code has done so. The following directories are created under /tmp: - /tmp/.font-unix (used by obsolete X Font Server) is created with mode 0000. - The directories used by X11 are created with 1700 permissions: - /tmp/.X11-unix (X server) - /tmp/.ICE-unix (Inter-Client Exchange) - /tmp/.XIM-unix (X Input Methods) - $XDG_RUNTIME_DIR (/run/user/0) is created with 0700 permissions, as expected by the XDG specification. The copyright notice for directory creation is not kept because making one directories with well-known names and permissions is not copyrightable and the code has been rewritten. Signed-off-by: Demi Marie Obenour --- Changes since v6: - Add missing S-o-b - Add comments explaining why each directory needs to be created. - Fix spelling errors in commit messages. Changes since v5: - Remove "directories" service in favor of creating the directories from rc.init. --- img/app/etc/s6-linux-init/scripts/rc.init | 13 +++++++++++++ img/app/etc/s6-rc/wayland-proxy-virtwl/run | 10 ---------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/img/app/etc/s6-linux-init/scripts/rc.init b/img/app/etc/s6-linux-init/scripts/rc.init index c5a59245ff3761e94acb974edde967806fb3b234..7744286d0282bb8e0cc40973c6a6eae4c9401630 100755 --- a/img/app/etc/s6-linux-init/scripts/rc.init +++ b/img/app/etc/s6-linux-init/scripts/rc.init @@ -1,10 +1,23 @@ #!/bin/execlineb -P # SPDX-License-Identifier: EUPL-1.2+ # SPDX-FileCopyrightText: 2020-2022 Alyssa Ross +# SPDX-FileCopyrightText: 2025 Demi Marie Obenour if { s6-rc-init -c /etc/s6-rc /run/service } if { modprobe overlay } if { mount -a --mkdir } +# X Font Server is obsolete +if { mkdir -m 0000 /tmp/.font-unix } + +# /tmp/.X11-unix: X11 server +# /tmp/.ICE-unix: X11 Inter-Client Exchange +# /tmp/.XIM-unix: X11 input methods +# Some documentation states sticky bit is required. +if { mkdir -m 1700 /tmp/.X11-unix /tmp/.ICE-unix /tmp/.XIM-unix } + +# /run/user/0: "$XDG_RUNTIME_DIR" +if { mkdir -m 0700 /run/user/0 } + s6-rc change ok-all diff --git a/img/app/etc/s6-rc/wayland-proxy-virtwl/run b/img/app/etc/s6-rc/wayland-proxy-virtwl/run index 0715d912953c8a1d326059dfd37c29799fcbb053..c1e0e088c789ab8c5fde7e50c9f4b856fff0e477 100755 --- a/img/app/etc/s6-rc/wayland-proxy-virtwl/run +++ b/img/app/etc/s6-rc/wayland-proxy-virtwl/run @@ -1,16 +1,6 @@ #!/bin/execlineb -P # SPDX-License-Identifier: EUPL-1.2+ # SPDX-FileCopyrightText: 2023-2024 Alyssa Ross -# -# Directory creation (if it's copyrightable): -# SPDX-License-Identifier: MIT -# SPDX-FileCopyrightText: 2022 Unikie - -foreground { mkdir /tmp/.X11-unix } -foreground { - umask 077 - mkdir /run/user/0 -} s6-ipcserver-socketbinder -B /run/user/0/wayland-0 fdmove -c 3 0 -- Sincerely, Demi Marie Obenour (she/her/hers)