From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752769AbdJABdz (ORCPT ); Sat, 30 Sep 2017 21:33:55 -0400 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> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-XM-SPF: eid=1dyT8b-00057X-7S;;;mid=<87mv5blki7.fsf@xmission.com>;;;hst=in02.mta.xmission.com;;;ip=67.3.200.44;;;frm=ebiederm@xmission.com;;;spf=neutral X-XM-AID: U2FsdGVkX18A+Zq4018pyDP+6EabNpC065n8rEhNDwM= X-SA-Exim-Connect-IP: 67.3.200.44 X-SA-Exim-Mail-From: ebiederm@xmission.com X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * 0.7 XMSubLong Long Subject * 1.5 XMNoVowels Alpha-numberic number with no vowels * 0.0 TVD_RCVD_IP Message was received from an IP address * 0.0 T_TM2_M_HEADER_IN_MSG BODY: No description available. * 0.8 BAYES_50 BODY: Bayes spam probability is 40 to 60% * [score: 0.4956] * -0.0 DCC_CHECK_NEGATIVE Not listed in DCC * [sa07 1397; Body=1 Fuz1=1 Fuz2=1] * 1.0 T_XMDrugObfuBody_08 obfuscated drug references * 0.0 T_TooManySym_01 4+ unique symbols in subject X-Spam-DCC: XMission; sa07 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: ***;Linus Torvalds X-Spam-Relay-Country: X-Spam-Timing: total 5308 ms - load_scoreonly_sql: 0.15 (0.0%), signal_user_changed: 3.7 (0.1%), b_tie_ro: 2.4 (0.0%), parse: 1.45 (0.0%), extract_message_metadata: 14 (0.3%), get_uri_detail_list: 1.31 (0.0%), tests_pri_-1000: 7 (0.1%), tests_pri_-950: 1.22 (0.0%), tests_pri_-900: 1.05 (0.0%), tests_pri_-400: 19 (0.4%), check_bayes: 18 (0.3%), b_tokenize: 6 (0.1%), b_tok_get_all: 6 (0.1%), b_comp_prob: 2.1 (0.0%), b_tok_touch_all: 2.6 (0.0%), b_finish: 0.63 (0.0%), tests_pri_0: 411 (7.7%), check_dkim_signature: 0.62 (0.0%), check_dkim_adsp: 4.0 (0.1%), tests_pri_500: 4845 (91.3%), poll_dns_idle: 4838 (91.2%), rewrite_mail: 0.00 (0.0%) Subject: Re: [RFC PATCH 3/3] fs: detect that the i_rwsem has already been taken exclusively X-Spam-Flag: No X-SA-Exim-Version: 4.2.1 (built Thu, 05 May 2016 13:38:54 -0600) X-SA-Exim-Scanned: Yes (on in02.mta.xmission.com) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@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