Another potential data corruption fix. The 32bit truncate64 on x86-64 did silently truncate offsets >32bit. That broke mysql for example. Fix that. >From Chris Wilson arch/x86_64/ia32/ia32entry.S | 4 ++-- arch/x86_64/ia32/sys_ia32.c | 15 +++++++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff -puN arch/x86_64/ia32/ia32entry.S~x86_64-04 arch/x86_64/ia32/ia32entry.S --- 25/arch/x86_64/ia32/ia32entry.S~x86_64-04 2003-12-24 00:05:27.000000000 -0800 +++ 25-akpm/arch/x86_64/ia32/ia32entry.S 2003-12-24 00:05:27.000000000 -0800 @@ -396,8 +396,8 @@ ia32_sys_call_table: .quad stub32_vfork /* 190 */ .quad compat_sys_getrlimit .quad sys32_mmap2 - .quad sys_truncate - .quad sys_ftruncate + .quad sys32_truncate64 + .quad sys32_ftruncate64 .quad sys32_stat64 /* 195 */ .quad sys32_lstat64 .quad sys32_fstat64 diff -puN arch/x86_64/ia32/sys_ia32.c~x86_64-04 arch/x86_64/ia32/sys_ia32.c --- 25/arch/x86_64/ia32/sys_ia32.c~x86_64-04 2003-12-24 00:05:27.000000000 -0800 +++ 25-akpm/arch/x86_64/ia32/sys_ia32.c 2003-12-24 00:05:27.000000000 -0800 @@ -110,6 +110,21 @@ int cp_compat_stat(struct kstat *kbuf, s return 0; } +extern long sys_truncate(char *, loff_t); +extern long sys_ftruncate(int, loff_t); + +asmlinkage long +sys32_truncate64(char * filename, unsigned long offset_low, unsigned long offset_high) +{ + return sys_truncate(filename, ((loff_t) offset_high << 32) | offset_low); +} + +asmlinkage long +sys32_ftruncate64(unsigned int fd, unsigned long offset_low, unsigned long offset_high) +{ + return sys_ftruncate(fd, ((loff_t) offset_high << 32) | offset_low); +} + /* Another set for IA32/LFS -- x86_64 struct stat is different due to support for 64bit inode numbers. */ _