Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751593AbdIOSFf (ORCPT ); Fri, 15 Sep 2017 14:05:35 -0400 Received: from mail-io0-f194.google.com ([209.85.223.194]:36082 "EHLO mail-io0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751541AbdIOSFd (ORCPT ); Fri, 15 Sep 2017 14:05:33 -0400 X-Google-Smtp-Source: AOwi7QBDDEl48YKAXRuG4LNMKhuFHlLCOuM9yl8iUPso8t6nronKwtETjg6m4s8iWpceujOIuTVlxP2sYbOg93Byy2Y= MIME-Version: 1.0 In-Reply-To: <1505466296.4200.86.camel@linux.vnet.ibm.com> References: <1505451494-30228-1-git-send-email-zohar@linux.vnet.ibm.com> <1505451494-30228-4-git-send-email-zohar@linux.vnet.ibm.com> <1505466296.4200.86.camel@linux.vnet.ibm.com> From: Linus Torvalds Date: Fri, 15 Sep 2017 11:05:31 -0700 X-Google-Sender-Auth: j0-gITcdjziUIt0F9ACXUFkgrUw Message-ID: Subject: Re: [PATCH 3/3] ima: use fs method to read integrity data To: Mimi Zohar Cc: Dave Kleikamp , Bob Peterson , David Woodhouse , Chao Yu , Hugh Dickins , "Darrick J. Wong" , Matthew Garrett , Joel Becker , Jan Kara , Chris Mason , Ryusuke Konishi , Steven Whitehouse , Christoph Hellwig , Andreas Dilger , "Theodore Ts'o" , Mark Fasheh , LSM List , linux-ima-devel@lists.sourceforge.net, James Morris , Richard Weinberger , Jaegeuk Kim , Linux Kernel Mailing List , Christoph Hellwig Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1123 Lines: 28 On Fri, Sep 15, 2017 at 2:04 AM, Mimi Zohar wrote: > On Thu, 2017-09-14 at 22:50 -0700, Linus Torvalds wrote: >> This is still wrong. >> >> (a) there is no explanation for why we need that exclusive lock in the >> first place > >> Why should a read need exclusive access? You'd think shared is sufficient. > > True, reading a file shouldn't require an exclusive lock. The > exclusive lock is taken to prevent the file from changing while the > file hash is being calculated. That really shouldn't need an exclusive lock either. The whole point is that you're just reading the file, so a shared lock should be fine. There may be other *higher* level reasons why the caller then might want an exclusive lock for other reasons, but that should have nothing to do with the reading part. So this is the thing I want explained. Right now there are no explanations, and the few comments there are about exclusive locking don't make sense, and don't match the lockdep tests. So the patch itself may be fine, but the commentary and explanations are broken and/or missing. Linus