From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from namei.org ([65.99.196.166]:53460 "EHLO namei.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752273AbeCSEwa (ORCPT ); Mon, 19 Mar 2018 00:52:30 -0400 Date: Mon, 19 Mar 2018 15:52:18 +1100 (AEDT) From: James Morris To: Kees Cook cc: linux-kernel@vger.kernel.org, Linus Torvalds , LSM List , "Serge E. Hallyn" , Mimi Zohar , linux-integrity , Paul Moore , Stephen Smalley Subject: Re: [PATCH v2] exec: Set file unwritable before LSM check In-Reply-To: <20180309193020.GA5149@beast> Message-ID: References: <20180309193020.GA5149@beast> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-integrity-owner@vger.kernel.org List-ID: On Fri, 9 Mar 2018, Kees Cook wrote: > The LSM check should happen after the file has been confirmed to be > unchanging. Without this, we could have a race between the Time of Check > (the call to security_kernel_read_file() which could read the file and > make access policy decisions) and the Time of Use (starting with > kernel_read_file()'s reading of the file contents). In theory, file > contents could change between the two. > > Signed-off-by: Kees Cook > --- > v2: Clarify the ToC/ToU race (Linus) Applied to git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security.git next-general and next-testing -- James Morris