public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Chris Wedgwood <cw@f00f.org>
To: Benjamin LaHaise <bcrl@redhat.com>
Cc: torvalds@transmeta.com, linux-kernel@vger.kernel.org
Subject: Re: [bkpatch] add sys_sendfile64
Date: Sun, 3 Mar 2002 19:10:23 -0800	[thread overview]
Message-ID: <20020304031023.GA14757@tapu.f00f.org> (raw)
In-Reply-To: <20020303161818.A18187@redhat.com>
In-Reply-To: <20020303161818.A18187@redhat.com>

On Sun, Mar 03, 2002 at 04:18:18PM -0500, Benjamin LaHaise wrote:

    The below bitkeeper patch can be pulled from
    	bk://bcrlbits.bkbits.net/linux-2.5

    and adds a sys_sendfile64 call.  Arch maintainers should 
    probably add the entry to their syscall tables if it is 
    appropriate.

Neat.  I made something similar last night but messed it up originally
so never sent it.

    +
    +asmlinkage ssize_t sys_sendfile(int out_fd, int in_fd, off_t *offset, size_t count)
    +{
    +	loff_t pos, *ppos = NULL;
    +	ssize_t ret;
    +	if (offset) {
    +		off_t off;
    +		if (unlikely(get_user(off, offset)))
    +			return -EFAULT;
    +		pos = off;
    +		ppos = &pos;

We have a problem if off + count >= 2^32 here.

Ideally i think we need to check for 32-bit (31-bit?) overflow here
and return -EOVERFLOW.  I made a similar patch last night for
sendfile64 which included this check (although I was tired and the
patch was slightly wrong).  Actually, I think wew are missing
EOVERFLOW checks in a number of paths, ideally I'd like to make one
function to check and have all other functions reference that if
people agree that makes sense.

    +	}
    +	ret = common_sendfile(out_fd, in_fd, ppos, count);
    +	if (offset)
    +		put_user((off_t)pos, offset);
    +	return ret;

What is another thread unmapped 'offset' during the system call?  Do
we want to check the result of put_user here and return -EFAULT?
(If so, there are other system calls to consider such as select).




  --cw

  reply	other threads:[~2002-03-04  3:11 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-03-03 21:18 [bkpatch] add sys_sendfile64 Benjamin LaHaise
2002-03-04  3:10 ` Chris Wedgwood [this message]
2002-03-04 14:17   ` Benjamin LaHaise
2002-03-04 16:27   ` Benjamin LaHaise

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=20020304031023.GA14757@tapu.f00f.org \
    --to=cw@f00f.org \
    --cc=bcrl@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@transmeta.com \
    /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