From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andi Kleen Subject: Re: negative seek offsets in VFS Date: 26 May 2005 21:25:26 +0200 Message-ID: <20050526192526.GX86087@muc.de> References: <20050525163905.GP86087@muc.de> <20050526151508.GZ29811@parcelfarce.linux.theplanet.co.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Al Viro , viro@www.linux.org.uk, linux-fsdevel@vger.kernel.org Return-path: Received: from colin.muc.de ([193.149.48.1]:31502 "EHLO mail.muc.de") by vger.kernel.org with ESMTP id S261709AbVEZTZ1 (ORCPT ); Thu, 26 May 2005 15:25:27 -0400 Date: Thu, 26 May 2005 21:25:26 +0200 To: Linus Torvalds Content-Disposition: inline In-Reply-To: Sender: linux-fsdevel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org > I don't think there is a "positive loff_t", so I guess the code would have > to be something like > > /* Wraparound? */ > if ((u64)(pos + count) < count) > goto Einval; Sometimes I think we should have a nice inline asm macro for that that checks carry. > > if ((loff_t) (pos + count) < 0) > if (!(file->f_mode & FMODE_ANY_OFFSET)) > goto Einval; Looks good. But how to handle the broken devices viro worries about? I would prefer not to open any new security holes, but it is a bit too much code to audit all. Flag would be possible, but ugly. Any other choice? -Andi