Commit 8f0f4aaa authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] Fix 32bit truncate on x86-64

From: Andi Kleen <ak@muc.de>

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
parent 3959fde8
......@@ -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
......
......@@ -110,6 +110,21 @@ int cp_compat_stat(struct kstat *kbuf, struct compat_stat *ubuf)
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. */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment