Commit 2ed7c03e authored by Heiko Carstens's avatar Heiko Carstens

[CVE-2009-0029] Convert all system calls to return a long

Convert all system calls to return a long. This should be a NOP since all
converted types should have the same size anyway.
With the exception of sys_exit_group which returned void. But that doesn't
matter since the system call doesn't return.
Signed-off-by: default avatarHeiko Carstens <heiko.carstens@de.ibm.com>
parent 4c696ba7
...@@ -147,7 +147,7 @@ loff_t vfs_llseek(struct file *file, loff_t offset, int origin) ...@@ -147,7 +147,7 @@ loff_t vfs_llseek(struct file *file, loff_t offset, int origin)
} }
EXPORT_SYMBOL(vfs_llseek); EXPORT_SYMBOL(vfs_llseek);
asmlinkage off_t sys_lseek(unsigned int fd, off_t offset, unsigned int origin) asmlinkage long sys_lseek(unsigned int fd, off_t offset, unsigned int origin)
{ {
off_t retval; off_t retval;
struct file * file; struct file * file;
...@@ -369,7 +369,7 @@ static inline void file_pos_write(struct file *file, loff_t pos) ...@@ -369,7 +369,7 @@ static inline void file_pos_write(struct file *file, loff_t pos)
file->f_pos = pos; file->f_pos = pos;
} }
asmlinkage ssize_t sys_read(unsigned int fd, char __user * buf, size_t count) asmlinkage long sys_read(unsigned int fd, char __user * buf, size_t count)
{ {
struct file *file; struct file *file;
ssize_t ret = -EBADF; ssize_t ret = -EBADF;
...@@ -386,7 +386,7 @@ asmlinkage ssize_t sys_read(unsigned int fd, char __user * buf, size_t count) ...@@ -386,7 +386,7 @@ asmlinkage ssize_t sys_read(unsigned int fd, char __user * buf, size_t count)
return ret; return ret;
} }
asmlinkage ssize_t sys_write(unsigned int fd, const char __user * buf, size_t count) asmlinkage long sys_write(unsigned int fd, const char __user * buf, size_t count)
{ {
struct file *file; struct file *file;
ssize_t ret = -EBADF; ssize_t ret = -EBADF;
...@@ -403,7 +403,7 @@ asmlinkage ssize_t sys_write(unsigned int fd, const char __user * buf, size_t co ...@@ -403,7 +403,7 @@ asmlinkage ssize_t sys_write(unsigned int fd, const char __user * buf, size_t co
return ret; return ret;
} }
asmlinkage ssize_t sys_pread64(unsigned int fd, char __user *buf, asmlinkage long sys_pread64(unsigned int fd, char __user *buf,
size_t count, loff_t pos) size_t count, loff_t pos)
{ {
struct file *file; struct file *file;
...@@ -424,7 +424,7 @@ asmlinkage ssize_t sys_pread64(unsigned int fd, char __user *buf, ...@@ -424,7 +424,7 @@ asmlinkage ssize_t sys_pread64(unsigned int fd, char __user *buf,
return ret; return ret;
} }
asmlinkage ssize_t sys_pwrite64(unsigned int fd, const char __user *buf, asmlinkage long sys_pwrite64(unsigned int fd, const char __user *buf,
size_t count, loff_t pos) size_t count, loff_t pos)
{ {
struct file *file; struct file *file;
...@@ -672,7 +672,7 @@ ssize_t vfs_writev(struct file *file, const struct iovec __user *vec, ...@@ -672,7 +672,7 @@ ssize_t vfs_writev(struct file *file, const struct iovec __user *vec,
EXPORT_SYMBOL(vfs_writev); EXPORT_SYMBOL(vfs_writev);
asmlinkage ssize_t asmlinkage long
sys_readv(unsigned long fd, const struct iovec __user *vec, unsigned long vlen) sys_readv(unsigned long fd, const struct iovec __user *vec, unsigned long vlen)
{ {
struct file *file; struct file *file;
...@@ -693,7 +693,7 @@ sys_readv(unsigned long fd, const struct iovec __user *vec, unsigned long vlen) ...@@ -693,7 +693,7 @@ sys_readv(unsigned long fd, const struct iovec __user *vec, unsigned long vlen)
return ret; return ret;
} }
asmlinkage ssize_t asmlinkage long
sys_writev(unsigned long fd, const struct iovec __user *vec, unsigned long vlen) sys_writev(unsigned long fd, const struct iovec __user *vec, unsigned long vlen)
{ {
struct file *file; struct file *file;
...@@ -812,7 +812,7 @@ static ssize_t do_sendfile(int out_fd, int in_fd, loff_t *ppos, ...@@ -812,7 +812,7 @@ static ssize_t do_sendfile(int out_fd, int in_fd, loff_t *ppos,
return retval; return retval;
} }
asmlinkage ssize_t sys_sendfile(int out_fd, int in_fd, off_t __user *offset, size_t count) asmlinkage long sys_sendfile(int out_fd, int in_fd, off_t __user *offset, size_t count)
{ {
loff_t pos; loff_t pos;
off_t off; off_t off;
...@@ -831,7 +831,7 @@ asmlinkage ssize_t sys_sendfile(int out_fd, int in_fd, off_t __user *offset, siz ...@@ -831,7 +831,7 @@ asmlinkage ssize_t sys_sendfile(int out_fd, int in_fd, off_t __user *offset, siz
return do_sendfile(out_fd, in_fd, NULL, count, 0); return do_sendfile(out_fd, in_fd, NULL, count, 0);
} }
asmlinkage ssize_t sys_sendfile64(int out_fd, int in_fd, loff_t __user *offset, size_t count) asmlinkage long sys_sendfile64(int out_fd, int in_fd, loff_t __user *offset, size_t count)
{ {
loff_t pos; loff_t pos;
ssize_t ret; ssize_t ret;
......
...@@ -349,7 +349,7 @@ getxattr(struct dentry *d, const char __user *name, void __user *value, ...@@ -349,7 +349,7 @@ getxattr(struct dentry *d, const char __user *name, void __user *value,
return error; return error;
} }
asmlinkage ssize_t asmlinkage long
sys_getxattr(const char __user *pathname, const char __user *name, sys_getxattr(const char __user *pathname, const char __user *name,
void __user *value, size_t size) void __user *value, size_t size)
{ {
...@@ -364,7 +364,7 @@ sys_getxattr(const char __user *pathname, const char __user *name, ...@@ -364,7 +364,7 @@ sys_getxattr(const char __user *pathname, const char __user *name,
return error; return error;
} }
asmlinkage ssize_t asmlinkage long
sys_lgetxattr(const char __user *pathname, const char __user *name, void __user *value, sys_lgetxattr(const char __user *pathname, const char __user *name, void __user *value,
size_t size) size_t size)
{ {
...@@ -379,7 +379,7 @@ sys_lgetxattr(const char __user *pathname, const char __user *name, void __user ...@@ -379,7 +379,7 @@ sys_lgetxattr(const char __user *pathname, const char __user *name, void __user
return error; return error;
} }
asmlinkage ssize_t asmlinkage long
sys_fgetxattr(int fd, const char __user *name, void __user *value, size_t size) sys_fgetxattr(int fd, const char __user *name, void __user *value, size_t size)
{ {
struct file *f; struct file *f;
...@@ -424,7 +424,7 @@ listxattr(struct dentry *d, char __user *list, size_t size) ...@@ -424,7 +424,7 @@ listxattr(struct dentry *d, char __user *list, size_t size)
return error; return error;
} }
asmlinkage ssize_t asmlinkage long
sys_listxattr(const char __user *pathname, char __user *list, size_t size) sys_listxattr(const char __user *pathname, char __user *list, size_t size)
{ {
struct path path; struct path path;
...@@ -438,7 +438,7 @@ sys_listxattr(const char __user *pathname, char __user *list, size_t size) ...@@ -438,7 +438,7 @@ sys_listxattr(const char __user *pathname, char __user *list, size_t size)
return error; return error;
} }
asmlinkage ssize_t asmlinkage long
sys_llistxattr(const char __user *pathname, char __user *list, size_t size) sys_llistxattr(const char __user *pathname, char __user *list, size_t size)
{ {
struct path path; struct path path;
...@@ -452,7 +452,7 @@ sys_llistxattr(const char __user *pathname, char __user *list, size_t size) ...@@ -452,7 +452,7 @@ sys_llistxattr(const char __user *pathname, char __user *list, size_t size)
return error; return error;
} }
asmlinkage ssize_t asmlinkage long
sys_flistxattr(int fd, char __user *list, size_t size) sys_flistxattr(int fd, char __user *list, size_t size)
{ {
struct file *f; struct file *f;
......
...@@ -77,7 +77,7 @@ asmlinkage long sys_times(struct tms __user *tbuf); ...@@ -77,7 +77,7 @@ asmlinkage long sys_times(struct tms __user *tbuf);
asmlinkage long sys_gettid(void); asmlinkage long sys_gettid(void);
asmlinkage long sys_nanosleep(struct timespec __user *rqtp, struct timespec __user *rmtp); asmlinkage long sys_nanosleep(struct timespec __user *rqtp, struct timespec __user *rmtp);
asmlinkage unsigned long sys_alarm(unsigned int seconds); asmlinkage long sys_alarm(unsigned int seconds);
asmlinkage long sys_getpid(void); asmlinkage long sys_getpid(void);
asmlinkage long sys_getppid(void); asmlinkage long sys_getppid(void);
asmlinkage long sys_getuid(void); asmlinkage long sys_getuid(void);
...@@ -166,7 +166,7 @@ asmlinkage long sys_kexec_load(unsigned long entry, unsigned long nr_segments, ...@@ -166,7 +166,7 @@ asmlinkage long sys_kexec_load(unsigned long entry, unsigned long nr_segments,
unsigned long flags); unsigned long flags);
asmlinkage long sys_exit(int error_code); asmlinkage long sys_exit(int error_code);
asmlinkage void sys_exit_group(int error_code); asmlinkage long sys_exit_group(int error_code);
asmlinkage long sys_wait4(pid_t pid, int __user *stat_addr, asmlinkage long sys_wait4(pid_t pid, int __user *stat_addr,
int options, struct rusage __user *ru); int options, struct rusage __user *ru);
asmlinkage long sys_waitid(int which, pid_t pid, asmlinkage long sys_waitid(int which, pid_t pid,
...@@ -196,7 +196,7 @@ asmlinkage long sys_tkill(int pid, int sig); ...@@ -196,7 +196,7 @@ asmlinkage long sys_tkill(int pid, int sig);
asmlinkage long sys_rt_sigqueueinfo(int pid, int sig, siginfo_t __user *uinfo); asmlinkage long sys_rt_sigqueueinfo(int pid, int sig, siginfo_t __user *uinfo);
asmlinkage long sys_sgetmask(void); asmlinkage long sys_sgetmask(void);
asmlinkage long sys_ssetmask(int newmask); asmlinkage long sys_ssetmask(int newmask);
asmlinkage unsigned long sys_signal(int sig, __sighandler_t handler); asmlinkage long sys_signal(int sig, __sighandler_t handler);
asmlinkage long sys_pause(void); asmlinkage long sys_pause(void);
asmlinkage long sys_sync(void); asmlinkage long sys_sync(void);
...@@ -246,29 +246,29 @@ asmlinkage long sys_lsetxattr(const char __user *path, const char __user *name, ...@@ -246,29 +246,29 @@ asmlinkage long sys_lsetxattr(const char __user *path, const char __user *name,
const void __user *value, size_t size, int flags); const void __user *value, size_t size, int flags);
asmlinkage long sys_fsetxattr(int fd, const char __user *name, asmlinkage long sys_fsetxattr(int fd, const char __user *name,
const void __user *value, size_t size, int flags); const void __user *value, size_t size, int flags);
asmlinkage ssize_t sys_getxattr(const char __user *path, const char __user *name, asmlinkage long sys_getxattr(const char __user *path, const char __user *name,
void __user *value, size_t size); void __user *value, size_t size);
asmlinkage ssize_t sys_lgetxattr(const char __user *path, const char __user *name, asmlinkage long sys_lgetxattr(const char __user *path, const char __user *name,
void __user *value, size_t size); void __user *value, size_t size);
asmlinkage ssize_t sys_fgetxattr(int fd, const char __user *name, asmlinkage long sys_fgetxattr(int fd, const char __user *name,
void __user *value, size_t size); void __user *value, size_t size);
asmlinkage ssize_t sys_listxattr(const char __user *path, char __user *list, asmlinkage long sys_listxattr(const char __user *path, char __user *list,
size_t size); size_t size);
asmlinkage ssize_t sys_llistxattr(const char __user *path, char __user *list, asmlinkage long sys_llistxattr(const char __user *path, char __user *list,
size_t size); size_t size);
asmlinkage ssize_t sys_flistxattr(int fd, char __user *list, size_t size); asmlinkage long sys_flistxattr(int fd, char __user *list, size_t size);
asmlinkage long sys_removexattr(const char __user *path, asmlinkage long sys_removexattr(const char __user *path,
const char __user *name); const char __user *name);
asmlinkage long sys_lremovexattr(const char __user *path, asmlinkage long sys_lremovexattr(const char __user *path,
const char __user *name); const char __user *name);
asmlinkage long sys_fremovexattr(int fd, const char __user *name); asmlinkage long sys_fremovexattr(int fd, const char __user *name);
asmlinkage unsigned long sys_brk(unsigned long brk); asmlinkage long sys_brk(unsigned long brk);
asmlinkage long sys_mprotect(unsigned long start, size_t len, asmlinkage long sys_mprotect(unsigned long start, size_t len,
unsigned long prot); unsigned long prot);
asmlinkage unsigned long sys_mremap(unsigned long addr, asmlinkage long sys_mremap(unsigned long addr,
unsigned long old_len, unsigned long new_len, unsigned long old_len, unsigned long new_len,
unsigned long flags, unsigned long new_addr); unsigned long flags, unsigned long new_addr);
asmlinkage long sys_remap_file_pages(unsigned long start, unsigned long size, asmlinkage long sys_remap_file_pages(unsigned long start, unsigned long size,
unsigned long prot, unsigned long pgoff, unsigned long prot, unsigned long pgoff,
unsigned long flags); unsigned long flags);
...@@ -321,10 +321,10 @@ asmlinkage long sys_io_submit(aio_context_t, long, ...@@ -321,10 +321,10 @@ asmlinkage long sys_io_submit(aio_context_t, long,
struct iocb __user * __user *); struct iocb __user * __user *);
asmlinkage long sys_io_cancel(aio_context_t ctx_id, struct iocb __user *iocb, asmlinkage long sys_io_cancel(aio_context_t ctx_id, struct iocb __user *iocb,
struct io_event __user *result); struct io_event __user *result);
asmlinkage ssize_t sys_sendfile(int out_fd, int in_fd, asmlinkage long sys_sendfile(int out_fd, int in_fd,
off_t __user *offset, size_t count); off_t __user *offset, size_t count);
asmlinkage ssize_t sys_sendfile64(int out_fd, int in_fd, asmlinkage long sys_sendfile64(int out_fd, int in_fd,
loff_t __user *offset, size_t count); loff_t __user *offset, size_t count);
asmlinkage long sys_readlink(const char __user *path, asmlinkage long sys_readlink(const char __user *path,
char __user *buf, int bufsiz); char __user *buf, int bufsiz);
asmlinkage long sys_creat(const char __user *pathname, int mode); asmlinkage long sys_creat(const char __user *pathname, int mode);
...@@ -368,26 +368,25 @@ asmlinkage long sys_utime(char __user *filename, ...@@ -368,26 +368,25 @@ asmlinkage long sys_utime(char __user *filename,
struct utimbuf __user *times); struct utimbuf __user *times);
asmlinkage long sys_utimes(char __user *filename, asmlinkage long sys_utimes(char __user *filename,
struct timeval __user *utimes); struct timeval __user *utimes);
asmlinkage off_t sys_lseek(unsigned int fd, off_t offset, asmlinkage long sys_lseek(unsigned int fd, off_t offset,
unsigned int origin); unsigned int origin);
asmlinkage long sys_llseek(unsigned int fd, unsigned long offset_high, asmlinkage long sys_llseek(unsigned int fd, unsigned long offset_high,
unsigned long offset_low, loff_t __user *result, unsigned long offset_low, loff_t __user *result,
unsigned int origin); unsigned int origin);
asmlinkage ssize_t sys_read(unsigned int fd, char __user *buf, asmlinkage long sys_read(unsigned int fd, char __user *buf, size_t count);
size_t count); asmlinkage long sys_readahead(int fd, loff_t offset, size_t count);
asmlinkage ssize_t sys_readahead(int fd, loff_t offset, size_t count); asmlinkage long sys_readv(unsigned long fd,
asmlinkage ssize_t sys_readv(unsigned long fd, const struct iovec __user *vec,
const struct iovec __user *vec, unsigned long vlen);
unsigned long vlen); asmlinkage long sys_write(unsigned int fd, const char __user *buf,
asmlinkage ssize_t sys_write(unsigned int fd, const char __user *buf, size_t count);
size_t count); asmlinkage long sys_writev(unsigned long fd,
asmlinkage ssize_t sys_writev(unsigned long fd, const struct iovec __user *vec,
const struct iovec __user *vec, unsigned long vlen);
unsigned long vlen); asmlinkage long sys_pread64(unsigned int fd, char __user *buf,
asmlinkage ssize_t sys_pread64(unsigned int fd, char __user *buf, size_t count, loff_t pos);
size_t count, loff_t pos); asmlinkage long sys_pwrite64(unsigned int fd, const char __user *buf,
asmlinkage ssize_t sys_pwrite64(unsigned int fd, const char __user *buf, size_t count, loff_t pos);
size_t count, loff_t pos);
asmlinkage long sys_getcwd(char __user *buf, unsigned long size); asmlinkage long sys_getcwd(char __user *buf, unsigned long size);
asmlinkage long sys_mkdir(const char __user *pathname, int mode); asmlinkage long sys_mkdir(const char __user *pathname, int mode);
asmlinkage long sys_chdir(const char __user *filename); asmlinkage long sys_chdir(const char __user *filename);
...@@ -476,7 +475,7 @@ asmlinkage long sys_shmctl(int shmid, int cmd, struct shmid_ds __user *buf); ...@@ -476,7 +475,7 @@ asmlinkage long sys_shmctl(int shmid, int cmd, struct shmid_ds __user *buf);
asmlinkage long sys_mq_open(const char __user *name, int oflag, mode_t mode, struct mq_attr __user *attr); asmlinkage long sys_mq_open(const char __user *name, int oflag, mode_t mode, struct mq_attr __user *attr);
asmlinkage long sys_mq_unlink(const char __user *name); asmlinkage long sys_mq_unlink(const char __user *name);
asmlinkage long sys_mq_timedsend(mqd_t mqdes, const char __user *msg_ptr, size_t msg_len, unsigned int msg_prio, const struct timespec __user *abs_timeout); asmlinkage long sys_mq_timedsend(mqd_t mqdes, const char __user *msg_ptr, size_t msg_len, unsigned int msg_prio, const struct timespec __user *abs_timeout);
asmlinkage ssize_t sys_mq_timedreceive(mqd_t mqdes, char __user *msg_ptr, size_t msg_len, unsigned int __user *msg_prio, const struct timespec __user *abs_timeout); asmlinkage long sys_mq_timedreceive(mqd_t mqdes, char __user *msg_ptr, size_t msg_len, unsigned int __user *msg_prio, const struct timespec __user *abs_timeout);
asmlinkage long sys_mq_notify(mqd_t mqdes, const struct sigevent __user *notification); asmlinkage long sys_mq_notify(mqd_t mqdes, const struct sigevent __user *notification);
asmlinkage long sys_mq_getsetattr(mqd_t mqdes, const struct mq_attr __user *mqstat, struct mq_attr __user *omqstat); asmlinkage long sys_mq_getsetattr(mqd_t mqdes, const struct mq_attr __user *mqstat, struct mq_attr __user *omqstat);
......
...@@ -907,7 +907,7 @@ asmlinkage long sys_mq_timedsend(mqd_t mqdes, const char __user *u_msg_ptr, ...@@ -907,7 +907,7 @@ asmlinkage long sys_mq_timedsend(mqd_t mqdes, const char __user *u_msg_ptr,
return ret; return ret;
} }
asmlinkage ssize_t sys_mq_timedreceive(mqd_t mqdes, char __user *u_msg_ptr, asmlinkage long sys_mq_timedreceive(mqd_t mqdes, char __user *u_msg_ptr,
size_t msg_len, unsigned int __user *u_msg_prio, size_t msg_len, unsigned int __user *u_msg_prio,
const struct timespec __user *u_abs_timeout) const struct timespec __user *u_abs_timeout)
{ {
......
...@@ -1182,9 +1182,11 @@ do_group_exit(int exit_code) ...@@ -1182,9 +1182,11 @@ do_group_exit(int exit_code)
* wait4()-ing process will get the correct exit code - even if this * wait4()-ing process will get the correct exit code - even if this
* thread is not the thread group leader. * thread is not the thread group leader.
*/ */
asmlinkage void sys_exit_group(int error_code) asmlinkage long sys_exit_group(int error_code)
{ {
do_group_exit((error_code & 0xff) << 8); do_group_exit((error_code & 0xff) << 8);
/* NOTREACHED */
return 0;
} }
static struct pid *task_pid_type(struct task_struct *task, enum pid_type type) static struct pid *task_pid_type(struct task_struct *task, enum pid_type type)
......
...@@ -2559,7 +2559,7 @@ sys_ssetmask(int newmask) ...@@ -2559,7 +2559,7 @@ sys_ssetmask(int newmask)
/* /*
* For backwards compatibility. Functionality superseded by sigaction. * For backwards compatibility. Functionality superseded by sigaction.
*/ */
asmlinkage unsigned long asmlinkage long
sys_signal(int sig, __sighandler_t handler) sys_signal(int sig, __sighandler_t handler)
{ {
struct k_sigaction new_sa, old_sa; struct k_sigaction new_sa, old_sa;
......
...@@ -1129,7 +1129,7 @@ void do_timer(unsigned long ticks) ...@@ -1129,7 +1129,7 @@ void do_timer(unsigned long ticks)
* For backwards compatibility? This can be done in libc so Alpha * For backwards compatibility? This can be done in libc so Alpha
* and all newer ports shouldn't need it. * and all newer ports shouldn't need it.
*/ */
asmlinkage unsigned long sys_alarm(unsigned int seconds) asmlinkage long sys_alarm(unsigned int seconds)
{ {
return alarm_setitimer(seconds); return alarm_setitimer(seconds);
} }
......
...@@ -1374,7 +1374,7 @@ do_readahead(struct address_space *mapping, struct file *filp, ...@@ -1374,7 +1374,7 @@ do_readahead(struct address_space *mapping, struct file *filp,
return 0; return 0;
} }
asmlinkage ssize_t sys_readahead(int fd, loff_t offset, size_t count) asmlinkage long sys_readahead(int fd, loff_t offset, size_t count)
{ {
ssize_t ret; ssize_t ret;
struct file *file; struct file *file;
......
...@@ -245,7 +245,7 @@ static struct vm_area_struct *remove_vma(struct vm_area_struct *vma) ...@@ -245,7 +245,7 @@ static struct vm_area_struct *remove_vma(struct vm_area_struct *vma)
return next; return next;
} }
asmlinkage unsigned long sys_brk(unsigned long brk) asmlinkage long sys_brk(unsigned long brk)
{ {
unsigned long rlim, retval; unsigned long rlim, retval;
unsigned long newbrk, oldbrk; unsigned long newbrk, oldbrk;
......
...@@ -420,7 +420,7 @@ unsigned long do_mremap(unsigned long addr, ...@@ -420,7 +420,7 @@ unsigned long do_mremap(unsigned long addr,
return ret; return ret;
} }
asmlinkage unsigned long sys_mremap(unsigned long addr, asmlinkage long sys_mremap(unsigned long addr,
unsigned long old_len, unsigned long new_len, unsigned long old_len, unsigned long new_len,
unsigned long flags, unsigned long new_addr) unsigned long flags, unsigned long new_addr)
{ {
......
...@@ -416,7 +416,7 @@ EXPORT_SYMBOL(vm_insert_page); ...@@ -416,7 +416,7 @@ EXPORT_SYMBOL(vm_insert_page);
* to a regular file. in this case, the unmapping will need * to a regular file. in this case, the unmapping will need
* to invoke file system routines that need the global lock. * to invoke file system routines that need the global lock.
*/ */
asmlinkage unsigned long sys_brk(unsigned long brk) asmlinkage long sys_brk(unsigned long brk)
{ {
struct mm_struct *mm = current->mm; struct mm_struct *mm = current->mm;
......
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