Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1392498pxb; Mon, 11 Oct 2021 05:10:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzSIcGl7qU0VNjGvoO8d4adQuWEczWlRAd+Pp1ucHq7yVe7Nv28FVYjkHM8LRNBS361z6Y/ X-Received: by 2002:a50:9e84:: with SMTP id a4mr14798739edf.391.1633954250274; Mon, 11 Oct 2021 05:10:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633954250; cv=none; d=google.com; s=arc-20160816; b=i98QaSKKu+RczObuEUXKcnb15ckzR7Ft76/qrvnyO5VJxDoMQULzrLo+VBPYuZ2IL0 XjTlklV+MVpejvAEL2aAWLN5tUhU1AXM4BZedrC06y3CzmGmIBQ25adqenM+UpL2EhO2 PbvhoAfnjBA6qp64ufKNfQR1LOasti3mjDsv7Waov0zBFNn68aDln8h6LZ6zs/nLVkiv e4DDo4ptbemJwTGuxdSnR6RKxzJHffgthahowIWSpsR7uFayN2cby/AB1PLR0WYmlEIn MguiIAtAwg/Fa6zsDkVcqZn3iXhko9ZEwU793ua5fptQtp3ROi6Gy7EalZ/ZZ6QILxh8 ImRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=VbGbPafJjSshKlXMyLUSFwVM9yvXHJs9CU+WkVoQBjk=; b=KI17+zLWGG84lUAIYiComWVRw+ANU1lCo0GVe8yJrthJbgNsdkgggdcgBYzZB9iN2j OQruEzeDbURprdVQrUPkk/Zr0VD6i6+updT33cerfo90rfKNLXX4HZ3cjA9vTRrJStdd J6kgpHl2XUIJF2lV5IZC4REF76sn1Qxx3UaLbW2zXFWzXaut39eY97R6IKiFEs65tB7g vkajsSGRBfcV61yxYKNndTdA+0tJG1I27RZsepYT+0xLN4b4z7aOUIXVD7xDz+U8sBCs 17CTQ2fZ4gsPjbS5Pwyxqqwea0MM01aT0/hI8SDh95sCINfsieaUyr7oY0vICPntW6A3 3wsw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 8si12688688ejv.769.2021.10.11.05.10.26; Mon, 11 Oct 2021 05:10:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235029AbhJKI2N (ORCPT + 99 others); Mon, 11 Oct 2021 04:28:13 -0400 Received: from smtp-190f.mail.infomaniak.ch ([185.125.25.15]:60353 "EHLO smtp-190f.mail.infomaniak.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235032AbhJKI2L (ORCPT ); Mon, 11 Oct 2021 04:28:11 -0400 Received: from smtp-3-0000.mail.infomaniak.ch (unknown [10.4.36.107]) by smtp-2-3000.mail.infomaniak.ch (Postfix) with ESMTPS id 4HSX1t5y8BzMqJTT; Mon, 11 Oct 2021 10:26:10 +0200 (CEST) Received: from ns3096276.ip-94-23-54.eu (unknown [23.97.221.149]) by smtp-3-0000.mail.infomaniak.ch (Postfix) with ESMTPA id 4HSX1q3sgfzlhNx5; Mon, 11 Oct 2021 10:26:07 +0200 (CEST) Subject: Re: [PATCH v14 1/3] fs: Add trusted_for(2) syscall implementation and related sysctl To: Florian Weimer Cc: Al Viro , Andrew Morton , Aleksa Sarai , Andy Lutomirski , Arnd Bergmann , Casey Schaufler , Christian Brauner , Christian Heimes , Deven Bowers , Dmitry Vyukov , Eric Biggers , Eric Chiang , Geert Uytterhoeven , James Morris , Jan Kara , Jann Horn , Jonathan Corbet , Kees Cook , Lakshmi Ramasubramanian , "Madhavan T . Venkataraman" , Matthew Garrett , Matthew Wilcox , Miklos Szeredi , Mimi Zohar , Paul Moore , =?UTF-8?Q?Philippe_Tr=c3=a9buchet?= , Scott Shell , Shuah Khan , Steve Dower , Steve Grubb , Thibaut Sautereau , Vincent Strubel , 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, =?UTF-8?Q?Micka=c3=abl_Sala=c3=bcn?= References: <20211008104840.1733385-1-mic@digikod.net> <20211008104840.1733385-2-mic@digikod.net> <87tuhpynr4.fsf@mid.deneb.enyo.de> From: =?UTF-8?Q?Micka=c3=abl_Sala=c3=bcn?= Message-ID: <334a71c1-b97e-e52e-e772-a9003ec676c3@digikod.net> Date: Mon, 11 Oct 2021 10:26:58 +0200 User-Agent: MIME-Version: 1.0 In-Reply-To: <87tuhpynr4.fsf@mid.deneb.enyo.de> Content-Type: text/plain; charset=iso-8859-15 Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/10/2021 16:10, Florian Weimer wrote: > * Micka?l Sala?n: > >> Being able to restrict execution also enables to protect the kernel by >> restricting arbitrary syscalls that an attacker could perform with a >> crafted binary or certain script languages. It also improves multilevel >> isolation by reducing the ability of an attacker to use side channels >> with specific code. These restrictions can natively be enforced for ELF >> binaries (with the noexec mount option) but require this kernel >> extension to properly handle scripts (e.g. Python, Perl). To get a >> consistent execution policy, additional memory restrictions should also >> be enforced (e.g. thanks to SELinux). > > One example I have come across recently is that code which can be > safely loaded as a Perl module is definitely not a no-op as a shell > script: it downloads code and executes it, apparently over an > untrusted network connection and without signature checking. > > Maybe in the IMA world, the expectation is that such ambiguous code > would not be signed in the first place, but general-purpose > distributions are heading in a different direction with > across-the-board signing: > > Signed RPM Contents > > > So I wonder if we need additional context information for a potential > LSM to identify the intended use case. > This is an interesting use case. I think such policy enforcement could be done either with an existing LSM (e.g. IMA) or a new one (e.g. IPE), but it could also partially be enforced by the script interpreter. The kernel should have enough context: interpreter process (which could be dedicated to a specific usage) and the opened script file, or we could add a new usage flag to the trusted_for syscall if that makes sense. Either way, this doesn't seem to be an issue for the current patch series.