freebsd-nq/sys/kern
Bruce Evans 20415301cd Fix security holes in sigreturn(), ptrace() and procfs. sigreturn()
attempted to check for insecure and fatal eflags and segment
selectors, but missed many cases and got the IOPL check back to
front.  The other syscalls didn't check at all.

sys_process.c, machdep.c:
Only allow PT_WRITE_U to write to the registers (ordinary and FP).

psl.h, locore.s, machdep.c:
Eliminate PSL_MBZ, PSL_MBO and PSL_USERCLR.  We are not supposed
to assume anything about the reserved bits.  Use PSL_USERCHANGE
and PSL_KERNEL instead.  Rename PSL_USERSET to PSL_USER.

exception.s:
Define a private label for use by doreti when returning to user
mode fails.

machdep.c:
In syscalls, allow changing only the eflags that can be changed on
486's in user mode (no longer attempt to allow benign IOPL changes;
allow changing the nasty PSL_NT; don't allow changing the i586
bits).

Don't attempt to check all the cases involving invalid selectors
and %eip's.  Just check for privilege violations and let the invalid
things cause a trap.

procfs_machdep.c:
Call the ptrace register functions to do all the work for reading
and writing ordinary registers and for single stepping.

trap.c:
Ignore traps caused by PSL_NT being set.  Previously, users could
cause a fatal trap in user mode by setting PSL_NT and executing an
iret, and a fatal trap in kernel mode by setting PSL_NT and making
a syscall.  PSL_NT was cleared too late and not in enough modes to
fix the problem.

Make all traps in user mode (except T_NMI) nonfatal.

Recover from traps caused by attempting to load invalid user
registers in doreti by restarting the traps so that they appear to
occur in user mode.
---

Fix bogons that I noticed while fixing the above:

psl.h:
Fix some comments.

Uniformize idempotency ifdef.

