Commit 43c2489b authored by Linus Torvalds's avatar Linus Torvalds

Annotate fs/exec.c with user pointer annotations.

parent c9a6bc45
...@@ -164,13 +164,13 @@ asmlinkage long sys_uselib(const char * library) ...@@ -164,13 +164,13 @@ asmlinkage long sys_uselib(const char * library)
/* /*
* count() counts the number of strings in array ARGV. * count() counts the number of strings in array ARGV.
*/ */
static int count(char ** argv, int max) static int count(char __user * __user * argv, int max)
{ {
int i = 0; int i = 0;
if (argv != NULL) { if (argv != NULL) {
for (;;) { for (;;) {
char * p; char __user * p;
if (get_user(p, argv)) if (get_user(p, argv))
return -EFAULT; return -EFAULT;
...@@ -189,14 +189,14 @@ static int count(char ** argv, int max) ...@@ -189,14 +189,14 @@ static int count(char ** argv, int max)
* memory to free pages in kernel mem. These are in a format ready * memory to free pages in kernel mem. These are in a format ready
* to be put directly into the top of new user memory. * to be put directly into the top of new user memory.
*/ */
int copy_strings(int argc,char ** argv, struct linux_binprm *bprm) int copy_strings(int argc,char __user * __user * argv, struct linux_binprm *bprm)
{ {
struct page *kmapped_page = NULL; struct page *kmapped_page = NULL;
char *kaddr = NULL; char *kaddr = NULL;
int ret; int ret;
while (argc-- > 0) { while (argc-- > 0) {
char *str; char __user *str;
int len; int len;
unsigned long pos; unsigned long pos;
...@@ -275,7 +275,7 @@ int copy_strings_kernel(int argc,char ** argv, struct linux_binprm *bprm) ...@@ -275,7 +275,7 @@ int copy_strings_kernel(int argc,char ** argv, struct linux_binprm *bprm)
int r; int r;
mm_segment_t oldfs = get_fs(); mm_segment_t oldfs = get_fs();
set_fs(KERNEL_DS); set_fs(KERNEL_DS);
r = copy_strings(argc, argv, bprm); r = copy_strings(argc, (char __user * __user *)argv, bprm);
set_fs(oldfs); set_fs(oldfs);
return r; return r;
} }
...@@ -1050,7 +1050,10 @@ int search_binary_handler(struct linux_binprm *bprm,struct pt_regs *regs) ...@@ -1050,7 +1050,10 @@ int search_binary_handler(struct linux_binprm *bprm,struct pt_regs *regs)
/* /*
* sys_execve() executes a new program. * sys_execve() executes a new program.
*/ */
int do_execve(char * filename, char ** argv, char ** envp, struct pt_regs * regs) int do_execve(char * filename,
char __user *__user *argv,
char __user *__user *envp,
struct pt_regs * regs)
{ {
struct linux_binprm bprm; struct linux_binprm bprm;
struct file *file; struct file *file;
......
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