From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 886BF393DC5 for ; Mon, 25 Aug 2025 09:39:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756114780; cv=none; b=En1I8OFBp4yVe/T/vvA6d9Sw6ZfrKIALvsnh0UAGI/cYEgvR6ag+8GXDthZ65ZULfEJOfg+6EX/cBzQmIa5gdoxWLIka1AGcvhoRY9/RCD4pRj05tQ29c69ccdvzdqg8juy2T43whND8JP+vrC0ZiQPIaAoUR7uMMZwHph4+2eo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756114780; c=relaxed/simple; bh=YGZk/doqSOcdaAjiIfjwSjHMKZj2laCWPqcCdAbOjKw=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=hE32a38I7RmcizXSWA3R5/JzjQbqR6IGTuLmLoQh33Vk+coa33R+/vHCL3c6Mok7osnG3bjylGkj6DOWLpRcCPbmby/dqIWrtIj04fVeFTVDSStUewqbJU6bnqY7WxGXdTnRJpuDHw/krosNocBvHjhEyOk7GPG2d5fAbFtGwMs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=SyHEvkqj; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="SyHEvkqj" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1756114777; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=SEwlDpD+C/EtRZv27QcaLtBUwUyBdktuJKWqODYJttI=; b=SyHEvkqjGLhMG40py8u7elNwao9AL+ngvqmEElUlAIWEyXE/RVLRpkvCY5U2z1Qp/goZZY 3fk+9sSbiBSDvHJ13LCVVxpNEVwVEZqZLI5WyM2jCNkLUirxWZrpG0+zP+bveYBI3VAe0A F/qkcxPJlKBSrPjsu5O1qICNo8b4MzU= Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-33-mnd5_XyLMPSzPB5s5xNMDA-1; Mon, 25 Aug 2025 05:39:31 -0400 X-MC-Unique: mnd5_XyLMPSzPB5s5xNMDA-1 X-Mimecast-MFC-AGG-ID: mnd5_XyLMPSzPB5s5xNMDA_1756114767 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 4B2091800342; Mon, 25 Aug 2025 09:39:26 +0000 (UTC) Received: from fweimer-oldenburg.csb.redhat.com (unknown [10.44.32.136]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id D31AF1955F24; Mon, 25 Aug 2025 09:39:14 +0000 (UTC) From: Florian Weimer To: =?utf-8?Q?Micka=C3=ABl_Sala=C3=BCn?= Cc: Andy Lutomirski , Jann Horn , Al Viro , Christian Brauner , Kees Cook , Paul Moore , Serge Hallyn , Andy Lutomirski , Arnd Bergmann , Christian Heimes , Dmitry Vyukov , Elliott Hughes , Fan Wu , Jeff Xu , Jonathan Corbet , Jordan R Abrahams , Lakshmi Ramasubramanian , Luca Boccassi , Matt Bobrowski , Miklos Szeredi , Mimi Zohar , Nicolas Bouchinet , Robert Waite , Roberto Sassu , Scott Shell , Steve Dower , Steve Grubb , kernel-hardening@lists.openwall.com, linux-api@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-integrity@vger.kernel.org, linux-kernel@vger.kernel.org, linux-security-module@vger.kernel.org, Jeff Xu Subject: Re: [RFC PATCH v1 1/2] fs: Add O_DENY_WRITE In-Reply-To: <20250825.mahNeel0dohz@digikod.net> (=?utf-8?Q?=22Micka=C3=AB?= =?utf-8?Q?l_Sala=C3=BCn=22's?= message of "Mon, 25 Aug 2025 11:31:42 +0200") References: <20250822170800.2116980-1-mic@digikod.net> <20250822170800.2116980-2-mic@digikod.net> <20250824.Ujoh8unahy5a@digikod.net> <20250825.mahNeel0dohz@digikod.net> Date: Mon, 25 Aug 2025 11:39:11 +0200 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Precedence: bulk X-Mailing-List: linux-api@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 * Micka=C3=ABl Sala=C3=BCn: > The order of checks would be: > 1. open script with O_DENY_WRITE > 2. check executability with AT_EXECVE_CHECK > 3. read the content and interpret it > > The deny-write feature was to guarantee that there is no race condition > between step 2 and 3. All these checks are supposed to be done by a > trusted interpreter (which is allowed to be executed). The > AT_EXECVE_CHECK call enables the caller to know if the kernel (and > associated security policies) allowed the *current* content of the file > to be executed. Whatever happen before or after that (wrt. > O_DENY_WRITE) should be covered by the security policy. Why isn't it an improper system configuration if the script file is writable? In the past, the argument was that making a file (writable and) executable was an auditable even, and that provided enough coverage for those people who are interested in this. Thanks, Florian