Hello
If we use 64bit kernel on ia64/x86_64/s390 architecture, and we run
32bit binary on 32bit compatibility mode, sendfile system call seems be
not set offset argument.
This is because sendfile's return value is not zero but the code regards
the result by return value is zero or not.
This problem will be affect to ia64/x86_64/s390 and not affect to other
architecture does not affect other architecture (mips/parisc/ppc64/sparc64).
So, I have multi-posted this e-mail to ia64/x86_64/s390 maintainer and
mailling list.
Following patch will fix the problem. (I have confirmed on my EM64T
machine.)
Thank you.
--
F-Secure Japan
Yoshioka Tsuneo([EMAIL PROTECTED])
=============================================================
--- linux-2.4.30/arch/ia64/ia32/sys_ia32.c-orig Tue Apr 19 10:29:54 2005
+++ linux-2.4.30/arch/ia64/ia32/sys_ia32.c Tue Apr 19 10:30:21 2005
@@ -3991,7 +3991,7 @@ sys32_sendfile (int out_fd, int in_fd, i
ret = sys_sendfile(out_fd, in_fd, offset ? &of : NULL, count);
set_fs(old_fs);
- if (!ret && offset && put_user(of, offset))
+ if (offset && put_user(of, offset))
return -EFAULT;
return ret;
--- linux-2.4.30/arch/s390x/kernel/linux32.c-orig Tue Apr 19 10:30:04 2005
+++ linux-2.4.30/arch/s390x/kernel/linux32.c Tue Apr 19 10:31:14 2005
@@ -4225,7 +4225,7 @@ asmlinkage int sys32_sendfile(int out_fd
ret = sys_sendfile(out_fd, in_fd, offset ? &of : NULL, count);
set_fs(old_fs);
- if (!ret && offset && put_user(of, offset))
+ if (offset && put_user(of, offset))
return -EFAULT;
return ret;
--- linux-2.4.30/arch/x86_64/ia32/sys_ia32.c-orig Tue Apr 19 10:30:11 2005
+++ linux-2.4.30/arch/x86_64/ia32/sys_ia32.c Tue Apr 19 10:31:27 2005
@@ -2000,7 +2000,7 @@ sys32_sendfile(int out_fd, int in_fd, __
ret = sys_sendfile(out_fd, in_fd, offset ? &of : NULL, count);
set_fs(old_fs);
- if (!ret && offset && put_user(of, offset))
+ if (offset && put_user(of, offset))
return -EFAULT;
return ret;
--- linux-2.6.11.7/arch/ia64/ia32/sys_ia32.c-orig Tue Apr 19 10:33:57 2005
+++ linux-2.6.11.7/arch/ia64/ia32/sys_ia32.c Tue Apr 19 10:34:30 2005
@@ -2327,7 +2327,7 @@ sys32_sendfile (int out_fd, int in_fd, i
ret = sys_sendfile(out_fd, in_fd, offset ? (off_t __user *) &of : NULL,
count);
set_fs(old_fs);
- if (!ret && offset && put_user(of, offset))
+ if (offset && put_user(of, offset))
return -EFAULT;
return ret;
--- linux-2.6.11.7/arch/s390/kernel/compat_linux.c-orig Tue Apr 19 10:34:06 2005
+++ linux-2.6.11.7/arch/s390/kernel/compat_linux.c Tue Apr 19 10:34:39 2005
@@ -677,7 +677,7 @@ asmlinkage long sys32_sendfile(int out_f
ret = sys_sendfile(out_fd, in_fd, offset ? &of : NULL, count);
set_fs(old_fs);
- if (!ret && offset && put_user(of, offset))
+ if (offset && put_user(of, offset))
return -EFAULT;
return ret;
--- linux-2.6.11.7/arch/x86_64/ia32/sys_ia32.c-orig Tue Apr 19 10:34:13 2005
+++ linux-2.6.11.7/arch/x86_64/ia32/sys_ia32.c Tue Apr 19 10:34:47 2005
@@ -751,7 +751,7 @@ sys32_sendfile(int out_fd, int in_fd, co
ret = sys_sendfile(out_fd, in_fd, offset ? &of : NULL, count);
set_fs(old_fs);
- if (!ret && offset && put_user(of, offset))
+ if (offset && put_user(of, offset))
return -EFAULT;
return ret;
============================================================================-
----------------------------------------------------------------------
For LINUX-390 subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390