Subject: CVS commit: src/sys
To: None <source-changes@NetBSD.org>
From: Chuck Silvers <chs@netbsd.org>
List: source-changes
Date: 08/24/2003 17:52:48
Module Name:	src
Committed By:	chs
Date:		Sun Aug 24 17:52:48 UTC 2003

Modified Files:
	src/sys/arch/alpha/alpha: pmap.c trap.c
	src/sys/arch/alpha/include: pmap.h pte.h
	src/sys/arch/i386/i386: freebsd_machdep.c ibcs2_machdep.c machdep.c
	    pmap.c svr4_machdep.c trap.c
	src/sys/arch/i386/include: pcb.h pmap.h pte.h segments.h vmparam.h
	src/sys/arch/powerpc/ibm4xx: pmap.c trap.c
	src/sys/arch/powerpc/include/oea: pmap.h pte.h
	src/sys/arch/powerpc/oea: pmap.c
	src/sys/arch/powerpc/powerpc: trap.c
	src/sys/arch/sparc/sparc: pmap.c trap.c
	src/sys/arch/sparc64/include: pmap.h
	src/sys/arch/sparc64/sparc64: clock.c db_interface.c locore.s pmap.c
	src/sys/compat/aout: aout_exec.c
	src/sys/compat/aoutm68k: aoutm68k_exec.c
	src/sys/compat/darwin: darwin_exec.c
	src/sys/compat/freebsd: freebsd_exec.c
	src/sys/compat/hpux: hpux_exec.c
	src/sys/compat/ibcs2: ibcs2_exec.c
	src/sys/compat/irix: irix_exec.c irix_exec.h
	src/sys/compat/linux/arch/i386: linux_machdep.c
	src/sys/compat/linux/common: linux_exec.c
	src/sys/compat/mach: mach_exec.c
	src/sys/compat/netbsd32: netbsd32_netbsd.c
	src/sys/compat/osf1: osf1_exec.c
	src/sys/compat/pecoff: pecoff_emul.c
	src/sys/compat/sunos: sunos_exec.c
	src/sys/compat/sunos32: sunos32_exec.c
	src/sys/compat/svr4: svr4_exec.c
	src/sys/compat/svr4_32: svr4_32_exec.c
	src/sys/compat/ultrix: ultrix_misc.c
	src/sys/kern: exec_subr.c kern_exec.c kern_resource.c
	src/sys/sys: proc.h
	src/sys/uvm: uvm_unix.c

Log Message:
add support for non-executable mappings (where the hardware allows this)
and make the stack and heap non-executable by default.  the changes
fall into two basic catagories:

 - pmap and trap-handler changes.  these are all MD:
   = alpha: we already track per-page execute permission with the (software)
	PG_EXEC bit, so just have the trap handler pay attention to it.
   = i386: use a new GDT segment for %cs for processes that have no
	executable mappings above a certain threshold (currently the
	bottom of the stack).  track per-page execute permission with
	the last unused PTE bit.
   = powerpc/ibm4xx: just use the hardware exec bit.
   = powerpc/oea: we already track per-page exec bits, but the hardware only
	implements non-exec mappings at the segment level.  so track the
	number of executable mappings in each segment and turn on the no-exec
	segment bit iff the count is 0.  adjust the trap handler to deal.
   = sparc (sun4m): fix our use of the hardware protection bits.
	fix the trap handler to recognize text faults.
   = sparc64: split the existing unified TSB into data and instruction TSBs,
	and only load TTEs into the appropriate TSB(s) for the permissions.
	fix the trap handler to check for execute permission.
   = not yet implemented: amd64, hppa, sh5

 - changes in all the emulations that put a signal trampoline on the stack.
   instead, we now put the trampoline into a uvm_aobj and map that into
   the process separately.

originally from openbsd, adapted for netbsd by me.


