[lkml]   [2002]   [Mar]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [bkpatch] add sys_sendfile64
On Sun, Mar 03, 2002 at 04:18:18PM -0500, Benjamin LaHaise wrote:

The below bitkeeper patch can be pulled from

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

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

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 13:24    [W:0.053 / U:0.144 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site