Commit [d76274] Maximize Restore History

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>

David Howells David Howells 2010-08-17

Linus Torvalds Linus Torvalds 2010-08-18

1 2 > >> (Page 1 of 2)
changed arch/alpha/kernel/process.c
changed arch/arm/kernel/sys_arm.c
changed arch/avr32/kernel/process.c
changed arch/avr32/kernel/sys_avr32.c
changed arch/blackfin/kernel/process.c
changed arch/cris/arch-v10/kernel/process.c
changed arch/cris/arch-v32/kernel/process.c
changed arch/frv/kernel/process.c
changed arch/h8300/kernel/process.c
changed arch/h8300/kernel/sys_h8300.c
changed arch/ia64/kernel/process.c
changed arch/m32r/kernel/process.c
changed arch/m32r/kernel/sys_m32r.c
changed arch/m68k/kernel/process.c
changed arch/m68k/kernel/sys_m68k.c
changed arch/m68knommu/kernel/process.c
changed arch/m68knommu/kernel/sys_m68k.c
changed arch/microblaze/kernel/sys_microblaze.c
changed arch/mips/kernel/syscall.c
changed arch/mn10300/kernel/process.c
changed arch/parisc/hpux/fs.c
changed arch/parisc/kernel/process.c
changed arch/powerpc/kernel/process.c
changed arch/s390/kernel/process.c
changed arch/score/kernel/sys_score.c
arch/alpha/kernel/process.c Diff Switch to side-by-side view
Loading...
arch/arm/kernel/sys_arm.c Diff Switch to side-by-side view
Loading...
arch/avr32/kernel/process.c Diff Switch to side-by-side view
Loading...
arch/avr32/kernel/sys_avr32.c Diff Switch to side-by-side view
Loading...
arch/blackfin/kernel/process.c Diff Switch to side-by-side view
Loading...
arch/cris/arch-v10/kernel/process.c Diff Switch to side-by-side view
Loading...
arch/cris/arch-v32/kernel/process.c Diff Switch to side-by-side view
Loading...
arch/frv/kernel/process.c Diff Switch to side-by-side view
Loading...
arch/h8300/kernel/process.c Diff Switch to side-by-side view
Loading...
arch/h8300/kernel/sys_h8300.c Diff Switch to side-by-side view
Loading...
arch/ia64/kernel/process.c Diff Switch to side-by-side view
Loading...
arch/m32r/kernel/process.c Diff Switch to side-by-side view
Loading...
arch/m32r/kernel/sys_m32r.c Diff Switch to side-by-side view
Loading...
arch/m68k/kernel/process.c Diff Switch to side-by-side view
Loading...
arch/m68k/kernel/sys_m68k.c Diff Switch to side-by-side view
Loading...
arch/m68knommu/kernel/process.c Diff Switch to side-by-side view
Loading...
arch/m68knommu/kernel/sys_m68k.c Diff Switch to side-by-side view
Loading...
arch/microblaze/kernel/sys_microblaze.c Diff Switch to side-by-side view
Loading...
arch/mips/kernel/syscall.c Diff Switch to side-by-side view
Loading...
arch/mn10300/kernel/process.c Diff Switch to side-by-side view
Loading...
arch/parisc/hpux/fs.c Diff Switch to side-by-side view
Loading...
arch/parisc/kernel/process.c Diff Switch to side-by-side view
Loading...
arch/powerpc/kernel/process.c Diff Switch to side-by-side view
Loading...
arch/s390/kernel/process.c Diff Switch to side-by-side view
Loading...
arch/score/kernel/sys_score.c Diff Switch to side-by-side view
Loading...
1 2 > >> (Page 1 of 2)