diff options
| author | Linus Torvalds <torvalds@penguin.transmeta.com> | 2003-05-12 00:35:23 -0700 |
|---|---|---|
| committer | Linus Torvalds <torvalds@home.transmeta.com> | 2003-05-12 00:35:23 -0700 |
| commit | d92cfbf0a196a0c4400812d153f9678727565b85 (patch) | |
| tree | c72dbac45369fcbae2eef9adf168fd12be63fd09 /include | |
| parent | 20ca5ae1731f3ef64930624a10a0e673aa88d085 (diff) | |
Add user pointer annotations to socket, file IO and signal
handling.
This pointed out a bug in x86 sys_rt_sigreturn(), btw.
Diffstat (limited to 'include')
| -rw-r--r-- | include/asm-generic/rmap.h | 2 | ||||
| -rw-r--r-- | include/linux/capability.h | 5 | ||||
| -rw-r--r-- | include/linux/fs.h | 10 | ||||
| -rw-r--r-- | include/linux/futex.h | 2 | ||||
| -rw-r--r-- | include/linux/net.h | 12 | ||||
| -rw-r--r-- | include/linux/pagemap.h | 8 | ||||
| -rw-r--r-- | include/linux/ptrace.h | 4 | ||||
| -rw-r--r-- | include/linux/sched.h | 8 | ||||
| -rw-r--r-- | include/linux/signal.h | 2 | ||||
| -rw-r--r-- | include/linux/socket.h | 9 | ||||
| -rw-r--r-- | include/net/compat.h | 2 |
11 files changed, 33 insertions, 31 deletions
diff --git a/include/asm-generic/rmap.h b/include/asm-generic/rmap.h index 5932b91fa2e7..7de7730e9cc3 100644 --- a/include/asm-generic/rmap.h +++ b/include/asm-generic/rmap.h @@ -61,7 +61,7 @@ static inline unsigned long ptep_to_address(pte_t * ptep) return page->index + low_bits; } -#if CONFIG_HIGHPTE +#ifdef CONFIG_HIGHPTE static inline pte_addr_t ptep_to_paddr(pte_t *ptep) { pte_addr_t paddr; diff --git a/include/linux/capability.h b/include/linux/capability.h index d48177f16b69..c96e7b624fce 100644 --- a/include/linux/capability.h +++ b/include/linux/capability.h @@ -14,6 +14,7 @@ #define _LINUX_CAPABILITY_H #include <linux/types.h> +#include <linux/compiler.h> /* User-level do most of the mapping between kernel and user capabilities based on the version tag given by the kernel. The @@ -31,13 +32,13 @@ typedef struct __user_cap_header_struct { __u32 version; int pid; -} *cap_user_header_t; +} __user *cap_user_header_t; typedef struct __user_cap_data_struct { __u32 effective; __u32 permitted; __u32 inheritable; -} *cap_user_data_t; +} __user *cap_user_data_t; #ifdef __KERNEL__ diff --git a/include/linux/fs.h b/include/linux/fs.h index 8d618555e772..6433033ad2b5 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -691,7 +691,7 @@ struct block_device_operations { typedef struct { size_t written; size_t count; - char * buf; + char __user * buf; int error; } read_descriptor_t; @@ -722,7 +722,7 @@ struct file_operations { int (*lock) (struct file *, int, struct file_lock *); ssize_t (*readv) (struct file *, const struct iovec *, unsigned long, loff_t *); ssize_t (*writev) (struct file *, const struct iovec *, unsigned long, loff_t *); - ssize_t (*sendfile) (struct file *, loff_t *, size_t, read_actor_t, void *); + ssize_t (*sendfile) (struct file *, loff_t *, size_t, read_actor_t, void __user *); ssize_t (*sendpage) (struct file *, struct page *, int, size_t, loff_t *, int); unsigned long (*get_unmapped_area)(struct file *, unsigned long, unsigned long, unsigned long, unsigned long); }; @@ -1207,15 +1207,15 @@ extern ssize_t generic_file_read(struct file *, char __user *, size_t, loff_t *) int generic_write_checks(struct inode *inode, struct file *file, loff_t *pos, size_t *count, int isblk); extern ssize_t generic_file_write(struct file *, const char __user *, size_t, loff_t *); -extern ssize_t generic_file_aio_read(struct kiocb *, char *, size_t, loff_t); -extern ssize_t generic_file_aio_write(struct kiocb *, const char *, size_t, loff_t); +extern ssize_t generic_file_aio_read(struct kiocb *, char __user *, size_t, loff_t); +extern ssize_t generic_file_aio_write(struct kiocb *, const char __user *, size_t, loff_t); extern ssize_t generic_file_aio_write_nolock(struct kiocb *, const struct iovec *, unsigned long, loff_t *); extern ssize_t do_sync_read(struct file *filp, char __user *buf, size_t len, loff_t *ppos); extern ssize_t do_sync_write(struct file *filp, const char __user *buf, size_t len, loff_t *ppos); ssize_t generic_file_write_nolock(struct file *file, const struct iovec *iov, unsigned long nr_segs, loff_t *ppos); -extern ssize_t generic_file_sendfile(struct file *, loff_t *, size_t, read_actor_t, void *); +extern ssize_t generic_file_sendfile(struct file *, loff_t *, size_t, read_actor_t, void __user *); extern void do_generic_mapping_read(struct address_space *, struct file_ra_state *, struct file *, loff_t *, read_descriptor_t *, read_actor_t); extern void diff --git a/include/linux/futex.h b/include/linux/futex.h index 5120f5fb84cd..b91878c07352 100644 --- a/include/linux/futex.h +++ b/include/linux/futex.h @@ -6,6 +6,6 @@ #define FUTEX_WAKE (1) #define FUTEX_FD (2) -extern asmlinkage long sys_futex(u32 *uaddr, int op, int val, struct timespec *utime); +extern asmlinkage long sys_futex(u32 __user *uaddr, int op, int val, struct timespec __user *utime); #endif diff --git a/include/linux/net.h b/include/linux/net.h index 04bd681473db..9101b7dcec92 100644 --- a/include/linux/net.h +++ b/include/linux/net.h @@ -96,18 +96,18 @@ struct proto_ops { struct module *owner; int (*release) (struct socket *sock); int (*bind) (struct socket *sock, - struct sockaddr *umyaddr, + struct sockaddr *myaddr, int sockaddr_len); int (*connect) (struct socket *sock, - struct sockaddr *uservaddr, + struct sockaddr *vaddr, int sockaddr_len, int flags); int (*socketpair)(struct socket *sock1, struct socket *sock2); int (*accept) (struct socket *sock, struct socket *newsock, int flags); int (*getname) (struct socket *sock, - struct sockaddr *uaddr, - int *usockaddr_len, int peer); + struct sockaddr *addr, + int *sockaddr_len, int peer); unsigned int (*poll) (struct file *file, struct socket *sock, struct poll_table_struct *wait); int (*ioctl) (struct socket *sock, unsigned int cmd, @@ -115,9 +115,9 @@ struct proto_ops { int (*listen) (struct socket *sock, int len); int (*shutdown) (struct socket *sock, int flags); int (*setsockopt)(struct socket *sock, int level, - int optname, char *optval, int optlen); + int optname, char __user *optval, int optlen); int (*getsockopt)(struct socket *sock, int level, - int optname, char *optval, int *optlen); + int optname, char __user *optval, int __user *optlen); int (*sendmsg) (struct kiocb *iocb, struct socket *sock, struct msghdr *m, int total_len); int (*recvmsg) (struct kiocb *iocb, struct socket *sock, diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h index 3d6822ebc05e..c1edd5e720e1 100644 --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h @@ -172,7 +172,7 @@ extern void end_page_writeback(struct page *page); * This assumes that two userspace pages are always sufficient. That's * not true if PAGE_CACHE_SIZE > PAGE_SIZE. */ -static inline int fault_in_pages_writeable(char *uaddr, int size) +static inline int fault_in_pages_writeable(char __user *uaddr, int size) { int ret; @@ -182,7 +182,7 @@ static inline int fault_in_pages_writeable(char *uaddr, int size) */ ret = __put_user(0, uaddr); if (ret == 0) { - char *end = uaddr + size - 1; + char __user *end = uaddr + size - 1; /* * If the page was already mapped, this will get a cache miss @@ -195,14 +195,14 @@ static inline int fault_in_pages_writeable(char *uaddr, int size) return ret; } -static inline void fault_in_pages_readable(const char *uaddr, int size) +static inline void fault_in_pages_readable(const char __user *uaddr, int size) { volatile char c; int ret; ret = __get_user(c, (char *)uaddr); if (ret == 0) { - const char *end = uaddr + size - 1; + const char __user *end = uaddr + size - 1; if (((unsigned long)uaddr & PAGE_MASK) != ((unsigned long)end & PAGE_MASK)) diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h index 5d44a953f423..6484d095c6a8 100644 --- a/include/linux/ptrace.h +++ b/include/linux/ptrace.h @@ -69,8 +69,8 @@ #include <linux/compiler.h> /* For unlikely. */ #include <linux/sched.h> /* For struct task_struct. */ -extern int ptrace_readdata(struct task_struct *tsk, unsigned long src, char *dst, int len); -extern int ptrace_writedata(struct task_struct *tsk, char * src, unsigned long dst, int len); +extern int ptrace_readdata(struct task_struct *tsk, unsigned long src, char __user *dst, int len); +extern int ptrace_writedata(struct task_struct *tsk, char __user *src, unsigned long dst, int len); extern int ptrace_attach(struct task_struct *tsk); extern int ptrace_detach(struct task_struct *, unsigned int); extern void ptrace_disable(struct task_struct *); diff --git a/include/linux/sched.h b/include/linux/sched.h index 01ea66352c74..7810a835396c 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -371,8 +371,8 @@ struct task_struct { wait_queue_head_t wait_chldexit; /* for wait4() */ struct completion *vfork_done; /* for vfork() */ - int *set_child_tid; /* CLONE_CHILD_SETTID */ - int *clear_child_tid; /* CLONE_CHILD_CLEARTID */ + int __user *set_child_tid; /* CLONE_CHILD_SETTID */ + int __user *clear_child_tid; /* CLONE_CHILD_CLEARTID */ unsigned long rt_priority; unsigned long it_real_value, it_prof_value, it_virt_value; @@ -563,7 +563,7 @@ extern int kill_pg(pid_t, int, int); extern int kill_sl(pid_t, int, int); extern int kill_proc(pid_t, int, int); extern int do_sigaction(int, const struct k_sigaction *, struct k_sigaction *); -extern int do_sigaltstack(const stack_t *, stack_t *, unsigned long); +extern int do_sigaltstack(const stack_t __user *, stack_t __user *, unsigned long); /* These can be the second arg to send_sig_info/send_group_sig_info. */ #define SEND_SIG_NOINFO ((struct siginfo *) 0) @@ -636,7 +636,7 @@ extern int allow_signal(int); extern task_t *child_reaper; extern int do_execve(char *, char __user * __user *, char __user * __user *, struct pt_regs *); -extern struct task_struct *do_fork(unsigned long, unsigned long, struct pt_regs *, unsigned long, int *, int *); +extern struct task_struct *do_fork(unsigned long, unsigned long, struct pt_regs *, unsigned long, int __user *, int __user *); #ifdef CONFIG_SMP extern void wait_task_inactive(task_t * p); diff --git a/include/linux/signal.h b/include/linux/signal.h index 466a7a8ae77a..b4ccbda41c4a 100644 --- a/include/linux/signal.h +++ b/include/linux/signal.h @@ -201,7 +201,7 @@ static inline void init_sigpending(struct sigpending *sig) sig->tail = &sig->head; } -extern long do_sigpending(void *, unsigned long); +extern long do_sigpending(void __user *, unsigned long); extern int sigprocmask(int, sigset_t *, sigset_t *); #ifndef HAVE_ARCH_GET_SIGNAL_TO_DELIVER diff --git a/include/linux/socket.h b/include/linux/socket.h index b06bf38ef2d2..72b8b6fa3d96 100644 --- a/include/linux/socket.h +++ b/include/linux/socket.h @@ -9,6 +9,7 @@ #include <linux/sockios.h> /* the SIOCxxx I/O controls */ #include <linux/uio.h> /* iovec support */ #include <linux/types.h> /* pid_t */ +#include <linux/compiler.h> /* __user */ typedef unsigned short sa_family_t; @@ -242,8 +243,8 @@ struct ucred { #define MSG_CMSG_COMPAT 0 /* We never have 32 bit fixups */ #endif -extern asmlinkage long sys_sendmsg(int fd, struct msghdr *msg, unsigned flags); -extern asmlinkage long sys_recvmsg(int fd, struct msghdr *msg, unsigned flags); +extern asmlinkage long sys_sendmsg(int fd, struct msghdr __user *msg, unsigned flags); +extern asmlinkage long sys_recvmsg(int fd, struct msghdr __user *msg, unsigned flags); @@ -285,8 +286,8 @@ extern int csum_partial_copy_fromiovecend(unsigned char *kdata, extern int verify_iovec(struct msghdr *m, struct iovec *iov, char *address, int mode); extern int memcpy_toiovec(struct iovec *v, unsigned char *kdata, int len); extern void memcpy_tokerneliovec(struct iovec *iov, unsigned char *kdata, int len); -extern int move_addr_to_user(void *kaddr, int klen, void *uaddr, int *ulen); -extern int move_addr_to_kernel(void *uaddr, int ulen, void *kaddr); +extern int move_addr_to_user(void *kaddr, int klen, void __user *uaddr, int __user *ulen); +extern int move_addr_to_kernel(void __user *uaddr, int ulen, void *kaddr); extern int put_cmsg(struct msghdr*, int level, int type, int len, void *data); #endif diff --git a/include/net/compat.h b/include/net/compat.h index 461e1a725797..b1635413568e 100644 --- a/include/net/compat.h +++ b/include/net/compat.h @@ -27,7 +27,7 @@ struct compat_cmsghdr { #define compat_msghdr msghdr /* to avoid compiler warnings */ #endif /* defined(CONFIG_COMPAT) */ -extern int get_compat_msghdr(struct msghdr *, struct compat_msghdr *); +extern int get_compat_msghdr(struct msghdr *, struct compat_msghdr __user *); extern int verify_compat_iovec(struct msghdr *, struct iovec *, char *, int); extern asmlinkage long compat_sys_sendmsg(int,struct compat_msghdr *,unsigned); extern asmlinkage long compat_sys_recvmsg(int,struct compat_msghdr *,unsigned); |
