From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from out03.mta.xmission.com ([166.70.13.233]:36234 "EHLO out03.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751264AbdJABdw (ORCPT ); Sat, 30 Sep 2017 21:33:52 -0400 From: ebiederm@xmission.com (Eric W. Biederman) To: Linus Torvalds Cc: Mimi Zohar , Dave Chinner , LSM List , linux-fsdevel , linux-integrity@vger.kernel.org, Christoph Hellwig , Linux Kernel Mailing List , Jan Kara , "Theodore Ts'o" References: <1506602373-4799-1-git-send-email-zohar@linux.vnet.ibm.com> <1506602373-4799-4-git-send-email-zohar@linux.vnet.ibm.com> <20170928220215.GC15067@dastard> <1506643967.5691.46.camel@linux.vnet.ibm.com> <1506649980.5691.100.camel@linux.vnet.ibm.com> Date: Sat, 30 Sep 2017 20:33:36 -0500 In-Reply-To: (Linus Torvalds's message of "Thu, 28 Sep 2017 20:26:15 -0700") Message-ID: <87mv5blki7.fsf@xmission.com> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [RFC PATCH 3/3] fs: detect that the i_rwsem has already been taken exclusively Sender: linux-integrity-owner@vger.kernel.org List-ID: Linus Torvalds writes: > On Thu, Sep 28, 2017 at 6:53 PM, Mimi Zohar wrote: >> >> The locking issue isn't with validating the file hash, but with the >> setxattr, chmod, chown syscalls. Each of these syscalls takes the >> i_rwsem exclusively before IMA (or EVM) is called. > > Read my email again. > >> In setxattr, chmod, chown syscalls, IMA (and EVM) are called after the >> i_rwsem is already taken. So the locking would be: >> >> lock: i_rwsem >> lock: iint->mutex > > No. > > Two locks. One inner, one outer. Only the actual ones that calculates > the hash would take the outer one. Read my email. That would require a task_work or another kind of work callback so that the writes of the xattr are not synchronous with the vfs callback correct? Eric From mboxrd@z Thu Jan 1 00:00:00 1970 From: ebiederm@xmission.com (Eric W. Biederman) Date: Sat, 30 Sep 2017 20:33:36 -0500 Subject: [RFC PATCH 3/3] fs: detect that the i_rwsem has already been taken exclusively In-Reply-To: (Linus Torvalds's message of "Thu, 28 Sep 2017 20:26:15 -0700") References: <1506602373-4799-1-git-send-email-zohar@linux.vnet.ibm.com> <1506602373-4799-4-git-send-email-zohar@linux.vnet.ibm.com> <20170928220215.GC15067@dastard> <1506643967.5691.46.camel@linux.vnet.ibm.com> <1506649980.5691.100.camel@linux.vnet.ibm.com> Message-ID: <87mv5blki7.fsf@xmission.com> To: linux-security-module@vger.kernel.org List-Id: linux-security-module.vger.kernel.org Linus Torvalds writes: > On Thu, Sep 28, 2017 at 6:53 PM, Mimi Zohar wrote: >> >> The locking issue isn't with validating the file hash, but with the >> setxattr, chmod, chown syscalls. Each of these syscalls takes the >> i_rwsem exclusively before IMA (or EVM) is called. > > Read my email again. > >> In setxattr, chmod, chown syscalls, IMA (and EVM) are called after the >> i_rwsem is already taken. So the locking would be: >> >> lock: i_rwsem >> lock: iint->mutex > > No. > > Two locks. One inner, one outer. Only the actual ones that calculates > the hash would take the outer one. Read my email. That would require a task_work or another kind of work callback so that the writes of the xattr are not synchronous with the vfs callback correct? Eric -- To unsubscribe from this list: send the line "unsubscribe linux-security-module" in the body of a message to majordomo at vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html