exception.s, machdep.c:
Remove rsvd[0-14].  rsvd0 hasn't been reserved since the 486 came
out.  Replace rsvd0 by `align'.  rsvd[0-11] used wrong (magic
non-unique) trap numbers.  Replace rsvd[1-14] by rsvd.

locore.s:
Enable alignment check flag on 486's and 586's.

machdep.c:
Use a better type for kstack[].

Use TFREGP() to find the registers.

Reformat ptrace functions from SEF to something closer to KNF.

procfs_machdep.c:
The wrong pointer to the registers got fixed as a side effect.

Implement reading and writing of FP registers.

/proc/*/*regs now work (only) for processes that are in memory.

Clean up comments.

trap.c, trap.h:
Remove unused trap types.
1995-01-14 13:20:26 +00:00
..
imgact_aout.c
imgact_gzip.c Make the diagnostics a little more useful. 1994-10-22 11:55:16 +00:00
imgact_shell.c
inflate.c I belive imgact_gzip is finally reentrant. It is also a whole lot more 1994-10-22 11:40:38 +00:00
init_main.c These changes fix a couple of lingering VM problems: 1994-11-25 07:58:29 +00:00
init_sysent.c Actually enable NTP kernel PLL. (Oops!) 1994-12-14 17:57:47 +00:00
kern_acct.c
kern_clock.c Obtained from: my old fix for 1.1.5 1994-12-12 11:58:46 +00:00
kern_descrip.c Obtained from: my fix for 1.1.5 1994-12-12 12:27:39 +00:00
kern_devconf.c Another part of Bill Paul's fix to swapgeneric to properly use the -a flag. 1994-12-31 17:15:16 +00:00
kern_exec.c These changes embody the support of the fully coherent merged VM buffer cache, 1995-01-09 16:06:02 +00:00
kern_exit.c Fixed multiple bugs that cause null pointers to be followed or FREEed data 1994-12-28 06:15:08 +00:00
kern_fork.c
kern_ktrace.c
kern_lkm.c Don't allow the same MISC module loading more than once.. 1994-10-12 20:28:32 +00:00
kern_lockf.c Changed some variable names in lf_addblock to make the code both 1994-10-25 11:27:51 +00:00
kern_malloc.c These changes embody the support of the fully coherent merged VM buffer cache, 1995-01-09 16:06:02 +00:00
kern_ntptime.c
kern_physio.c These changes embody the support of the fully coherent merged VM buffer cache, 1995-01-09 16:06:02 +00:00
kern_proc.c
kern_prot.c Added ifdef COMPAT_IBCS2 around setre[ug]id. 1994-10-13 20:59:49 +00:00
kern_resource.c Don't allow negative limits at all. Convert them to RLIM_INFINITY instead 1994-12-06 22:53:37 +00:00
kern_sig.c Security nitpicking: don't make *.core world readable 1994-11-06 11:13:02 +00:00
kern_subr.c
kern_synch.c Don't mess with already freed structures when a process is being run 1994-12-12 06:04:27 +00:00
kern_sysctl.c Fixed multiple bugs that cause null pointers to be followed or FREEed data 1994-12-28 06:15:08 +00:00
kern_tc.c Obtained from: my old fix for 1.1.5 1994-12-12 11:58:46 +00:00
kern_time.c
kern_timeout.c Obtained from: my old fix for 1.1.5 1994-12-12 11:58:46 +00:00
kern_xxx.c Implemented a "TEXT_SET" called 'cleanup_set' which will be called before 1994-12-04 19:58:43 +00:00
Make.tags.inc
Makefile
makesyscalls.sh Put a small hack into a large hack named makeyscall.sh. Generate only 1994-11-06 21:57:16 +00:00
md5c.c Added "const" to the arguments here and there. 1994-11-07 20:48:35 +00:00
subr_autoconf.c
subr_clist.c Fix cblock starvation bugs by reserving enough cblocks for minimal 1994-11-26 19:24:13 +00:00
subr_disklabel.c Print `slicename' and not a bogus pointer in diskerr() 1994-12-22 04:42:31 +00:00
subr_diskmbr.c Change an 0 to WHOLE_DISK_SLICE. 1994-12-30 12:19:11 +00:00
subr_diskslice.c Separate go-away code from dsinit() to produce dsgone(). 1994-12-16 16:14:39 +00:00
subr_dkbad.c subr_diskslice.c implements everything related to slices and labels except 1994-12-12 00:20:34 +00:00
subr_log.c
subr_param.c Increase maxfiles to NPROC*2. This makes the per-process open file limit 1995-01-12 03:38:12 +00:00
subr_prf.c Print "(null)" instead of "<null>" for NULL string args for consistency 1994-12-30 12:17:42 +00:00
subr_prof.c
subr_rlist.c
subr_rmap.c
subr_trap.c Fix security holes in sigreturn(), ptrace() and procfs. sigreturn() 1995-01-14 13:20:26 +00:00
subr_xxx.c
sys_generic.c Damn, check in the wrong version, fixed. 1994-10-13 21:41:36 +00:00
sys_process.c Fix security holes in sigreturn(), ptrace() and procfs. sigreturn() 1995-01-14 13:20:26 +00:00
sys_socket.c
syscalls.c
syscalls.master Actually enable NTP kernel PLL. (Oops!) 1994-12-14 17:57:47 +00:00
sysv_ipc.c
sysv_msg.c
sysv_sem.c
sysv_shm.c
tty_compat.c Better IXANY/IXOFF processing into setflags. 1994-10-11 20:29:42 +00:00
tty_conf.c
tty_cons.c Ooops, i forgot one NVT > 0 in a previous commit. Now pcvt will also 1994-12-18 19:42:41 +00:00
tty_pty.c write ptys use _the_same_ tsleep/wakeup address as read ptys due to 1994-10-29 23:59:48 +00:00
tty_subr.c Fix cblock starvation bugs by reserving enough cblocks for minimal 1994-11-26 19:24:13 +00:00
tty_tb.c
tty_tty.c don't allow ctty to be set to ctty - infinite kernel recursion 1994-12-04 01:46:13 +00:00
tty.c Fix error handling for new TIOCSDRAINWAIT ioctl. 1995-01-06 14:56:42 +00:00
uipc_domain.c Submitted by: Wolfgang Stanglmeier <wolf@dentaro.GUN.de> 1995-01-05 19:51:51 +00:00
uipc_mbuf.c
uipc_proto.c
uipc_sockbuf.c
uipc_socket2.c
uipc_socket.c
uipc_syscalls.c
uipc_usrreq.c
vfs_bio.c MFS doesn't bother to associate a struct mount with the vnode...so work 1995-01-11 01:53:18 +00:00
vfs_cache.c
vfs_cluster.c These changes embody the support of the fully coherent merged VM buffer cache, 1995-01-09 16:06:02 +00:00
vfs_conf.c Make a kernel sans FFS possible. 1994-11-12 01:47:43 +00:00
vfs_export.c Fixed some formatting weirdness that I overlooked in the previous commit. 1995-01-10 07:32:52 +00:00
vfs_extattr.c From tim@cs.city.ac.uk (Tim Wilkinson): 1994-11-04 14:41:46 +00:00
vfs_init.c Actually implement the functionality documented in sysctl.h for type CTL_FS. 1994-10-20 00:48:28 +00:00
vfs_lookup.c
vfs_mount.c Make a kernel sans FFS possible. 1994-11-12 01:47:43 +00:00
vfs_subr.c Fixed some formatting weirdness that I overlooked in the previous commit. 1995-01-10 07:32:52 +00:00
vfs_syscalls.c From tim@cs.city.ac.uk (Tim Wilkinson): 1994-11-04 14:41:46 +00:00
vfs_vnops.c These changes embody the support of the fully coherent merged VM buffer cache, 1995-01-09 16:06:02 +00:00
vnode_if.pl Added $Id$ 1994-08-02 07:55:43 +00:00
vnode_if.sh
vnode_if.src