From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751087AbdJAMI1 (ORCPT ); Sun, 1 Oct 2017 08:08:27 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:41808 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750981AbdJAMIY (ORCPT ); Sun, 1 Oct 2017 08:08:24 -0400 Subject: Re: [RFC PATCH 3/3] fs: detect that the i_rwsem has already been taken exclusively From: Mimi Zohar To: Linus Torvalds , "Eric W. Biederman" Cc: Dave Chinner , LSM List , linux-fsdevel , Christoph Hellwig , "Theodore Ts'o" , Jan Kara , Linux Kernel Mailing List , linux-integrity@vger.kernel.org Date: Sun, 01 Oct 2017 08:08:11 -0400 In-Reply-To: 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> <87mv5blki7.fsf@xmission.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.20.5 (3.20.5-1.fc24) Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-MML: disable x-cbid: 17100112-0008-0000-0000-000001591407 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17100112-0009-0000-0000-0000098ECB9E Message-Id: <1506859691.5691.211.camel@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-10-01_06:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000 definitions=main-1710010179 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 2017-09-30 at 18:56 -0700, Linus Torvalds wrote: > On Sep 30, 2017 18:33, "Eric W. Biederman" wrote:. > > > 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? > > > No, why? > > You should just invalidate the IMA on xattr write or other operations that > make the measurement invalid. You only need the inner lock. Right, re-introducing the iint->mutex and a new i_generation field in the iint struct with a separate set of locks should work.  It will be reset if the file metadata changes (eg. setxattr, chown, chmod). (We need i_generation for namespacing IMA as well.) thanks, Mimi