Re: [PATCH] sendfile compat functions on x86_64 and ia64

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Friday 05 May 2006 02:45, Alexey Toptygin wrote:
> 
> Hi,
> 
> I'm a kernel noob, so I apologise in advance if I completely misunderstood 
> something. In arch/x86_64/ia32/sys_ia32.c there is this code:
> 
> sys32_sendfile(int out_fd, int in_fd, compat_off_t __user *offset, s32 count)
> [snip]
> 	ret = sys_sendfile(out_fd, in_fd, offset ? &of : NULL, count);
> 
> However on ia32, count (a size_t) is u32. I think this is taking the u32 
> value from the 32 bit userland, sign-extending it to 64 bits, then giving 
> it to sys_sendfile in a u64. So, a count >= 1<<31 passed from the 32 bit 
> app will become a count >= ((1<<33)-1)<<31 given to sys_sendfile.
> 
> Now, I don't think this actually hurts anything, because sys_sendfile 
> passes a max of ((1<<31)-1) to do_sendfile, plus rw_verify_area will 
> reject values that are negative when cast to ssize_t; but, this is 
> certainly confusing.

With your change there wouldn't be any sign extension and rw_verify_area
couldn't reject negative values them anymore.

I think it would be a wrong change because it would differ from a native 
32bit kernel.

-Andi

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux