From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E2726C433EF for ; Tue, 30 Nov 2021 20:27:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244921AbhK3UbA (ORCPT ); Tue, 30 Nov 2021 15:31:00 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:38877 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229898AbhK3Uaz (ORCPT ); Tue, 30 Nov 2021 15:30:55 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1638304056; 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=AcMNv7Mr+B4p3hEjaHnnJQgfgj2Zfos0EhRVXhwbDc0=; b=EFeJ76h22hyTp3Z7a4mqfU5/CaSTOkeyqYhzreZ2wPeegqXyfduFt77TGfa7O/3EHIS0XI nzMI/+hDfGXwPbMlM492iM53pg1OaDGDeIaTdlr8kkSIBZ0MbSsEn3xmvndg2sJJJGR5KG Cr2CuKV8moms3SyAWTs+Nf7iA33Fy8w= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-385-sFhFSPFrP4CIoucnQlO17Q-1; Tue, 30 Nov 2021 15:27:34 -0500 X-MC-Unique: sFhFSPFrP4CIoucnQlO17Q-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id BAE6310144E3; Tue, 30 Nov 2021 20:27:29 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.39.193.123]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 611AE45D64; Tue, 30 Nov 2021 20:27:17 +0000 (UTC) From: Florian Weimer To: =?utf-8?Q?Micka=C3=ABl_Sala=C3=BCn?= Cc: Al Viro , Andrew Morton , Alejandro Colomar , 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 , Philippe =?utf-8?Q?Tr=C3=A9buchet?= , Scott Shell , Shuah Khan , Steve Dower , Steve Grubb , Thibaut Sautereau , Vincent Strubel , Yin Fengwei , 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 Subject: Re: [PATCH v17 0/3] Add trusted_for(2) (was O_MAYEXEC) References: <20211115185304.198460-1-mic@digikod.net> Date: Tue, 30 Nov 2021 21:27:15 +0100 In-Reply-To: <20211115185304.198460-1-mic@digikod.net> (=?utf-8?Q?=22Micka?= =?utf-8?Q?=C3=ABl_Sala=C3=BCn=22's?= message of "Mon, 15 Nov 2021 19:53:01 +0100") Message-ID: <87sfvd8k4c.fsf@oldenburg.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Micka=C3=ABl Sala=C3=BCn: > Primary goal of trusted_for(2) > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D > > This new syscall enables user space to ask the kernel: is this file > descriptor's content trusted to be used for this purpose? The set of > usage currently only contains execution, but other may follow (e.g. > configuration, sensitive data). If the kernel identifies the file > descriptor as trustworthy for this usage, user space should then take > this information into account. The "execution" usage means that the > content of the file descriptor is trusted according to the system policy > to be executed by user space, which means that it interprets the content > or (try to) maps it as executable memory. I sketched my ideas about =E2=80=9CIMA gadgets=E2=80=9D here: IMA gadgets I still don't think the proposed trusted_for interface is sufficient. The example I gave is a Perl module that does nothing (on its own) when loaded as a Perl module (although you probably don't want to sign it anyway, given what it implements), but triggers an unwanted action when sourced (using .) as a shell script. > @usage identifies the user space usage intended for @fd: only > TRUSTED_FOR_EXECUTION for now, but trusted_for_usage could be extended > to identify other usages (e.g. configuration, sensitive data). We would need TRUSTED_FOR_EXECUTION_BY_BASH, TRUSTED_FOR_EXECUTION_BY_PERL, etc. I'm not sure that actually works. Caller process context does not work because we have this confusion internally between glibc's own use (for the dynamic linker configuration), and for loading programs/shared objects (there seems to be a corner case where you can execute arbitrary code even without executable mappings in the ELF object), and the script interpreter itself (the primary target for trusted_for). But for generating auditing events, trusted_for seems is probably quite helpful. Thanks, Florian