From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753782AbZEIRRI (ORCPT ); Sat, 9 May 2009 13:17:08 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752255AbZEIRQy (ORCPT ); Sat, 9 May 2009 13:16:54 -0400 Received: from earthlight.etchedpixels.co.uk ([81.2.110.250]:52721 "EHLO www.etchedpixels.co.uk" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751667AbZEIRQx convert rfc822-to-8bit (ORCPT ); Sat, 9 May 2009 13:16:53 -0400 Date: Sat, 9 May 2009 18:15:59 +0100 From: Alan Cox To: Kay Sievers Cc: Alan Stern , Kernel development list , Pantelis Koukousoulas , USB list Subject: Re: usbfs, claiming entire usb devices Message-ID: <20090509181559.664b141a@lxorguk.ukuu.org.uk> In-Reply-To: References: X-Mailer: Claws Mail 3.7.0 (GTK+ 2.14.7; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-14 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > > Yes.  That is, a process shouldn't be allowed to access a locked device > > unless that process is the lock holder. > > You think the pid or the uid would make more sense? How about neither ? The standard Unix behaviour is to open the file O_EXCL if you want exclusivity. Neither uid or pid are helpful or work in the many environments where you want security - in particular where (as is very common with user space driver type code) you want parts of your code running setuid and parts not, as two processes with different pid and uid values. If O_EXCL is interpeted as exclusive access (versus kernel and re-open of the same node) then you can implement the rest of the sematics in user space. Alan