From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from benson.default.arb33.uk0.bigv.io ([46.43.0.16]:52413 "EHLO benson.default.arb33.uk0.bigv.io" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752179AbdK3PR7 (ORCPT ); Thu, 30 Nov 2017 10:17:59 -0500 Message-ID: <1512053826.26048.8.camel@hellion.org.uk> Subject: Re: [kernel-hardening] Re: [PATCH v3 2/2] Protected O_CREAT open in sticky directories From: Ian Campbell To: Salvatore Mesoraca , Solar Designer Cc: David Laight , Alan Cox , "linux-kernel@vger.kernel.org" , Kernel Hardening , "linux-fsdevel@vger.kernel.org" , Alexander Viro , Jann Horn , Kees Cook , "Eric W. Biederman" Date: Thu, 30 Nov 2017 14:57:06 +0000 In-Reply-To: References: <1511337706-8297-1-git-send-email-s.mesoraca16@gmail.com> <1511337706-8297-3-git-send-email-s.mesoraca16@gmail.com> <20171122165144.07aea7ac@alans-desktop> <33dcc007e92349999ce77bf45825be22@AcuMS.aculab.com> <20171127002641.GA14743@openwall.com> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Thu, 2017-11-30 at 15:39 +0100, Salvatore Mesoraca wrote: > 2017-11-27 1:26 GMT+01:00 Solar Designer : > > On Fri, Nov 24, 2017 at 12:43:47PM +0100, Salvatore Mesoraca wrote: > > > 2017-11-24 11:53 GMT+01:00 David Laight > > > : > > > > From: Alan Cox > > > > > Sent: 22 November 2017 16:52 > > > > > > > > > > On Wed, 22 Nov 2017 09:01:46 +0100 Salvatore Mesoraca > > > > raca16@gmail.com> wrote: > > > > > > > > > > > Disallows O_CREAT open missing the O_EXCL flag, in world or > > > > > > group writable directories, even if the file doesn't exist > > > > > > yet. > > > > > > With few exceptions (e.g. shared lock files based on > > > > > > flock()) > > > > Why would "shared lock files based on flock()" need O_CREAT without > > O_EXCL? Where specifically are they currently used that way? > > I don't think that they *need* to act like this, but this is how > util-linux's flock(1) currently works. > And it doesn't seem an unreasonable behavior from their perspective, I thought that too, specifically I reasoned that using O_EXCL would defeat the purpose of the _shared_ flock(), wouldn't it? Ian.