truncate()/ftruncate() fix length argument on ia32 emulation.
Subsystems (3)
PATCH 3/3 truncate()/ftruncate() fix length argument on ia32 emulation.
move signed-extended int to long, because of signed test.
--- arch/x86/ia32/ia32entry.S | 4 ++-- fs/compat.c | 10 ++++++++++ include/linux/compat.h | 2 ++ 3 files changed, 14 insertions(+), 2 deletions(-)
arch/x86/ia32/ia32entry.S +2 -2
@@ -595,8 +595,8 @@ ia32_sys_call_table: .quad compat_sys_old_readdir .quad sys32_mmap /* 90 */ .quad sys_munmap - .quad sys_truncate - .quad sys_ftruncate + .quad compat_sys_truncate + .quad compat_sys_ftruncate .quad sys_fchmod .quad sys_fchown16 /* 95 */ .quad sys_getpriority
fs/compat.c +10 -0
@@ -1814,3 +1814,13 @@ compat_sys_open_by_handle_at(int mountdirfd, return do_handle_open(mountdirfd, handle, flags); }#endif + +asmlinkage long compat_sys_truncate (const char __user *path,int length) +{ +return sys_truncate (path, length); +} + +asmlinkage long compat_sys_ftruncate (unsigned int fd,int length) +{ +return sys_ftruncate (fd, length); +}
include/linux/compat.h +2 -0
@@ -544,6 +544,8 @@ asmlinkage ssize_t compat_sys_mq_timedreceive(mqd_t mqdes, const struct compat_timespec __user *u_abs_timeout);asmlinkage long compat_sys_socketcall (int call,u32 __user *args);asmlinkage long compat_sys_sysctl (struct compat_sysctl_args __user *args); +asmlinkage long compat_sys_truncate (const char __user *path,int length); +asmlinkage long compat_sys_ftruncate (unsigned int fd,int length); extern ssize_t compat_rw_copy_check_uvector(int type, const struct compat_iovec __user *uvector,
Signature · 1 line
1.7.6
Arnd Bergmann
maintainerQuoted 3 lines · On Saturday 17 September 2011 20:01:17 Thomas Meyer wrote:
move signed-extended int to long, because of signed test.
Signed-off-by Thomas Meyer <[email protected]>
I would expect that the same is needed on ia64 and parisc and mips. powerpc, s390 and sparc probably don't need it because they have architecture specific code that already does this, but you can probably remove the powerpc version if you add a generic one.
New architectures (including tile) won't need the wrapper because the 32-bit ABI there only has truncate64.
Arnd
Quoted 3 lines · Thomas Meyer
move signed-extended int to long, because of signed test.
Signed-off-by Thomas Meyer <[email protected]>
[...]
fs/compat.c compat_sys_open_by_handle_at(int mountdirfd, · line 1826
Quoted 4 lines
fs/compat.c +4
-0+asmlinkage long compat_sys_ftruncate (unsigned int fd,int length) +{ +return sys_ftruncate (fd, length); +}
That seems to be wrong... just look at this patch I sent two years ago (which btw. introduced the compat truncate sign extension bug on some architecutures).