To generate a diff of this commit:
cvs rdiff -r1.202 -r1.203 src/sys/arch/alpha/alpha/pmap.c
cvs rdiff -r1.80 -r1.81 src/sys/arch/alpha/alpha/trap.c
cvs rdiff -r1.62 -r1.63 src/sys/arch/alpha/include/pmap.h
cvs rdiff -r1.27 -r1.28 src/sys/arch/alpha/include/pte.h
cvs rdiff -r1.37 -r1.38 src/sys/arch/i386/i386/freebsd_machdep.c
cvs rdiff -r1.22 -r1.23 src/sys/arch/i386/i386/ibcs2_machdep.c
cvs rdiff -r1.532 -r1.533 src/sys/arch/i386/i386/machdep.c
cvs rdiff -r1.156 -r1.157 src/sys/arch/i386/i386/pmap.c
cvs rdiff -r1.68 -r1.69 src/sys/arch/i386/i386/svr4_machdep.c
cvs rdiff -r1.184 -r1.185 src/sys/arch/i386/i386/trap.c
cvs rdiff -r1.34 -r1.35 src/sys/arch/i386/include/pcb.h
cvs rdiff -r1.74 -r1.75 src/sys/arch/i386/include/pmap.h
cvs rdiff -r1.13 -r1.14 src/sys/arch/i386/include/pte.h
cvs rdiff -r1.37 -r1.38 src/sys/arch/i386/include/segments.h
cvs rdiff -r1.53 -r1.54 src/sys/arch/i386/include/vmparam.h
cvs rdiff -r1.25 -r1.26 src/sys/arch/powerpc/ibm4xx/pmap.c
cvs rdiff -r1.14 -r1.15 src/sys/arch/powerpc/ibm4xx/trap.c
cvs rdiff -r1.4 -r1.5 src/sys/arch/powerpc/include/oea/pmap.h
cvs rdiff -r1.2 -r1.3 src/sys/arch/powerpc/include/oea/pte.h
cvs rdiff -r1.13 -r1.14 src/sys/arch/powerpc/oea/pmap.c
cvs rdiff -r1.84 -r1.85 src/sys/arch/powerpc/powerpc/trap.c
cvs rdiff -r1.268 -r1.269 src/sys/arch/sparc/sparc/pmap.c
cvs rdiff -r1.138 -r1.139 src/sys/arch/sparc/sparc/trap.c
cvs rdiff -r1.28 -r1.29 src/sys/arch/sparc64/include/pmap.h
cvs rdiff -r1.60 -r1.61 src/sys/arch/sparc64/sparc64/clock.c
cvs rdiff -r1.70 -r1.71 src/sys/arch/sparc64/sparc64/db_interface.c
cvs rdiff -r1.178 -r1.179 src/sys/arch/sparc64/sparc64/locore.s
cvs rdiff -r1.142 -r1.143 src/sys/arch/sparc64/sparc64/pmap.c
cvs rdiff -r1.15 -r1.16 src/sys/compat/aout/aout_exec.c
cvs rdiff -r1.12 -r1.13 src/sys/compat/aoutm68k/aoutm68k_exec.c
cvs rdiff -r1.16 -r1.17 src/sys/compat/darwin/darwin_exec.c
cvs rdiff -r1.19 -r1.20 src/sys/compat/freebsd/freebsd_exec.c
cvs rdiff -r1.37 -r1.38 src/sys/compat/hpux/hpux_exec.c
cvs rdiff -r1.52 -r1.53 src/sys/compat/ibcs2/ibcs2_exec.c
cvs rdiff -r1.29 -r1.30 src/sys/compat/irix/irix_exec.c
cvs rdiff -r1.19 -r1.20 src/sys/compat/irix/irix_exec.h
cvs rdiff -r1.94 -r1.95 src/sys/compat/linux/arch/i386/linux_machdep.c
cvs rdiff -r1.64 -r1.65 src/sys/compat/linux/common/linux_exec.c
cvs rdiff -r1.32 -r1.33 src/sys/compat/mach/mach_exec.c
cvs rdiff -r1.73 -r1.74 src/sys/compat/netbsd32/netbsd32_netbsd.c
cvs rdiff -r1.31 -r1.32 src/sys/compat/osf1/osf1_exec.c
cvs rdiff -r1.5 -r1.6 src/sys/compat/pecoff/pecoff_emul.c
cvs rdiff -r1.40 -r1.41 src/sys/compat/sunos/sunos_exec.c
cvs rdiff -r1.14 -r1.15 src/sys/compat/sunos32/sunos32_exec.c
cvs rdiff -r1.49 -r1.50 src/sys/compat/svr4/svr4_exec.c
cvs rdiff -r1.9 -r1.10 src/sys/compat/svr4_32/svr4_32_exec.c
cvs rdiff -r1.86 -r1.87 src/sys/compat/ultrix/ultrix_misc.c
cvs rdiff -r1.39 -r1.40 src/sys/kern/exec_subr.c
cvs rdiff -r1.170 -r1.171 src/sys/kern/kern_exec.c
cvs rdiff -r1.72 -r1.73 src/sys/kern/kern_resource.c
cvs rdiff -r1.168 -r1.169 src/sys/sys/proc.h
cvs rdiff -r1.28 -r1.29 src/sys/uvm/uvm_unix.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.