linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@osdl.org>
To: Andi Kleen <ak@muc.de>
Cc: Al Viro <viro@parcelfarce.linux.theplanet.co.uk>,
	viro@www.linux.org.uk, linux-fsdevel@vger.kernel.org
Subject: Re: negative seek offsets in VFS
Date: Thu, 26 May 2005 12:39:19 -0700 (PDT)	[thread overview]
Message-ID: <Pine.LNX.4.58.0505261238090.2307@ppc970.osdl.org> (raw)
In-Reply-To: <20050526192526.GX86087@muc.de>



On Thu, 26 May 2005, Andi Kleen wrote:
>
> > 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. 

Well, we'd need one in every size, and it's not common enough for us to 
care about performance, so..

> > 	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.

I would _only_ ever set that FMODE_ANY_OFFSET for /dev/mem or other 
devices that are known to be ok. IOW, this is not something that ever gets 
set by default, and the user cannot set it.

		Linus

  reply	other threads:[~2005-05-26 19:37 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-05-25 16:39 negative seek offsets in VFS Andi Kleen
2005-05-25 16:56 ` Trond Myklebust
2005-05-25 18:48   ` Andi Kleen
2005-05-26  0:56 ` Bryan Henderson
2005-05-26 19:20   ` Andi Kleen
2005-05-26 15:15 ` Al Viro
2005-05-26 15:29   ` Linus Torvalds
2005-05-26 19:25     ` Andi Kleen
2005-05-26 19:39       ` Linus Torvalds [this message]
  -- strict thread matches above, loose matches on Subject: below --
2005-05-26 14:29 Paul Taysom
     [not found] <s29588e0.089@sinclair.provo.novell.com>
2005-05-26 17:49 ` Bryan Henderson
2005-05-26 19:23   ` Andi Kleen
2005-05-26 21:17     ` Bryan Henderson
2005-05-27 10:43       ` Andi Kleen
2005-05-27 18:39         ` Bryan Henderson
2005-05-28 12:41           ` Jamie Lokier
2005-05-31 18:08             ` Bryan Henderson
2005-05-30  9:36           ` Andi Kleen
2005-05-31 18:33             ` Bryan Henderson
2005-05-28 12:37         ` Jamie Lokier
2005-05-30  9:32           ` Andi Kleen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.58.0505261238090.2307@ppc970.osdl.org \
    --to=torvalds@osdl.org \
    --cc=ak@muc.de \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=viro@parcelfarce.linux.theplanet.co.uk \
    --cc=viro@www.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).