From: Matthew Wilcox Subject: mandatory lock related races Date: Wed, 22 May 2002 05:47:20 +0100 Sender: linux-fsdevel-owner@vger.kernel.org Message-ID: <20020522054720.B1299@parcelfarce.linux.theplanet.co.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from willy by www.linux.org.uk with local (Exim 3.33 #5) id 17AO1w-0002eR-00 for linux-fsdevel@vger.kernel.org; Wed, 22 May 2002 05:47:20 +0100 To: linux-fsdevel@vger.kernel.org Content-Disposition: inline List-Id: linux-fsdevel.vger.kernel.org as part of my file locking cleanup, i've been paying particular attention to races. i've found a couple of good ones around mandatory locks (apart from the ones pointed out by Christian Ehrhardt). right now, we have checks to prevent mmaps or truncates on files which have mandatory locks currently applied to them. unfortunately, there's nothing to prevent another process from acquiring a file lock after the check but before the mmap takes place. ditto truncate. so, my question is: do we care? if we care, how do we fix this? sharing some kind of lock between fs/locks.c, mm/mmap.c and fs/namei.c would be pretty grotesque, to say the least. oh yeah, and we should also protect against chmod(2), probably ... mandatory region locking is such a broken idea. -- Revolutions do not require corporate support.