aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2010-08-17 18:52:56 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-08-17 21:07:43 -0400
commitd7627467b7a8dd6944885290a03a07ceb28c10eb (patch)
treea18c83468418e878cfb2d44e4310d81b8db84ad7
parentda5cabf80e2433131bf0ed8993abc0f7ea618c73 (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>
-rw-r--r--arch/alpha/kernel/process.c5
-rw-r--r--arch/arm/kernel/sys_arm.c14
-rw-r--r--arch/avr32/kernel/process.c5
-rw-r--r--arch/avr32/kernel/sys_avr32.c4
-rw-r--r--arch/blackfin/kernel/process.c4
-rw-r--r--arch/cris/arch-v10/kernel/process.c4
-rw-r--r--arch/cris/arch-v32/kernel/process.c6
-rw-r--r--arch/frv/kernel/process.c5
-rw-r--r--arch/h8300/kernel/process.c5
-rw-r--r--arch/h8300/kernel/sys_h8300.c4
-rw-r--r--arch/ia64/kernel/process.c4
-rw-r--r--arch/m32r/kernel/process.c4
-rw-r--r--arch/m32r/kernel/sys_m32r.c4
-rw-r--r--arch/m68k/kernel/process.c4
-rw-r--r--arch/m68k/kernel/sys_m68k.c4
-rw-r--r--arch/m68knommu/kernel/process.c4
-rw-r--r--arch/m68knommu/kernel/sys_m68k.c4
-rw-r--r--arch/microblaze/kernel/sys_microblaze.c10
-rw-r--r--arch/mips/kernel/syscall.c10
-rw-r--r--arch/mn10300/kernel/process.c4
-rw-r--r--arch/parisc/hpux/fs.c6
-rw-r--r--arch/parisc/kernel/process.c15
-rw-r--r--arch/powerpc/kernel/process.c5
-rw-r--r--arch/s390/kernel/process.c5
-rw-r--r--arch/score/kernel/sys_score.c10
-rw-r--r--arch/sh/kernel/process_32.c7
-rw-r--r--arch/sh/kernel/process_64.c4
-rw-r--r--arch/sh/kernel/sys_sh32.c4
-rw-r--r--arch/sh/kernel/sys_sh64.c4
-rw-r--r--arch/sparc/kernel/process_32.c6
-rw-r--r--arch/sparc/kernel/process_64.c4
-rw-r--r--arch/sparc/kernel/sys_sparc_32.c4
-rw-r--r--arch/sparc/kernel/sys_sparc_64.c4
-rw-r--r--arch/tile/kernel/process.c5
-rw-r--r--arch/um/kernel/exec.c5
-rw-r--r--arch/um/kernel/syscall.c4
-rw-r--r--arch/x86/include/asm/syscalls.h5
-rw-r--r--arch/x86/kernel/process.c5
-rw-r--r--arch/x86/kernel/sys_i386_32.c4
-rw-r--r--arch/xtensa/kernel/process.c5
-rw-r--r--fs/binfmt_misc.c2
-rw-r--r--fs/binfmt_script.c3
-rw-r--r--fs/exec.c21
-rw-r--r--include/linux/binfmts.h7
-rw-r--r--include/linux/sched.h4
-rw-r--r--include/linux/syscalls.h2
-rw-r--r--init/do_mounts_initrd.c7
-rw-r--r--init/main.c6
-rw-r--r--kernel/kmod.c4
-rw-r--r--security/commoncap.c2
50 files changed, 179 insertions, 98 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 */
389asmlinkage int 389asmlinkage int
390do_sys_execve(const char __user *ufilename, char __user * __user *argv, 390do_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 */
65asmlinkage int sys_execve(const char __user *filenamei, char __user * __user *argv, 65asmlinkage 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
81int kernel_execve(const char *filename, char *const argv[], char *const envp[]) 82int 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(&regs, 0, sizeof(struct pt_regs)); 89 memset(&regs, 0, sizeof(struct pt_regs));
87 ret = do_execve(filename, (char __user * __user *)argv, 90 ret = do_execve(filename,
88 (char __user * __user *)envp, &regs); 91 (const char __user *const __user *)argv,
92 (const char __user *const __user *)envp, &regs);
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
386asmlinkage int sys_execve(const char __user *ufilename, 386asmlinkage 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
10int kernel_execve(const char *file, char **argv, char **envp) 10int 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 */
212asmlinkage int sys_execve(const char __user *name, char __user * __user *argv, char __user * __user *envp) 212asmlinkage 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 */
207asmlinkage int sys_execve(const char *fname, char **argv, char **envp, 207asmlinkage 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. */
220asmlinkage int 220asmlinkage int
221sys_execve(const char *fname, char **argv, char **envp, long r13, long mof, long srp, 221sys_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 */
253asmlinkage int sys_execve(const char __user *name, char __user * __user *argv, 253asmlinkage 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 */
215asmlinkage int sys_execve(const char *name, char **argv, char **envp,int dummy,...) 215asmlinkage 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 */
54int kernel_execve(const char *filename, char *const argv[], char *const envp[]) 54int 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
635long 635long
636sys_execve (const char __user *filename, char __user * __user *argv, char __user * __user *envp, 636sys_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 */
291asmlinkage int sys_execve(const char __user *ufilename, 291asmlinkage 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 */
96int kernel_execve(const char *filename, char *const argv[], char *const envp[]) 96int 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 */
318asmlinkage int sys_execve(const char __user *name, char __user * __user *argv, char __user * __user *envp) 318asmlinkage 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 */
462int kernel_execve(const char *filename, char *const argv[], char *const envp[]) 462int 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 */
353asmlinkage int sys_execve(const char *name, char **argv, char **envp) 353asmlinkage 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 */
47int kernel_execve(const char *filename, char *const argv[], char *const envp[]) 47int 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
50asmlinkage long microblaze_execve(const char __user *filenamei, char __user *__user *argv, 50asmlinkage 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 */
80int kernel_execve(const char *filename, char *const argv[], char *const envp[]) 82int 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], &regs); 262 (const char __user *const __user *) (long)regs.regs[5],
263 (const char __user *const __user *) (long)regs.regs[6],
264 &regs);
263 putname(filename); 265 putname(filename);
264 266
265out: 267out:
@@ -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 */
439int kernel_execve(const char *filename, char *const argv[], char *const envp[]) 441int 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
271asmlinkage long sys_execve(const char __user *name, 271asmlinkage 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);
354out: 356out:
355 357
356 return error; 358 return error;
357} 359}
358 360
359extern int __execve(const char *filename, char *const argv[], 361extern int __execve(const char *filename,
360 char *const envp[], struct task_struct *task); 362 const char *const argv[],
361int kernel_execve(const char *filename, char *const argv[], char *const envp[]) 363 const char *const envp[], struct task_struct *task);
364int 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);
1040out: 1041out:
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 */
270SYSCALL_DEFINE3(execve, const char __user *, name, char __user * __user *, argv, 270SYSCALL_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 */
113int kernel_execve(const char *filename, char *const argv[], char *const envp[]) 115int 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 */
299asmlinkage int sys_execve(char __user *ufilename, char __user * __user *uargv, 299asmlinkage 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);
504out: 504out:
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 */
74int kernel_execve(const char *filename, char *const argv[], char *const envp[]) 74int 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 */
36int kernel_execve(const char *filename, char *const argv[], char *const envp[]) 36int 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);
640out: 642out:
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 */
285int kernel_execve(const char *filename, char *const argv[], char *const envp[]) 285int 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 */
761int kernel_execve(const char *filename, char *const argv[], char *const envp[]) 761int 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 */
546long _sys_execve(char __user *path, char __user *__user *argv, 546long _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
47static long execve1(const char *file, char __user * __user *argv, 47static 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
54int kernel_execve(const char *filename, char *const argv[], char *const envp[]) 54int 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 */
24int sys_fork(struct pt_regs *); 24int sys_fork(struct pt_regs *);
25int sys_vfork(struct pt_regs *); 25int sys_vfork(struct pt_regs *);
26long sys_execve(const char __user *, char __user * __user *, 26long 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 *);
28long sys_clone(unsigned long, unsigned long, void __user *, 29long 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 */
304long sys_execve(const char __user *name, char __user * __user *argv, 304long 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 */
31int kernel_execve(const char *filename, char *const argv[], char *const envp[]) 31int 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
320asmlinkage 320asmlinkage
321long xtensa_execve(const char __user *name, char __user * __user *argv, 321long 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{
diff --git a/fs/binfmt_misc.c b/fs/binfmt_misc.c
index 9e60fd201716..a7528b913936 100644
--- a/fs/binfmt_misc.c
+++ b/fs/binfmt_misc.c
@@ -108,7 +108,7 @@ static int load_misc_binary(struct linux_binprm *bprm, struct pt_regs *regs)
108 Node *fmt; 108 Node *fmt;
109 struct file * interp_file = NULL; 109 struct file * interp_file = NULL;
110 char iname[BINPRM_BUF_SIZE]; 110 char iname[BINPRM_BUF_SIZE];
111 char *iname_addr = iname; 111 const char *iname_addr = iname;
112 int retval; 112 int retval;
113 int fd_binary = -1; 113 int fd_binary = -1;
114 114
diff --git a/fs/binfmt_script.c b/fs/binfmt_script.c
index aca9d55afb22..396a9884591f 100644
--- a/fs/binfmt_script.c
+++ b/fs/binfmt_script.c
@@ -16,7 +16,8 @@
16 16
17static int load_script(struct linux_binprm *bprm,struct pt_regs *regs) 17static int load_script(struct linux_binprm *bprm,struct pt_regs *regs)
18{ 18{
19 char *cp, *i_name, *i_arg; 19 const char *i_arg, *i_name;
20 char *cp;
20 struct file *file; 21 struct file *file;
21 char interp[BINPRM_BUF_SIZE]; 22 char interp[BINPRM_BUF_SIZE];
22 int retval; 23 int retval;
diff --git a/fs/exec.c b/fs/exec.c
index 7761837e4500..05c7d6b84df7 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -361,13 +361,13 @@ err:
361/* 361/*
362 * count() counts the number of strings in array ARGV. 362 * count() counts the number of strings in array ARGV.
363 */ 363 */
364static int count(char __user * __user * argv, int max) 364static int count(const char __user * const __user * argv, int max)
365{ 365{
366 int i = 0; 366 int i = 0;
367 367
368 if (argv != NULL) { 368 if (argv != NULL) {
369 for (;;) { 369 for (;;) {
370 char __user * p; 370 const char __user * p;
371 371
372 if (get_user(p, argv)) 372 if (get_user(p, argv))
373 return -EFAULT; 373 return -EFAULT;
@@ -387,7 +387,7 @@ static int count(char __user * __user * argv, int max)
387 * processes's memory to the new process's stack. The call to get_user_pages() 387 * processes's memory to the new process's stack. The call to get_user_pages()
388 * ensures the destination page is created and not swapped out. 388 * ensures the destination page is created and not swapped out.
389 */ 389 */
390static int copy_strings(int argc, char __user * __user * argv, 390static int copy_strings(int argc, const char __user *const __user *argv,
391 struct linux_binprm *bprm) 391 struct linux_binprm *bprm)
392{ 392{
393 struct page *kmapped_page = NULL; 393 struct page *kmapped_page = NULL;
@@ -396,7 +396,7 @@ static int copy_strings(int argc, char __user * __user * argv,
396 int ret; 396 int ret;
397 397
398 while (argc-- > 0) { 398 while (argc-- > 0) {
399 char __user *str; 399 const char __user *str;
400 int len; 400 int len;
401 unsigned long pos; 401 unsigned long pos;
402 402
@@ -470,12 +470,13 @@ out:
470/* 470/*
471 * Like copy_strings, but get argv and its values from kernel memory. 471 * Like copy_strings, but get argv and its values from kernel memory.
472 */ 472 */
473int copy_strings_kernel(int argc,char ** argv, struct linux_binprm *bprm) 473int copy_strings_kernel(int argc, const char *const *argv,
474 struct linux_binprm *bprm)
474{ 475{
475 int r; 476 int r;
476 mm_segment_t oldfs = get_fs(); 477 mm_segment_t oldfs = get_fs();
477 set_fs(KERNEL_DS); 478 set_fs(KERNEL_DS);
478 r = copy_strings(argc, (char __user * __user *)argv, bprm); 479 r = copy_strings(argc, (const char __user *const __user *)argv, bprm);
479 set_fs(oldfs); 480 set_fs(oldfs);
480 return r; 481 return r;
481} 482}
@@ -997,7 +998,7 @@ EXPORT_SYMBOL(flush_old_exec);
997void setup_new_exec(struct linux_binprm * bprm) 998void setup_new_exec(struct linux_binprm * bprm)
998{ 999{
999 int i, ch; 1000 int i, ch;
1000 char * name; 1001 const char *name;
1001 char tcomm[sizeof(current->comm)]; 1002 char tcomm[sizeof(current->comm)];
1002 1003
1003 arch_pick_mmap_layout(current->mm); 1004 arch_pick_mmap_layout(current->mm);
@@ -1316,9 +1317,9 @@ EXPORT_SYMBOL(search_binary_handler);
1316/* 1317/*
1317 * sys_execve() executes a new program. 1318 * sys_execve() executes a new program.
1318 */ 1319 */
1319int do_execve(char * filename, 1320int do_execve(const char * filename,
1320 char __user *__user *argv, 1321 const char __user *const __user *argv,
1321 char __user *__user *envp, 1322 const char __user *const __user *envp,
1322 struct pt_regs * regs) 1323 struct pt_regs * regs)
1323{ 1324{
1324 struct linux_binprm *bprm; 1325 struct linux_binprm *bprm;
diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h
index c809e286d213..a065612fc928 100644
--- a/include/linux/binfmts.h
+++ b/include/linux/binfmts.h
@@ -50,8 +50,8 @@ struct linux_binprm{
50 int unsafe; /* how unsafe this exec is (mask of LSM_UNSAFE_*) */ 50 int unsafe; /* how unsafe this exec is (mask of LSM_UNSAFE_*) */
51 unsigned int per_clear; /* bits to clear in current->personality */ 51 unsigned int per_clear; /* bits to clear in current->personality */
52 int argc, envc; 52 int argc, envc;
53 char * filename; /* Name of binary as seen by procps */ 53 const char * filename; /* Name of binary as seen by procps */
54 char * interp; /* Name of the binary really executed. Most 54 const char * interp; /* Name of the binary really executed. Most
55 of the time same as filename, but could be 55 of the time same as filename, but could be
56 different for binfmt_{misc,script} */ 56 different for binfmt_{misc,script} */
57 unsigned interp_flags; 57 unsigned interp_flags;
@@ -126,7 +126,8 @@ extern int setup_arg_pages(struct linux_binprm * bprm,
126 unsigned long stack_top, 126 unsigned long stack_top,
127 int executable_stack); 127 int executable_stack);
128extern int bprm_mm_init(struct linux_binprm *bprm); 128extern int bprm_mm_init(struct linux_binprm *bprm);
129extern int copy_strings_kernel(int argc,char ** argv,struct linux_binprm *bprm); 129extern int copy_strings_kernel(int argc, const char *const *argv,
130 struct linux_binprm *bprm);
130extern int prepare_bprm_creds(struct linux_binprm *bprm); 131extern int prepare_bprm_creds(struct linux_binprm *bprm);
131extern void install_exec_creds(struct linux_binprm *bprm); 132extern void install_exec_creds(struct linux_binprm *bprm);
132extern void do_coredump(long signr, int exit_code, struct pt_regs *regs); 133extern void do_coredump(long signr, int exit_code, struct pt_regs *regs);
diff --git a/include/linux/sched.h b/include/linux/sched.h
index ce160d68f5e7..1e2a6db2d7dd 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -2109,7 +2109,9 @@ extern void daemonize(const char *, ...);
2109extern int allow_signal(int); 2109extern int allow_signal(int);
2110extern int disallow_signal(int); 2110extern int disallow_signal(int);
2111 2111
2112extern int do_execve(char *, char __user * __user *, char __user * __user *, struct pt_regs *); 2112extern int do_execve(const char *,
2113 const char __user * const __user *,
2114 const char __user * const __user *, struct pt_regs *);
2113extern long do_fork(unsigned long, unsigned long, struct pt_regs *, unsigned long, int __user *, int __user *); 2115extern long do_fork(unsigned long, unsigned long, struct pt_regs *, unsigned long, int __user *, int __user *);
2114struct task_struct *fork_idle(int); 2116struct task_struct *fork_idle(int);
2115 2117
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index 6e5d19788634..e6319d18a55d 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -820,7 +820,7 @@ asmlinkage long sys_fanotify_mark(int fanotify_fd, unsigned int flags,
820 u64 mask, int fd, 820 u64 mask, int fd,
821 const char __user *pathname); 821 const char __user *pathname);
822 822
823int kernel_execve(const char *filename, char *const argv[], char *const envp[]); 823int kernel_execve(const char *filename, const char *const argv[], const char *const envp[]);
824 824
825 825
826asmlinkage long sys_perf_event_open( 826asmlinkage long sys_perf_event_open(
diff --git a/init/do_mounts_initrd.c b/init/do_mounts_initrd.c
index 2b108538d0d9..3098a38f3ae1 100644
--- a/init/do_mounts_initrd.c
+++ b/init/do_mounts_initrd.c
@@ -24,10 +24,11 @@ static int __init no_initrd(char *str)
24 24
25__setup("noinitrd", no_initrd); 25__setup("noinitrd", no_initrd);
26 26
27static int __init do_linuxrc(void * shell) 27static int __init do_linuxrc(void *_shell)
28{ 28{
29 static char *argv[] = { "linuxrc", NULL, }; 29 static const char *argv[] = { "linuxrc", NULL, };
30 extern char * envp_init[]; 30 extern const char *envp_init[];
31 const char *shell = _shell;
31 32
32 sys_close(old_fd);sys_close(root_fd); 33 sys_close(old_fd);sys_close(root_fd);
33 sys_setsid(); 34 sys_setsid();
diff --git a/init/main.c b/init/main.c
index 22d61cb06f98..94ab488039aa 100644
--- a/init/main.c
+++ b/init/main.c
@@ -197,8 +197,8 @@ static int __init set_reset_devices(char *str)
197 197
198__setup("reset_devices", set_reset_devices); 198__setup("reset_devices", set_reset_devices);
199 199
200static char * argv_init[MAX_INIT_ARGS+2] = { "init", NULL, }; 200static const char * argv_init[MAX_INIT_ARGS+2] = { "init", NULL, };
201char * envp_init[MAX_INIT_ENVS+2] = { "HOME=/", "TERM=linux", NULL, }; 201const char * envp_init[MAX_INIT_ENVS+2] = { "HOME=/", "TERM=linux", NULL, };
202static const char *panic_later, *panic_param; 202static const char *panic_later, *panic_param;
203 203
204extern const struct obs_kernel_param __setup_start[], __setup_end[]; 204extern const struct obs_kernel_param __setup_start[], __setup_end[];
@@ -809,7 +809,7 @@ static void __init do_pre_smp_initcalls(void)
809 do_one_initcall(*fn); 809 do_one_initcall(*fn);
810} 810}
811 811
812static void run_init_process(char *init_filename) 812static void run_init_process(const char *init_filename)
813{ 813{
814 argv_init[0] = init_filename; 814 argv_init[0] = init_filename;
815 kernel_execve(init_filename, argv_init, envp_init); 815 kernel_execve(init_filename, argv_init, envp_init);
diff --git a/kernel/kmod.c b/kernel/kmod.c
index 6e9b19667a8d..9cd0591c96a2 100644
--- a/kernel/kmod.c
+++ b/kernel/kmod.c
@@ -153,7 +153,9 @@ static int ____call_usermodehelper(void *data)
153 goto fail; 153 goto fail;
154 } 154 }
155 155
156 retval = kernel_execve(sub_info->path, sub_info->argv, sub_info->envp); 156 retval = kernel_execve(sub_info->path,
157 (const char *const *)sub_info->argv,
158 (const char *const *)sub_info->envp);
157 159
158 /* Exec failed? */ 160 /* Exec failed? */
159fail: 161fail:
diff --git a/security/commoncap.c b/security/commoncap.c
index 4e015996dd4d..9d172e6e330c 100644
--- a/security/commoncap.c
+++ b/security/commoncap.c
@@ -40,7 +40,7 @@
40 * 40 *
41 * Warn if that happens, once per boot. 41 * Warn if that happens, once per boot.
42 */ 42 */
43static void warn_setuid_and_fcaps_mixed(char *fname) 43static void warn_setuid_and_fcaps_mixed(const char *fname)
44{ 44{
45 static int warned; 45 static int warned;
46 if (!warned) { 46 if (!warned) {