diff options
author | David Howells <dhowells@redhat.com> | 2010-08-17 18:52:56 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-08-17 21:07:43 -0400 |
commit | d7627467b7a8dd6944885290a03a07ceb28c10eb (patch) | |
tree | a18c83468418e878cfb2d44e4310d81b8db84ad7 /arch | |
parent | da5cabf80e2433131bf0ed8993abc0f7ea618c73 (diff) |
Make do_execve() take a const filename pointer
Make do_execve() take a const filename pointer so that kernel_execve() compiles
correctly on ARM:
arch/arm/kernel/sys_arm.c:88: warning: passing argument 1 of 'do_execve' discards qualifiers from pointer target type
This also requires the argv and envp arguments to be consted twice, once for
the pointer array and once for the strings the array points to. This is
because do_execve() passes a pointer to the filename (now const) to
copy_strings_kernel(). A simpler alternative would be to cast the filename
pointer in do_execve() when it's passed to copy_strings_kernel().
do_execve() may not change any of the strings it is passed as part of the argv
or envp lists as they are some of them in .rodata, so marking these strings as
const should be fine.
Further kernel_execve() and sys_execve() need to be changed to match.
This has been test built on x86_64, frv, arm and mips.
Signed-off-by: David Howells <dhowells@redhat.com>
Tested-by: Ralf Baechle <ralf@linux-mips.org>
Acked-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch')
40 files changed, 146 insertions, 73 deletions
diff --git a/arch/alpha/kernel/process.c b/arch/alpha/kernel/process.c index 88e608aebc8c..842dba308eab 100644 --- a/arch/alpha/kernel/process.c +++ b/arch/alpha/kernel/process.c | |||
@@ -387,8 +387,9 @@ EXPORT_SYMBOL(dump_elf_task_fp); | |||
387 | * sys_execve() executes a new program. | 387 | * sys_execve() executes a new program. |
388 | */ | 388 | */ |
389 | asmlinkage int | 389 | asmlinkage int |
390 | do_sys_execve(const char __user *ufilename, char __user * __user *argv, | 390 | do_sys_execve(const char __user *ufilename, |
391 | char __user * __user *envp, struct pt_regs *regs) | 391 | const char __user *const __user *argv, |
392 | const char __user *const __user *envp, struct pt_regs *regs) | ||
392 | { | 393 | { |
393 | int error; | 394 | int error; |
394 | char *filename; | 395 | char *filename; |
diff --git a/arch/arm/kernel/sys_arm.c b/arch/arm/kernel/sys_arm.c index 5b7c541a4c63..62e7c61d0342 100644 --- a/arch/arm/kernel/sys_arm.c +++ b/arch/arm/kernel/sys_arm.c | |||
@@ -62,8 +62,9 @@ asmlinkage int sys_vfork(struct pt_regs *regs) | |||
62 | /* sys_execve() executes a new program. | 62 | /* sys_execve() executes a new program. |
63 | * This is called indirectly via a small wrapper | 63 | * This is called indirectly via a small wrapper |
64 | */ | 64 | */ |
65 | asmlinkage int sys_execve(const char __user *filenamei, char __user * __user *argv, | 65 | asmlinkage int sys_execve(const char __user *filenamei, |
66 | char __user * __user *envp, struct pt_regs *regs) | 66 | const char __user *const __user *argv, |
67 | const char __user *const __user *envp, struct pt_regs *regs) | ||
67 | { | 68 | { |
68 | int error; | 69 | int error; |
69 | char * filename; | 70 | char * filename; |
@@ -78,14 +79,17 @@ out: | |||
78 | return error; | 79 | return error; |
79 | } | 80 | } |
80 | 81 | ||
81 | int kernel_execve(const char *filename, char *const argv[], char *const envp[]) | 82 | int kernel_execve(const char *filename, |
83 | const char *const argv[], | ||
84 | const char *const envp[]) | ||
82 | { | 85 | { |
83 | struct pt_regs regs; | 86 | struct pt_regs regs; |
84 | int ret; | 87 | int ret; |
85 | 88 | ||
86 | memset(®s, 0, sizeof(struct pt_regs)); | 89 | memset(®s, 0, sizeof(struct pt_regs)); |
87 | ret = do_execve(filename, (char __user * __user *)argv, | 90 | ret = do_execve(filename, |
88 | (char __user * __user *)envp, ®s); | 91 | (const char __user *const __user *)argv, |
92 | (const char __user *const __user *)envp, ®s); | ||
89 | if (ret < 0) | 93 | if (ret < 0) |
90 | goto out; | 94 | goto out; |
91 | 95 | ||
diff --git a/arch/avr32/kernel/process.c b/arch/avr32/kernel/process.c index e5daddff397d..9c46aaad11ce 100644 --- a/arch/avr32/kernel/process.c +++ b/arch/avr32/kernel/process.c | |||
@@ -384,8 +384,9 @@ asmlinkage int sys_vfork(struct pt_regs *regs) | |||
384 | } | 384 | } |
385 | 385 | ||
386 | asmlinkage int sys_execve(const char __user *ufilename, | 386 | asmlinkage int sys_execve(const char __user *ufilename, |
387 | char __user *__user *uargv, | 387 | const char __user *const __user *uargv, |
388 | char __user *__user *uenvp, struct pt_regs *regs) | 388 | const char __user *const __user *uenvp, |
389 | struct pt_regs *regs) | ||
389 | { | 390 | { |
390 | int error; | 391 | int error; |
391 | char *filename; | 392 | char *filename; |
diff --git a/arch/avr32/kernel/sys_avr32.c b/arch/avr32/kernel/sys_avr32.c index 459349b5ed5a..62635a09ae3e 100644 --- a/arch/avr32/kernel/sys_avr32.c +++ b/arch/avr32/kernel/sys_avr32.c | |||
@@ -7,7 +7,9 @@ | |||
7 | */ | 7 | */ |
8 | #include <linux/unistd.h> | 8 | #include <linux/unistd.h> |
9 | 9 | ||
10 | int kernel_execve(const char *file, char **argv, char **envp) | 10 | int kernel_execve(const char *file, |
11 | const char *const *argv, | ||
12 | const char *const *envp) | ||
11 | { | 13 | { |
12 | register long scno asm("r8") = __NR_execve; | 14 | register long scno asm("r8") = __NR_execve; |
13 | register long sc1 asm("r12") = (long)file; | 15 | register long sc1 asm("r12") = (long)file; |
diff --git a/arch/blackfin/kernel/process.c b/arch/blackfin/kernel/process.c index a566f61c002a..01f98cb964d2 100644 --- a/arch/blackfin/kernel/process.c +++ b/arch/blackfin/kernel/process.c | |||
@@ -209,7 +209,9 @@ copy_thread(unsigned long clone_flags, | |||
209 | /* | 209 | /* |
210 | * sys_execve() executes a new program. | 210 | * sys_execve() executes a new program. |
211 | */ | 211 | */ |
212 | asmlinkage int sys_execve(const char __user *name, char __user * __user *argv, char __user * __user *envp) | 212 | asmlinkage int sys_execve(const char __user *name, |
213 | const char __user *const __user *argv, | ||
214 | const char __user *const __user *envp) | ||
213 | { | 215 | { |
214 | int error; | 216 | int error; |
215 | char *filename; | 217 | char *filename; |
diff --git a/arch/cris/arch-v10/kernel/process.c b/arch/cris/arch-v10/kernel/process.c index 93f0f64b1326..9a57db6907f5 100644 --- a/arch/cris/arch-v10/kernel/process.c +++ b/arch/cris/arch-v10/kernel/process.c | |||
@@ -204,7 +204,9 @@ asmlinkage int sys_vfork(long r10, long r11, long r12, long r13, long mof, long | |||
204 | /* | 204 | /* |
205 | * sys_execve() executes a new program. | 205 | * sys_execve() executes a new program. |
206 | */ | 206 | */ |
207 | asmlinkage int sys_execve(const char *fname, char **argv, char **envp, | 207 | asmlinkage int sys_execve(const char *fname, |
208 | const char *const *argv, | ||
209 | const char *const *envp, | ||
208 | long r13, long mof, long srp, | 210 | long r13, long mof, long srp, |
209 | struct pt_regs *regs) | 211 | struct pt_regs *regs) |
210 | { | 212 | { |
diff --git a/arch/cris/arch-v32/kernel/process.c b/arch/cris/arch-v32/kernel/process.c index 2661a9529d70..562f84718906 100644 --- a/arch/cris/arch-v32/kernel/process.c +++ b/arch/cris/arch-v32/kernel/process.c | |||
@@ -218,8 +218,10 @@ sys_vfork(long r10, long r11, long r12, long r13, long mof, long srp, | |||
218 | 218 | ||
219 | /* sys_execve() executes a new program. */ | 219 | /* sys_execve() executes a new program. */ |
220 | asmlinkage int | 220 | asmlinkage int |
221 | sys_execve(const char *fname, char **argv, char **envp, long r13, long mof, long srp, | 221 | sys_execve(const char *fname, |
222 | struct pt_regs *regs) | 222 | const char *const *argv, |
223 | const char *const *envp, long r13, long mof, long srp, | ||
224 | struct pt_regs *regs) | ||
223 | { | 225 | { |
224 | int error; | 226 | int error; |
225 | char *filename; | 227 | char *filename; |
diff --git a/arch/frv/kernel/process.c b/arch/frv/kernel/process.c index 428931cf2f0c..2b63b0191f52 100644 --- a/arch/frv/kernel/process.c +++ b/arch/frv/kernel/process.c | |||
@@ -250,8 +250,9 @@ int copy_thread(unsigned long clone_flags, | |||
250 | /* | 250 | /* |
251 | * sys_execve() executes a new program. | 251 | * sys_execve() executes a new program. |
252 | */ | 252 | */ |
253 | asmlinkage int sys_execve(const char __user *name, char __user * __user *argv, | 253 | asmlinkage int sys_execve(const char __user *name, |
254 | char __user * __user *envp) | 254 | const char __user *const __user *argv, |
255 | const char __user *const __user *envp) | ||
255 | { | 256 | { |
256 | int error; | 257 | int error; |
257 | char * filename; | 258 | char * filename; |
diff --git a/arch/h8300/kernel/process.c b/arch/h8300/kernel/process.c index 8b7b78d77d5c..97478138e361 100644 --- a/arch/h8300/kernel/process.c +++ b/arch/h8300/kernel/process.c | |||
@@ -212,7 +212,10 @@ int copy_thread(unsigned long clone_flags, | |||
212 | /* | 212 | /* |
213 | * sys_execve() executes a new program. | 213 | * sys_execve() executes a new program. |
214 | */ | 214 | */ |
215 | asmlinkage int sys_execve(const char *name, char **argv, char **envp,int dummy,...) | 215 | asmlinkage int sys_execve(const char *name, |
216 | const char *const *argv, | ||
217 | const char *const *envp, | ||
218 | int dummy, ...) | ||
216 | { | 219 | { |
217 | int error; | 220 | int error; |
218 | char * filename; | 221 | char * filename; |
diff --git a/arch/h8300/kernel/sys_h8300.c b/arch/h8300/kernel/sys_h8300.c index f9b3f44da69f..dc1ac0243b78 100644 --- a/arch/h8300/kernel/sys_h8300.c +++ b/arch/h8300/kernel/sys_h8300.c | |||
@@ -51,7 +51,9 @@ asmlinkage void syscall_print(void *dummy,...) | |||
51 | * Do a system call from kernel instead of calling sys_execve so we | 51 | * Do a system call from kernel instead of calling sys_execve so we |
52 | * end up with proper pt_regs. | 52 | * end up with proper pt_regs. |
53 | */ | 53 | */ |
54 | int kernel_execve(const char *filename, char *const argv[], char *const envp[]) | 54 | int kernel_execve(const char *filename, |
55 | const char *const argv[], | ||
56 | const char *const envp[]) | ||
55 | { | 57 | { |
56 | register long res __asm__("er0"); | 58 | register long res __asm__("er0"); |
57 | register char *const *_c __asm__("er3") = envp; | 59 | register char *const *_c __asm__("er3") = envp; |
diff --git a/arch/ia64/kernel/process.c b/arch/ia64/kernel/process.c index a879c03b7f1c..16f1c7b04c69 100644 --- a/arch/ia64/kernel/process.c +++ b/arch/ia64/kernel/process.c | |||
@@ -633,7 +633,9 @@ dump_fpu (struct pt_regs *pt, elf_fpregset_t dst) | |||
633 | } | 633 | } |
634 | 634 | ||
635 | long | 635 | long |
636 | sys_execve (const char __user *filename, char __user * __user *argv, char __user * __user *envp, | 636 | sys_execve (const char __user *filename, |
637 | const char __user *const __user *argv, | ||
638 | const char __user *const __user *envp, | ||
637 | struct pt_regs *regs) | 639 | struct pt_regs *regs) |
638 | { | 640 | { |
639 | char *fname; | 641 | char *fname; |
diff --git a/arch/m32r/kernel/process.c b/arch/m32r/kernel/process.c index 8665a4d868ec..422bea9f1dbc 100644 --- a/arch/m32r/kernel/process.c +++ b/arch/m32r/kernel/process.c | |||
@@ -289,8 +289,8 @@ asmlinkage int sys_vfork(unsigned long r0, unsigned long r1, unsigned long r2, | |||
289 | * sys_execve() executes a new program. | 289 | * sys_execve() executes a new program. |
290 | */ | 290 | */ |
291 | asmlinkage int sys_execve(const char __user *ufilename, | 291 | asmlinkage int sys_execve(const char __user *ufilename, |
292 | char __user * __user *uargv, | 292 | const char __user *const __user *uargv, |
293 | char __user * __user *uenvp, | 293 | const char __user *const __user *uenvp, |
294 | unsigned long r3, unsigned long r4, unsigned long r5, | 294 | unsigned long r3, unsigned long r4, unsigned long r5, |
295 | unsigned long r6, struct pt_regs regs) | 295 | unsigned long r6, struct pt_regs regs) |
296 | { | 296 | { |
diff --git a/arch/m32r/kernel/sys_m32r.c b/arch/m32r/kernel/sys_m32r.c index 0a00f467edfa..d841fb6cc703 100644 --- a/arch/m32r/kernel/sys_m32r.c +++ b/arch/m32r/kernel/sys_m32r.c | |||
@@ -93,7 +93,9 @@ asmlinkage int sys_cachectl(char *addr, int nbytes, int op) | |||
93 | * Do a system call from kernel instead of calling sys_execve so we | 93 | * Do a system call from kernel instead of calling sys_execve so we |
94 | * end up with proper pt_regs. | 94 | * end up with proper pt_regs. |
95 | */ | 95 | */ |
96 | int kernel_execve(const char *filename, char *const argv[], char *const envp[]) | 96 | int kernel_execve(const char *filename, |
97 | const char *const argv[], | ||
98 | const char *const envp[]) | ||
97 | { | 99 | { |
98 | register long __scno __asm__ ("r7") = __NR_execve; | 100 | register long __scno __asm__ ("r7") = __NR_execve; |
99 | register long __arg3 __asm__ ("r2") = (long)(envp); | 101 | register long __arg3 __asm__ ("r2") = (long)(envp); |
diff --git a/arch/m68k/kernel/process.c b/arch/m68k/kernel/process.c index 221d0b71ce39..18732ab23292 100644 --- a/arch/m68k/kernel/process.c +++ b/arch/m68k/kernel/process.c | |||
@@ -315,7 +315,9 @@ EXPORT_SYMBOL(dump_fpu); | |||
315 | /* | 315 | /* |
316 | * sys_execve() executes a new program. | 316 | * sys_execve() executes a new program. |
317 | */ | 317 | */ |
318 | asmlinkage int sys_execve(const char __user *name, char __user * __user *argv, char __user * __user *envp) | 318 | asmlinkage int sys_execve(const char __user *name, |
319 | const char __user *const __user *argv, | ||
320 | const char __user *const __user *envp) | ||
319 | { | 321 | { |
320 | int error; | 322 | int error; |
321 | char * filename; | 323 | char * filename; |
diff --git a/arch/m68k/kernel/sys_m68k.c b/arch/m68k/kernel/sys_m68k.c index 77896692eb0a..2f431ece7b5f 100644 --- a/arch/m68k/kernel/sys_m68k.c +++ b/arch/m68k/kernel/sys_m68k.c | |||
@@ -459,7 +459,9 @@ asmlinkage int sys_getpagesize(void) | |||
459 | * Do a system call from kernel instead of calling sys_execve so we | 459 | * Do a system call from kernel instead of calling sys_execve so we |
460 | * end up with proper pt_regs. | 460 | * end up with proper pt_regs. |
461 | */ | 461 | */ |
462 | int kernel_execve(const char *filename, char *const argv[], char *const envp[]) | 462 | int kernel_execve(const char *filename, |
463 | const char *const argv[], | ||
464 | const char *const envp[]) | ||
463 | { | 465 | { |
464 | register long __res asm ("%d0") = __NR_execve; | 466 | register long __res asm ("%d0") = __NR_execve; |
465 | register long __a asm ("%d1") = (long)(filename); | 467 | register long __a asm ("%d1") = (long)(filename); |
diff --git a/arch/m68knommu/kernel/process.c b/arch/m68knommu/kernel/process.c index 6350f68cd026..4d090d3c0897 100644 --- a/arch/m68knommu/kernel/process.c +++ b/arch/m68knommu/kernel/process.c | |||
@@ -350,7 +350,9 @@ void dump(struct pt_regs *fp) | |||
350 | /* | 350 | /* |
351 | * sys_execve() executes a new program. | 351 | * sys_execve() executes a new program. |
352 | */ | 352 | */ |
353 | asmlinkage int sys_execve(const char *name, char **argv, char **envp) | 353 | asmlinkage int sys_execve(const char *name, |
354 | const char *const *argv, | ||
355 | const char *const *envp) | ||
354 | { | 356 | { |
355 | int error; | 357 | int error; |
356 | char * filename; | 358 | char * filename; |
diff --git a/arch/m68knommu/kernel/sys_m68k.c b/arch/m68knommu/kernel/sys_m68k.c index d65e9c4c930c..68488ae47f0a 100644 --- a/arch/m68knommu/kernel/sys_m68k.c +++ b/arch/m68knommu/kernel/sys_m68k.c | |||
@@ -44,7 +44,9 @@ asmlinkage int sys_getpagesize(void) | |||
44 | * Do a system call from kernel instead of calling sys_execve so we | 44 | * Do a system call from kernel instead of calling sys_execve so we |
45 | * end up with proper pt_regs. | 45 | * end up with proper pt_regs. |
46 | */ | 46 | */ |
47 | int kernel_execve(const char *filename, char *const argv[], char *const envp[]) | 47 | int kernel_execve(const char *filename, |
48 | const char *const argv[], | ||
49 | const char *const envp[]) | ||
48 | { | 50 | { |
49 | register long __res asm ("%d0") = __NR_execve; | 51 | register long __res asm ("%d0") = __NR_execve; |
50 | register long __a asm ("%d1") = (long)(filename); | 52 | register long __a asm ("%d1") = (long)(filename); |
diff --git a/arch/microblaze/kernel/sys_microblaze.c b/arch/microblaze/kernel/sys_microblaze.c index 6abab6ebedbe..2250fe9d269b 100644 --- a/arch/microblaze/kernel/sys_microblaze.c +++ b/arch/microblaze/kernel/sys_microblaze.c | |||
@@ -47,8 +47,10 @@ asmlinkage long microblaze_clone(int flags, unsigned long stack, struct pt_regs | |||
47 | return do_fork(flags, stack, regs, 0, NULL, NULL); | 47 | return do_fork(flags, stack, regs, 0, NULL, NULL); |
48 | } | 48 | } |
49 | 49 | ||
50 | asmlinkage long microblaze_execve(const char __user *filenamei, char __user *__user *argv, | 50 | asmlinkage long microblaze_execve(const char __user *filenamei, |
51 | char __user *__user *envp, struct pt_regs *regs) | 51 | const char __user *const __user *argv, |
52 | const char __user *const __user *envp, | ||
53 | struct pt_regs *regs) | ||
52 | { | 54 | { |
53 | int error; | 55 | int error; |
54 | char *filename; | 56 | char *filename; |
@@ -77,7 +79,9 @@ asmlinkage long sys_mmap(unsigned long addr, unsigned long len, | |||
77 | * Do a system call from kernel instead of calling sys_execve so we | 79 | * Do a system call from kernel instead of calling sys_execve so we |
78 | * end up with proper pt_regs. | 80 | * end up with proper pt_regs. |
79 | */ | 81 | */ |
80 | int kernel_execve(const char *filename, char *const argv[], char *const envp[]) | 82 | int kernel_execve(const char *filename, |
83 | const char *const argv[], | ||
84 | const char *const envp[]) | ||
81 | { | 85 | { |
82 | register const char *__a __asm__("r5") = filename; | 86 | register const char *__a __asm__("r5") = filename; |
83 | register const void *__b __asm__("r6") = argv; | 87 | register const void *__b __asm__("r6") = argv; |
diff --git a/arch/mips/kernel/syscall.c b/arch/mips/kernel/syscall.c index bddce0bca195..1dc6edff45e0 100644 --- a/arch/mips/kernel/syscall.c +++ b/arch/mips/kernel/syscall.c | |||
@@ -258,8 +258,10 @@ asmlinkage int sys_execve(nabi_no_regargs struct pt_regs regs) | |||
258 | error = PTR_ERR(filename); | 258 | error = PTR_ERR(filename); |
259 | if (IS_ERR(filename)) | 259 | if (IS_ERR(filename)) |
260 | goto out; | 260 | goto out; |
261 | error = do_execve(filename, (char __user *__user *) (long)regs.regs[5], | 261 | error = do_execve(filename, |
262 | (char __user *__user *) (long)regs.regs[6], ®s); | 262 | (const char __user *const __user *) (long)regs.regs[5], |
263 | (const char __user *const __user *) (long)regs.regs[6], | ||
264 | ®s); | ||
263 | putname(filename); | 265 | putname(filename); |
264 | 266 | ||
265 | out: | 267 | out: |
@@ -436,7 +438,9 @@ asmlinkage void bad_stack(void) | |||
436 | * Do a system call from kernel instead of calling sys_execve so we | 438 | * Do a system call from kernel instead of calling sys_execve so we |
437 | * end up with proper pt_regs. | 439 | * end up with proper pt_regs. |
438 | */ | 440 | */ |
439 | int kernel_execve(const char *filename, char *const argv[], char *const envp[]) | 441 | int kernel_execve(const char *filename, |
442 | const char *const argv[], | ||
443 | const char *const envp[]) | ||
440 | { | 444 | { |
441 | register unsigned long __a0 asm("$4") = (unsigned long) filename; | 445 | register unsigned long __a0 asm("$4") = (unsigned long) filename; |
442 | register unsigned long __a1 asm("$5") = (unsigned long) argv; | 446 | register unsigned long __a1 asm("$5") = (unsigned long) argv; |
diff --git a/arch/mn10300/kernel/process.c b/arch/mn10300/kernel/process.c index 762eb325b949..f48373e2bc1c 100644 --- a/arch/mn10300/kernel/process.c +++ b/arch/mn10300/kernel/process.c | |||
@@ -269,8 +269,8 @@ asmlinkage long sys_vfork(void) | |||
269 | } | 269 | } |
270 | 270 | ||
271 | asmlinkage long sys_execve(const char __user *name, | 271 | asmlinkage long sys_execve(const char __user *name, |
272 | char __user * __user *argv, | 272 | const char __user *const __user *argv, |
273 | char __user * __user *envp) | 273 | const char __user *const __user *envp) |
274 | { | 274 | { |
275 | char *filename; | 275 | char *filename; |
276 | int error; | 276 | int error; |
diff --git a/arch/parisc/hpux/fs.c b/arch/parisc/hpux/fs.c index 1444875a7611..0dc8543acb4f 100644 --- a/arch/parisc/hpux/fs.c +++ b/arch/parisc/hpux/fs.c | |||
@@ -41,8 +41,10 @@ int hpux_execve(struct pt_regs *regs) | |||
41 | if (IS_ERR(filename)) | 41 | if (IS_ERR(filename)) |
42 | goto out; | 42 | goto out; |
43 | 43 | ||
44 | error = do_execve(filename, (char __user * __user *) regs->gr[25], | 44 | error = do_execve(filename, |
45 | (char __user * __user *) regs->gr[24], regs); | 45 | (const char __user *const __user *) regs->gr[25], |
46 | (const char __user *const __user *) regs->gr[24], | ||
47 | regs); | ||
46 | 48 | ||
47 | putname(filename); | 49 | putname(filename); |
48 | 50 | ||
diff --git a/arch/parisc/kernel/process.c b/arch/parisc/kernel/process.c index 76332dadc6e9..4b4b9181a1a0 100644 --- a/arch/parisc/kernel/process.c +++ b/arch/parisc/kernel/process.c | |||
@@ -348,17 +348,22 @@ asmlinkage int sys_execve(struct pt_regs *regs) | |||
348 | error = PTR_ERR(filename); | 348 | error = PTR_ERR(filename); |
349 | if (IS_ERR(filename)) | 349 | if (IS_ERR(filename)) |
350 | goto out; | 350 | goto out; |
351 | error = do_execve(filename, (char __user * __user *) regs->gr[25], | 351 | error = do_execve(filename, |
352 | (char __user * __user *) regs->gr[24], regs); | 352 | (const char __user *const __user *) regs->gr[25], |
353 | (const char __user *const __user *) regs->gr[24], | ||
354 | regs); | ||
353 | putname(filename); | 355 | putname(filename); |
354 | out: | 356 | out: |
355 | 357 | ||
356 | return error; | 358 | return error; |
357 | } | 359 | } |
358 | 360 | ||
359 | extern int __execve(const char *filename, char *const argv[], | 361 | extern int __execve(const char *filename, |
360 | char *const envp[], struct task_struct *task); | 362 | const char *const argv[], |
361 | int kernel_execve(const char *filename, char *const argv[], char *const envp[]) | 363 | const char *const envp[], struct task_struct *task); |
364 | int kernel_execve(const char *filename, | ||
365 | const char *const argv[], | ||
366 | const char *const envp[]) | ||
362 | { | 367 | { |
363 | return __execve(filename, argv, envp, current); | 368 | return __execve(filename, argv, envp, current); |
364 | } | 369 | } |
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c index feacfb789686..91356ffda2ca 100644 --- a/arch/powerpc/kernel/process.c +++ b/arch/powerpc/kernel/process.c | |||
@@ -1034,8 +1034,9 @@ int sys_execve(unsigned long a0, unsigned long a1, unsigned long a2, | |||
1034 | flush_fp_to_thread(current); | 1034 | flush_fp_to_thread(current); |
1035 | flush_altivec_to_thread(current); | 1035 | flush_altivec_to_thread(current); |
1036 | flush_spe_to_thread(current); | 1036 | flush_spe_to_thread(current); |
1037 | error = do_execve(filename, (char __user * __user *) a1, | 1037 | error = do_execve(filename, |
1038 | (char __user * __user *) a2, regs); | 1038 | (const char __user *const __user *) a1, |
1039 | (const char __user *const __user *) a2, regs); | ||
1039 | putname(filename); | 1040 | putname(filename); |
1040 | out: | 1041 | out: |
1041 | return error; | 1042 | return error; |
diff --git a/arch/s390/kernel/process.c b/arch/s390/kernel/process.c index 7eafaf2662b9..d3a2d1c6438e 100644 --- a/arch/s390/kernel/process.c +++ b/arch/s390/kernel/process.c | |||
@@ -267,8 +267,9 @@ asmlinkage void execve_tail(void) | |||
267 | /* | 267 | /* |
268 | * sys_execve() executes a new program. | 268 | * sys_execve() executes a new program. |
269 | */ | 269 | */ |
270 | SYSCALL_DEFINE3(execve, const char __user *, name, char __user * __user *, argv, | 270 | SYSCALL_DEFINE3(execve, const char __user *, name, |
271 | char __user * __user *, envp) | 271 | const char __user *const __user *, argv, |
272 | const char __user *const __user *, envp) | ||
272 | { | 273 | { |
273 | struct pt_regs *regs = task_pt_regs(current); | 274 | struct pt_regs *regs = task_pt_regs(current); |
274 | char *filename; | 275 | char *filename; |
diff --git a/arch/score/kernel/sys_score.c b/arch/score/kernel/sys_score.c index 651096ff8db4..e478bf9a7e91 100644 --- a/arch/score/kernel/sys_score.c +++ b/arch/score/kernel/sys_score.c | |||
@@ -99,8 +99,10 @@ score_execve(struct pt_regs *regs) | |||
99 | if (IS_ERR(filename)) | 99 | if (IS_ERR(filename)) |
100 | return error; | 100 | return error; |
101 | 101 | ||
102 | error = do_execve(filename, (char __user *__user*)regs->regs[5], | 102 | error = do_execve(filename, |
103 | (char __user *__user *) regs->regs[6], regs); | 103 | (const char __user *const __user *)regs->regs[5], |
104 | (const char __user *const __user *)regs->regs[6], | ||
105 | regs); | ||
104 | 106 | ||
105 | putname(filename); | 107 | putname(filename); |
106 | return error; | 108 | return error; |
@@ -110,7 +112,9 @@ score_execve(struct pt_regs *regs) | |||
110 | * Do a system call from kernel instead of calling sys_execve so we | 112 | * Do a system call from kernel instead of calling sys_execve so we |
111 | * end up with proper pt_regs. | 113 | * end up with proper pt_regs. |
112 | */ | 114 | */ |
113 | int kernel_execve(const char *filename, char *const argv[], char *const envp[]) | 115 | int kernel_execve(const char *filename, |
116 | const char *const argv[], | ||
117 | const char *const envp[]) | ||
114 | { | 118 | { |
115 | register unsigned long __r4 asm("r4") = (unsigned long) filename; | 119 | register unsigned long __r4 asm("r4") = (unsigned long) filename; |
116 | register unsigned long __r5 asm("r5") = (unsigned long) argv; | 120 | register unsigned long __r5 asm("r5") = (unsigned long) argv; |
diff --git a/arch/sh/kernel/process_32.c b/arch/sh/kernel/process_32.c index 052981972ae6..762a13984bbd 100644 --- a/arch/sh/kernel/process_32.c +++ b/arch/sh/kernel/process_32.c | |||
@@ -296,9 +296,10 @@ asmlinkage int sys_vfork(unsigned long r4, unsigned long r5, | |||
296 | /* | 296 | /* |
297 | * sys_execve() executes a new program. | 297 | * sys_execve() executes a new program. |
298 | */ | 298 | */ |
299 | asmlinkage int sys_execve(char __user *ufilename, char __user * __user *uargv, | 299 | asmlinkage int sys_execve(const char __user *ufilename, |
300 | char __user * __user *uenvp, unsigned long r7, | 300 | const char __user *const __user *uargv, |
301 | struct pt_regs __regs) | 301 | const char __user *const __user *uenvp, |
302 | unsigned long r7, struct pt_regs __regs) | ||
302 | { | 303 | { |
303 | struct pt_regs *regs = RELOC_HIDE(&__regs, 0); | 304 | struct pt_regs *regs = RELOC_HIDE(&__regs, 0); |
304 | int error; | 305 | int error; |
diff --git a/arch/sh/kernel/process_64.c b/arch/sh/kernel/process_64.c index 68d128d651b3..210c1cabcb7f 100644 --- a/arch/sh/kernel/process_64.c +++ b/arch/sh/kernel/process_64.c | |||
@@ -497,8 +497,8 @@ asmlinkage int sys_execve(const char *ufilename, char **uargv, | |||
497 | goto out; | 497 | goto out; |
498 | 498 | ||
499 | error = do_execve(filename, | 499 | error = do_execve(filename, |
500 | (char __user * __user *)uargv, | 500 | (const char __user *const __user *)uargv, |
501 | (char __user * __user *)uenvp, | 501 | (const char __user *const __user *)uenvp, |
502 | pregs); | 502 | pregs); |
503 | putname(filename); | 503 | putname(filename); |
504 | out: | 504 | out: |
diff --git a/arch/sh/kernel/sys_sh32.c b/arch/sh/kernel/sys_sh32.c index eb68bfdd86e6..f56b6fe5c5d0 100644 --- a/arch/sh/kernel/sys_sh32.c +++ b/arch/sh/kernel/sys_sh32.c | |||
@@ -71,7 +71,9 @@ asmlinkage int sys_fadvise64_64_wrapper(int fd, u32 offset0, u32 offset1, | |||
71 | * Do a system call from kernel instead of calling sys_execve so we | 71 | * Do a system call from kernel instead of calling sys_execve so we |
72 | * end up with proper pt_regs. | 72 | * end up with proper pt_regs. |
73 | */ | 73 | */ |
74 | int kernel_execve(const char *filename, char *const argv[], char *const envp[]) | 74 | int kernel_execve(const char *filename, |
75 | const char *const argv[], | ||
76 | const char *const envp[]) | ||
75 | { | 77 | { |
76 | register long __sc0 __asm__ ("r3") = __NR_execve; | 78 | register long __sc0 __asm__ ("r3") = __NR_execve; |
77 | register long __sc4 __asm__ ("r4") = (long) filename; | 79 | register long __sc4 __asm__ ("r4") = (long) filename; |
diff --git a/arch/sh/kernel/sys_sh64.c b/arch/sh/kernel/sys_sh64.c index 287235768bc5..c5a38c4bf410 100644 --- a/arch/sh/kernel/sys_sh64.c +++ b/arch/sh/kernel/sys_sh64.c | |||
@@ -33,7 +33,9 @@ | |||
33 | * Do a system call from kernel instead of calling sys_execve so we | 33 | * Do a system call from kernel instead of calling sys_execve so we |
34 | * end up with proper pt_regs. | 34 | * end up with proper pt_regs. |
35 | */ | 35 | */ |
36 | int kernel_execve(const char *filename, char *const argv[], char *const envp[]) | 36 | int kernel_execve(const char *filename, |
37 | const char *const argv[], | ||
38 | const char *const envp[]) | ||
37 | { | 39 | { |
38 | register unsigned long __sc0 __asm__ ("r9") = ((0x13 << 16) | __NR_execve); | 40 | register unsigned long __sc0 __asm__ ("r9") = ((0x13 << 16) | __NR_execve); |
39 | register unsigned long __sc2 __asm__ ("r2") = (unsigned long) filename; | 41 | register unsigned long __sc2 __asm__ ("r2") = (unsigned long) filename; |
diff --git a/arch/sparc/kernel/process_32.c b/arch/sparc/kernel/process_32.c index 40e29fc8a4d6..17529298c50a 100644 --- a/arch/sparc/kernel/process_32.c +++ b/arch/sparc/kernel/process_32.c | |||
@@ -633,8 +633,10 @@ asmlinkage int sparc_execve(struct pt_regs *regs) | |||
633 | if(IS_ERR(filename)) | 633 | if(IS_ERR(filename)) |
634 | goto out; | 634 | goto out; |
635 | error = do_execve(filename, | 635 | error = do_execve(filename, |
636 | (char __user * __user *)regs->u_regs[base + UREG_I1], | 636 | (const char __user *const __user *) |
637 | (char __user * __user *)regs->u_regs[base + UREG_I2], | 637 | regs->u_regs[base + UREG_I1], |
638 | (const char __user *const __user *) | ||
639 | regs->u_regs[base + UREG_I2], | ||
638 | regs); | 640 | regs); |
639 | putname(filename); | 641 | putname(filename); |
640 | out: | 642 | out: |
diff --git a/arch/sparc/kernel/process_64.c b/arch/sparc/kernel/process_64.c index dbe81a368b45..485f54748384 100644 --- a/arch/sparc/kernel/process_64.c +++ b/arch/sparc/kernel/process_64.c | |||
@@ -739,9 +739,9 @@ asmlinkage int sparc_execve(struct pt_regs *regs) | |||
739 | if (IS_ERR(filename)) | 739 | if (IS_ERR(filename)) |
740 | goto out; | 740 | goto out; |
741 | error = do_execve(filename, | 741 | error = do_execve(filename, |
742 | (char __user * __user *) | 742 | (const char __user *const __user *) |
743 | regs->u_regs[base + UREG_I1], | 743 | regs->u_regs[base + UREG_I1], |
744 | (char __user * __user *) | 744 | (const char __user *const __user *) |
745 | regs->u_regs[base + UREG_I2], regs); | 745 | regs->u_regs[base + UREG_I2], regs); |
746 | putname(filename); | 746 | putname(filename); |
747 | if (!error) { | 747 | if (!error) { |
diff --git a/arch/sparc/kernel/sys_sparc_32.c b/arch/sparc/kernel/sys_sparc_32.c index ee995b7dae7e..50794137d710 100644 --- a/arch/sparc/kernel/sys_sparc_32.c +++ b/arch/sparc/kernel/sys_sparc_32.c | |||
@@ -282,7 +282,9 @@ out: | |||
282 | * Do a system call from kernel instead of calling sys_execve so we | 282 | * Do a system call from kernel instead of calling sys_execve so we |
283 | * end up with proper pt_regs. | 283 | * end up with proper pt_regs. |
284 | */ | 284 | */ |
285 | int kernel_execve(const char *filename, char *const argv[], char *const envp[]) | 285 | int kernel_execve(const char *filename, |
286 | const char *const argv[], | ||
287 | const char *const envp[]) | ||
286 | { | 288 | { |
287 | long __res; | 289 | long __res; |
288 | register long __g1 __asm__ ("g1") = __NR_execve; | 290 | register long __g1 __asm__ ("g1") = __NR_execve; |
diff --git a/arch/sparc/kernel/sys_sparc_64.c b/arch/sparc/kernel/sys_sparc_64.c index 3d435c42e6db..f836f4e93afe 100644 --- a/arch/sparc/kernel/sys_sparc_64.c +++ b/arch/sparc/kernel/sys_sparc_64.c | |||
@@ -758,7 +758,9 @@ SYSCALL_DEFINE5(rt_sigaction, int, sig, const struct sigaction __user *, act, | |||
758 | * Do a system call from kernel instead of calling sys_execve so we | 758 | * Do a system call from kernel instead of calling sys_execve so we |
759 | * end up with proper pt_regs. | 759 | * end up with proper pt_regs. |
760 | */ | 760 | */ |
761 | int kernel_execve(const char *filename, char *const argv[], char *const envp[]) | 761 | int kernel_execve(const char *filename, |
762 | const char *const argv[], | ||
763 | const char *const envp[]) | ||
762 | { | 764 | { |
763 | long __res; | 765 | long __res; |
764 | register long __g1 __asm__ ("g1") = __NR_execve; | 766 | register long __g1 __asm__ ("g1") = __NR_execve; |
diff --git a/arch/tile/kernel/process.c b/arch/tile/kernel/process.c index ed590ad0acdc..985cc28c74c5 100644 --- a/arch/tile/kernel/process.c +++ b/arch/tile/kernel/process.c | |||
@@ -543,8 +543,9 @@ long _sys_vfork(struct pt_regs *regs) | |||
543 | /* | 543 | /* |
544 | * sys_execve() executes a new program. | 544 | * sys_execve() executes a new program. |
545 | */ | 545 | */ |
546 | long _sys_execve(char __user *path, char __user *__user *argv, | 546 | long _sys_execve(const char __user *path, |
547 | char __user *__user *envp, struct pt_regs *regs) | 547 | const char __user *const __user *argv, |
548 | const char __user *const __user *envp, struct pt_regs *regs) | ||
548 | { | 549 | { |
549 | long error; | 550 | long error; |
550 | char *filename; | 551 | char *filename; |
diff --git a/arch/um/kernel/exec.c b/arch/um/kernel/exec.c index 59b20d93b6d4..cd145eda3579 100644 --- a/arch/um/kernel/exec.c +++ b/arch/um/kernel/exec.c | |||
@@ -44,8 +44,9 @@ void start_thread(struct pt_regs *regs, unsigned long eip, unsigned long esp) | |||
44 | PT_REGS_SP(regs) = esp; | 44 | PT_REGS_SP(regs) = esp; |
45 | } | 45 | } |
46 | 46 | ||
47 | static long execve1(const char *file, char __user * __user *argv, | 47 | static long execve1(const char *file, |
48 | char __user *__user *env) | 48 | const char __user *const __user *argv, |
49 | const char __user *const __user *env) | ||
49 | { | 50 | { |
50 | long error; | 51 | long error; |
51 | 52 | ||
diff --git a/arch/um/kernel/syscall.c b/arch/um/kernel/syscall.c index 7427c0b1930c..5ddb246626db 100644 --- a/arch/um/kernel/syscall.c +++ b/arch/um/kernel/syscall.c | |||
@@ -51,7 +51,9 @@ long old_mmap(unsigned long addr, unsigned long len, | |||
51 | return err; | 51 | return err; |
52 | } | 52 | } |
53 | 53 | ||
54 | int kernel_execve(const char *filename, char *const argv[], char *const envp[]) | 54 | int kernel_execve(const char *filename, |
55 | const char *const argv[], | ||
56 | const char *const envp[]) | ||
55 | { | 57 | { |
56 | mm_segment_t fs; | 58 | mm_segment_t fs; |
57 | int ret; | 59 | int ret; |
diff --git a/arch/x86/include/asm/syscalls.h b/arch/x86/include/asm/syscalls.h index feb2ff9bfc2d..f1d8b441fc77 100644 --- a/arch/x86/include/asm/syscalls.h +++ b/arch/x86/include/asm/syscalls.h | |||
@@ -23,8 +23,9 @@ long sys_iopl(unsigned int, struct pt_regs *); | |||
23 | /* kernel/process.c */ | 23 | /* kernel/process.c */ |
24 | int sys_fork(struct pt_regs *); | 24 | int sys_fork(struct pt_regs *); |
25 | int sys_vfork(struct pt_regs *); | 25 | int sys_vfork(struct pt_regs *); |
26 | long sys_execve(const char __user *, char __user * __user *, | 26 | long sys_execve(const char __user *, |
27 | char __user * __user *, struct pt_regs *); | 27 | const char __user *const __user *, |
28 | const char __user *const __user *, struct pt_regs *); | ||
28 | long sys_clone(unsigned long, unsigned long, void __user *, | 29 | long sys_clone(unsigned long, unsigned long, void __user *, |
29 | void __user *, struct pt_regs *); | 30 | void __user *, struct pt_regs *); |
30 | 31 | ||
diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c index 64ecaf0af9af..57d1868a86aa 100644 --- a/arch/x86/kernel/process.c +++ b/arch/x86/kernel/process.c | |||
@@ -301,8 +301,9 @@ EXPORT_SYMBOL(kernel_thread); | |||
301 | /* | 301 | /* |
302 | * sys_execve() executes a new program. | 302 | * sys_execve() executes a new program. |
303 | */ | 303 | */ |
304 | long sys_execve(const char __user *name, char __user * __user *argv, | 304 | long sys_execve(const char __user *name, |
305 | char __user * __user *envp, struct pt_regs *regs) | 305 | const char __user *const __user *argv, |
306 | const char __user *const __user *envp, struct pt_regs *regs) | ||
306 | { | 307 | { |
307 | long error; | 308 | long error; |
308 | char *filename; | 309 | char *filename; |
diff --git a/arch/x86/kernel/sys_i386_32.c b/arch/x86/kernel/sys_i386_32.c index 196552bb412c..d5e06624e34a 100644 --- a/arch/x86/kernel/sys_i386_32.c +++ b/arch/x86/kernel/sys_i386_32.c | |||
@@ -28,7 +28,9 @@ | |||
28 | * Do a system call from kernel instead of calling sys_execve so we | 28 | * Do a system call from kernel instead of calling sys_execve so we |
29 | * end up with proper pt_regs. | 29 | * end up with proper pt_regs. |
30 | */ | 30 | */ |
31 | int kernel_execve(const char *filename, char *const argv[], char *const envp[]) | 31 | int kernel_execve(const char *filename, |
32 | const char *const argv[], | ||
33 | const char *const envp[]) | ||
32 | { | 34 | { |
33 | long __res; | 35 | long __res; |
34 | asm volatile ("push %%ebx ; movl %2,%%ebx ; int $0x80 ; pop %%ebx" | 36 | asm volatile ("push %%ebx ; movl %2,%%ebx ; int $0x80 ; pop %%ebx" |
diff --git a/arch/xtensa/kernel/process.c b/arch/xtensa/kernel/process.c index 7c2f38f68ebb..e3558b9a58ba 100644 --- a/arch/xtensa/kernel/process.c +++ b/arch/xtensa/kernel/process.c | |||
@@ -318,8 +318,9 @@ long xtensa_clone(unsigned long clone_flags, unsigned long newsp, | |||
318 | */ | 318 | */ |
319 | 319 | ||
320 | asmlinkage | 320 | asmlinkage |
321 | long xtensa_execve(const char __user *name, char __user * __user *argv, | 321 | long xtensa_execve(const char __user *name, |
322 | char __user * __user *envp, | 322 | const char __user *const __user *argv, |
323 | const char __user *const __user *envp, | ||
323 | long a3, long a4, long a5, | 324 | long a3, long a4, long a5, |
324 | struct pt_regs *regs) | 325 | struct pt_regs *regs) |
325 | { | 326 | { |