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 X-Spam-Level: X-Spam-Status: No, score=-13.1 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1,USER_IN_DEF_DKIM_WL autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7B801C433E0 for ; Tue, 11 Aug 2020 17:18:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 55CF7206DC for ; Tue, 11 Aug 2020 17:18:12 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=linux.microsoft.com header.i=@linux.microsoft.com header.b="PoJFWvdJ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729079AbgHKRSL (ORCPT ); Tue, 11 Aug 2020 13:18:11 -0400 Received: from linux.microsoft.com ([13.77.154.182]:56798 "EHLO linux.microsoft.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728990AbgHKRSK (ORCPT ); Tue, 11 Aug 2020 13:18:10 -0400 Received: from [10.137.106.139] (unknown [131.107.174.11]) by linux.microsoft.com (Postfix) with ESMTPSA id 364D420B4908; Tue, 11 Aug 2020 10:18:09 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 364D420B4908 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1597166289; bh=4CUNuNiiePWf1WTPIiwYBL13LZ+7k2/9/J/jpcaXW7A=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=PoJFWvdJ1RO9aetIAjmD0rk7oHcgoNUd11mJAo6cf98zwa1+fMROHW9q/uMp6iMeX Gx9jAgsZekiKh7pxAVZrnSCW536fsoku8TARzOm+dS5qqA/BlR8Bpa7J8vLGhpHHRD Yi+yCyW66KZsN6+KFh8r2FianF/MQzdF5N+1bL7A= Subject: Re: [PATCH v7 0/7] Add support for O_MAYEXEC To: =?UTF-8?Q?Micka=c3=abl_Sala=c3=bcn?= , Jann Horn , Kees Cook , Mimi Zohar Cc: Al Viro , Andrew Morton , kernel list , Aleksa Sarai , Alexei Starovoitov , Andy Lutomirski , Christian Brauner , Christian Heimes , Daniel Borkmann , Dmitry Vyukov , Eric Biggers , Eric Chiang , Florian Weimer , James Morris , Jan Kara , Jonathan Corbet , Lakshmi Ramasubramanian , Matthew Garrett , Matthew Wilcox , Michael Kerrisk , =?UTF-8?Q?Philippe_Tr=c3=a9buchet?= , Scott Shell , Sean Christopherson , Shuah Khan , Steve Dower , Steve Grubb , Tetsuo Handa , Thibaut Sautereau , Vincent Strubel , Kernel Hardening , Linux API , linux-integrity@vger.kernel.org, linux-security-module , linux-fsdevel References: <20200723171227.446711-1-mic@digikod.net> <202007241205.751EBE7@keescook> <0733fbed-cc73-027b-13c7-c368c2d67fb3@digikod.net> <20200810202123.GC1236603@ZenIV.linux.org.uk> <917bb071-8b1a-3ba4-dc16-f8d7b4cc849f@digikod.net> <0cc94c91-afd3-27cd-b831-8ea16ca8ca93@digikod.net> From: Deven Bowers Message-ID: <77d685ec-aba2-6a2c-5d25-1172279ceb83@linux.microsoft.com> Date: Tue, 11 Aug 2020 10:18:08 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.11.0 MIME-Version: 1.0 In-Reply-To: <0cc94c91-afd3-27cd-b831-8ea16ca8ca93@digikod.net> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: owner-linux-security-module@vger.kernel.org Precedence: bulk List-ID: On 8/11/2020 1:48 AM, Mickaël Salaün wrote: [...snip] >>> It is a >>> good practice to check as soon as possible such properties, and it may >>> enables to avoid (user space) time-of-check to time-of-use (TOCTOU) >>> attacks (i.e. misuse of already open resources). >> >> The assumption that security checks should happen as early as possible >> can actually cause security problems. For example, because seccomp was >> designed to do its checks as early as possible, including before >> ptrace, we had an issue for a long time where the ptrace API could be >> abused to bypass seccomp filters. >> >> Please don't decide that a check must be ordered first _just_ because >> it is a security check. While that can be good for limiting attack >> surface, it can also create issues when the idea is applied too >> broadly. > > I'd be interested with such security issue examples. > > I hope that delaying checks will not be an issue for mechanisms such as > IMA or IPE: > https://lore.kernel.org/lkml/1544699060.6703.11.camel@linux.ibm.com/ > > Any though Mimi, Deven, Chrome OS folks? > I don't see an issue with IPE. As long as the hypothetical new syscall and associated security hook have the file struct available in the hook, it should integrate fairly easily. [...snip]