aboutsummaryrefslogtreecommitdiffstats
path: root/fs/read_write.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/read_write.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/read_write.c')
-rw-r--r--fs/read_write.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/fs/read_write.c b/fs/read_write.c
index 940367f51f2a..7a8326bc5903 100644
--- a/fs/read_write.c
+++ b/fs/read_write.c
@@ -403,8 +403,8 @@ asmlinkage long sys_write(unsigned int fd, const char __user * buf, size_t count
403 return ret; 403 return ret;
404} 404}
405 405
406asmlinkage long sys_pread64(unsigned int fd, char __user *buf, 406SYSCALL_DEFINE(pread64)(unsigned int fd, char __user *buf,
407 size_t count, loff_t pos) 407 size_t count, loff_t pos)
408{ 408{
409 struct file *file; 409 struct file *file;
410 ssize_t ret = -EBADF; 410 ssize_t ret = -EBADF;
@@ -423,9 +423,17 @@ asmlinkage long sys_pread64(unsigned int fd, char __user *buf,
423 423
424 return ret; 424 return ret;
425} 425}
426#ifdef CONFIG_HAVE_SYSCALL_WRAPPERS
427asmlinkage long SyS_pread64(long fd, long buf, long count, loff_t pos)
428{
429 return SYSC_pread64((unsigned int) fd, (char __user *) buf,
430 (size_t) count, pos);
431}
432SYSCALL_ALIAS(sys_pread64, SyS_pread64);
433#endif
426 434
427asmlinkage long sys_pwrite64(unsigned int fd, const char __user *buf, 435SYSCALL_DEFINE(pwrite64)(unsigned int fd, const char __user *buf,
428 size_t count, loff_t pos) 436 size_t count, loff_t pos)
429{ 437{
430 struct file *file; 438 struct file *file;
431 ssize_t ret = -EBADF; 439 ssize_t ret = -EBADF;
@@ -444,6 +452,14 @@ asmlinkage long sys_pwrite64(unsigned int fd, const char __user *buf,
444 452
445 return ret; 453 return ret;
446} 454}
455#ifdef CONFIG_HAVE_SYSCALL_WRAPPERS
456asmlinkage long SyS_pwrite64(long fd, long buf, long count, loff_t pos)
457{
458 return SYSC_pwrite64((unsigned int) fd, (const char __user *) buf,
459 (size_t) count, pos);
460}
461SYSCALL_ALIAS(sys_pwrite64, SyS_pwrite64);
462#endif
447 463
448/* 464/*
449 * Reduce an iovec's length in-place. Return the resulting number of segments 465 * Reduce an iovec's length in-place. Return the resulting number of segments