From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Jesper Juhl" Subject: Re: [PATCH 4/7] fuse: add POSIX file locking support Date: Mon, 19 Jun 2006 10:21:38 +0200 Message-ID: <9a8748490606190121u3c76c6bbif707835ec7e5873c@mail.gmail.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: akpm@osdl.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org Return-path: Received: from nf-out-0910.google.com ([64.233.182.191]:5938 "EHLO nf-out-0910.google.com") by vger.kernel.org with ESMTP id S932316AbWFSIVk (ORCPT ); Mon, 19 Jun 2006 04:21:40 -0400 Received: by nf-out-0910.google.com with SMTP id o25so1206977nfa for ; Mon, 19 Jun 2006 01:21:39 -0700 (PDT) To: "Miklos Szeredi" In-Reply-To: Content-Disposition: inline Sender: linux-fsdevel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org On 12/06/06, Miklos Szeredi wrote: > This patch adds POSIX file locking support to the fuse interface. > > +/* > + * It would be nice to scramble the ID space, so that the value of the > + * files_struct pointer is not exposed to userspace. Symmetric crypto > + * functions are overkill, since the inverse function doesn't need to > + * be implemented (though it does have to exist). Is there something > + * simpler? > + */ > +static inline u64 fuse_lock_owner_id(fl_owner_t id) > +{ > + return (unsigned long) id; > +} > + How about; on fuse startup, pick some semirandom number, store it somewhere, then do an XOR of the pointer with the saved value to scramble it, when you need to use it, simply XOR it again with the stored value... Not especially strong, but better than nothing and better than just adding a constant that people can find out from the source (and the scramble value would be differene each time fuse loads, so at a minimum a different scramble key every boot) - also, XOR is a quite fast operation so overhead should be low. -- Jesper Juhl Don't top-post http://www.catb.org/~esr/jargon/html/T/top-post.html Plain text mails only, please http://www.expita.com/nomime.html