aboutsummaryrefslogtreecommitdiffstats
path: root/fs/open.c
diff options
context:
space:
mode:
authorHeiko Carstens <heiko.carstens@de.ibm.com>2009-01-14 08:14:02 -0500
committerHeiko Carstens <heiko.carstens@de.ibm.com>2009-01-14 08:15:18 -0500
commit6673e0c3fbeaed2cd08e2fd4a4aa97382d6fedb0 (patch)
treeeb33a94f5e4b0e035001f7c96ef44cade0fbb489 /fs/open.c
parented6bb6194350dc6ae97a65dbf2d621a3dbe6bbe9 (diff)
[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>
Diffstat (limited to 'fs/open.c')
-rw-r--r--fs/open.c27
1 files changed, 24 insertions, 3 deletions
diff --git a/fs/open.c b/fs/open.c
index d882fd2351d6..e349013fc790 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -351,21 +351,35 @@ asmlinkage long sys_ftruncate(unsigned int fd, unsigned long length)
351 351
352/* LFS versions of truncate are only needed on 32 bit machines */ 352/* LFS versions of truncate are only needed on 32 bit machines */
353#if BITS_PER_LONG == 32 353#if BITS_PER_LONG == 32
354asmlinkage long sys_truncate64(const char __user * path, loff_t length) 354SYSCALL_DEFINE(truncate64)(const char __user * path, loff_t length)
355{ 355{
356 return do_sys_truncate(path, length); 356 return do_sys_truncate(path, length);
357} 357}
358#ifdef CONFIG_HAVE_SYSCALL_WRAPPERS
359asmlinkage long SyS_truncate64(long path, loff_t length)
360{
361 return SYSC_truncate64((const char __user *) path, length);
362}
363SYSCALL_ALIAS(sys_truncate64, SyS_truncate64);
364#endif
358 365
359asmlinkage long sys_ftruncate64(unsigned int fd, loff_t length) 366SYSCALL_DEFINE(ftruncate64)(unsigned int fd, loff_t length)
360{ 367{
361 long ret = do_sys_ftruncate(fd, length, 0); 368 long ret = do_sys_ftruncate(fd, length, 0);
362 /* avoid REGPARM breakage on x86: */ 369 /* avoid REGPARM breakage on x86: */
363 asmlinkage_protect(2, ret, fd, length); 370 asmlinkage_protect(2, ret, fd, length);
364 return ret; 371 return ret;
365} 372}
373#ifdef CONFIG_HAVE_SYSCALL_WRAPPERS
374asmlinkage long SyS_ftruncate64(long fd, loff_t length)
375{
376 return SYSC_ftruncate64((unsigned int) fd, length);
377}
378SYSCALL_ALIAS(sys_ftruncate64, SyS_ftruncate64);
366#endif 379#endif
380#endif /* BITS_PER_LONG == 32 */
367 381
368asmlinkage long sys_fallocate(int fd, int mode, loff_t offset, loff_t len) 382SYSCALL_DEFINE(fallocate)(int fd, int mode, loff_t offset, loff_t len)
369{ 383{
370 struct file *file; 384 struct file *file;
371 struct inode *inode; 385 struct inode *inode;
@@ -422,6 +436,13 @@ out_fput:
422out: 436out:
423 return ret; 437 return ret;
424} 438}
439#ifdef CONFIG_HAVE_SYSCALL_WRAPPERS
440asmlinkage long SyS_fallocate(long fd, long mode, loff_t offset, loff_t len)
441{
442 return SYSC_fallocate((int)fd, (int)mode, offset, len);
443}
444SYSCALL_ALIAS(sys_fallocate, SyS_fallocate);
445#endif
425 446
426/* 447/*
427 * access() needs to use the real uid/gid, not the effective uid/gid. 448 * access() needs to use the real uid/gid, not the effective uid/gid.