[CVE-2009-0029] System call wrapper special cases
System calls with an unsigned long long argument can't be converted with the standard wrappers since that would include a cast to long, which in turn means that we would lose the upper 32 bit on 32 bit architectures. Also semctl can't use the standard wrapper since it has a 'union' parameter. So we handle them as special case and add some extra wrappers instead. Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
This commit is contained in:
27
fs/open.c
27
fs/open.c
@@ -351,21 +351,35 @@ asmlinkage long sys_ftruncate(unsigned int fd, unsigned long length)
|
||||
|
||||
/* LFS versions of truncate are only needed on 32 bit machines */
|
||||
#if BITS_PER_LONG == 32
|
||||
asmlinkage long sys_truncate64(const char __user * path, loff_t length)
|
||||
SYSCALL_DEFINE(truncate64)(const char __user * path, loff_t length)
|
||||
{
|
||||
return do_sys_truncate(path, length);
|
||||
}
|
||||
#ifdef CONFIG_HAVE_SYSCALL_WRAPPERS
|
||||
asmlinkage long SyS_truncate64(long path, loff_t length)
|
||||
{
|
||||
return SYSC_truncate64((const char __user *) path, length);
|
||||
}
|
||||
SYSCALL_ALIAS(sys_truncate64, SyS_truncate64);
|
||||
#endif
|
||||
|
||||
asmlinkage long sys_ftruncate64(unsigned int fd, loff_t length)
|
||||
SYSCALL_DEFINE(ftruncate64)(unsigned int fd, loff_t length)
|
||||
{
|
||||
long ret = do_sys_ftruncate(fd, length, 0);
|
||||
/* avoid REGPARM breakage on x86: */
|
||||
asmlinkage_protect(2, ret, fd, length);
|
||||
return ret;
|
||||
}
|
||||
#ifdef CONFIG_HAVE_SYSCALL_WRAPPERS
|
||||
asmlinkage long SyS_ftruncate64(long fd, loff_t length)
|
||||
{
|
||||
return SYSC_ftruncate64((unsigned int) fd, length);
|
||||
}
|
||||
SYSCALL_ALIAS(sys_ftruncate64, SyS_ftruncate64);
|
||||
#endif
|
||||
#endif /* BITS_PER_LONG == 32 */
|
||||
|
||||
asmlinkage long sys_fallocate(int fd, int mode, loff_t offset, loff_t len)
|
||||
SYSCALL_DEFINE(fallocate)(int fd, int mode, loff_t offset, loff_t len)
|
||||
{
|
||||
struct file *file;
|
||||
struct inode *inode;
|
||||
@@ -422,6 +436,13 @@ out_fput:
|
||||
out:
|
||||
return ret;
|
||||
}
|
||||
#ifdef CONFIG_HAVE_SYSCALL_WRAPPERS
|
||||
asmlinkage long SyS_fallocate(long fd, long mode, loff_t offset, loff_t len)
|
||||
{
|
||||
return SYSC_fallocate((int)fd, (int)mode, offset, len);
|
||||
}
|
||||
SYSCALL_ALIAS(sys_fallocate, SyS_fallocate);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* access() needs to use the real uid/gid, not the effective uid/gid.
|
||||
|
Reference in New Issue
Block a user