freebsd-nq/sys
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
..
alpha/include First round in syscons update. Several new features has been added: 1995-01-12 11:47:05 +00:00
amd64 Fix security holes in sigreturn(), ptrace() and procfs. sigreturn() 1995-01-14 13:20:26 +00:00
compile Stop cvs up -P from removing empty compile directories. 1994-08-25 16:20:16 +00:00
conf Change DISTRIBUTION names. Also make bsd.doc.mk go to doc distribution, 1995-01-14 07:51:10 +00:00
ddb Print "(null)" instead of crashing for null strings. Null names are 1994-10-30 20:55:44 +00:00
dev Oops, forgot one change when DDB is defined. 1995-01-13 17:13:13 +00:00
fs These changes embody the support of the fully coherent merged VM buffer cache, 1995-01-09 16:06:02 +00:00
gnu Full support for 294x and Wide devices. Fixed month old bug in the SCSI 1995-01-13 02:22:11 +00:00
i386 Fix security holes in sigreturn(), ptrace() and procfs. sigreturn() 1995-01-14 13:20:26 +00:00
isa Oops, forgot one change when DDB is defined. 1995-01-13 17:13:13 +00:00
isofs/cd9660 Remove the bogus include of <sys/dkbad.h>. 1994-11-14 07:01:58 +00:00
kern Fix security holes in sigreturn(), ptrace() and procfs. sigreturn() 1995-01-14 13:20:26 +00:00
libkern Always build libkern_p.a. `NOPROFILE' should only control user libraries. 1995-01-10 01:57:56 +00:00
miscfs Initialize map start hint to vm_map_find()...not doing so will cause it 1995-01-05 03:59:38 +00:00
modules Checking new lkm structure.. 1995-01-12 13:57:51 +00:00
msdosfs These changes embody the support of the fully coherent merged VM buffer cache, 1995-01-09 16:06:02 +00:00
net Submitted by: Wolfgang Stanglmeier <wolf@dentaro.GUN.de> 1995-01-05 19:51:51 +00:00
netccitt Update calls to rtalloc1() to match. 1994-12-13 22:32:17 +00:00
netinet Actual firewall change. 1995-01-12 13:06:32 +00:00
netiso Update calls to rtalloc1(). 1994-12-13 22:33:05 +00:00
netns Include <sys/systm.h> to get inlines for spl*() so that LINT kernel links. 1994-11-15 14:26:31 +00:00
nfs Fix conversion to/from nfs v2 time in handling microseconds. 1995-01-10 13:11:42 +00:00
nfsclient Added two missing brelse() calls. 1995-01-10 13:06:51 +00:00
nfsserver These changes embody the support of the fully coherent merged VM buffer cache, 1995-01-09 16:06:02 +00:00
pci Add in aic7770.c (EISA/VL Adaptors) and aic7870.c (PCI adaptor) dependancies 1995-01-13 02:23:27 +00:00
powerpc/include Added $Id$ 1994-08-02 07:55:43 +00:00
rpc Use the header files that are compatible with the code just moved over 1994-08-07 18:41:02 +00:00
scsi Ensured all files have copyright and RCS ID variable. 1995-01-08 15:56:10 +00:00
sys These changes embody the support of the fully coherent merged VM buffer cache, 1995-01-09 16:06:02 +00:00
tools Added $Id$ 1994-08-02 07:55:43 +00:00
ufs These changes embody the support of the fully coherent merged VM buffer cache, 1995-01-09 16:06:02 +00:00
vm Protect a qcollapse call with an object lock before calling. The locks 1995-01-13 13:30:24 +00:00
Makefile Added ${MACHINE}/boot to build bootblocks. 1994-08-25 13:54:28 +00:00