Commit Graph

98 Commits

Author SHA1 Message Date
augustss 264f1d27c6 Get rid of register declarations. 2000-03-30 09:27:11 +00:00
fair 554df2b994 remove kern_logsigexit being "on" for DIAGNOSTIC 2000-02-08 04:13:51 +00:00
fair c75556a12f Add kernel logging of processes which exit on signals which can
cause a core to drop, and whether the core dropped, or, if it did
not, why not (i.e. error number). Logs process ID, name, signal that
hit it, and whether the core dump was successful.

logging only happens if kern_logsigexit is non-zero, and it can be
changed by the new sysctl(3) value KERN_LOGSIGEXIT. The name of this
sysctl and its function are taken from FreeBSD, at the suggestion
of Greg Woods in PR 6224. Default behavior is zero for a normal
kernel, and one for a kernel compiled with DIAGNOSTIC.
2000-02-06 07:29:56 +00:00
eeh f293acc959 Dump cores for 32-bit processes. 1999-12-30 16:00:23 +00:00
bouyer 52497e180a Remplace kern.shortcorename sysctl with a more flexible sheme,
core filename format, which allow to change the name of the core dump,
and to relocate it in a directory. Credits to Bill Sommerfeld for giving me
the idea :)
The default core filename format can be changed by options DEFCORENAME and/or
kern.defcorename
Create a new sysctl tree, proc, which holds per-process values (for now
the corename format, and resources limits). Process is designed by its pid
at the second level name. These values are inherited on fork, and the corename
fomat is reset to defcorename on suid/sgid exec.
Create a p_sugid() function, to take appropriate actions on suid/sgid
exec (for now set the P_SUGID flag and reset the per-proc corename).
Adjust dosetrlimit() to allow changing limits of one proc by another, with
credential controls.
1999-09-28 14:47:00 +00:00
bouyer 051211ffa9 Add a new flag, used by vn_open() which prevent symlinks from being followed
at open time. Use this to prevent coredump to follow symlinks when the
kernel opens/creates the file.
1999-08-31 12:30:35 +00:00
thorpej ea8fb3e04a Turn the proclist lock into a read/write spinlock. Update proclist locking
calls to reflect this.  Also, block statclock rather than softclock during
in the proclist locking functions, to address a problem reported on
current-users by Sean Doran.
1999-07-25 06:30:33 +00:00
thorpej 01a8cffe77 Add a read/write lock to the proclists and PID hash table. Use the
write lock when doing PID allocation, and during the process exit path.
Use a read lock every where else, including within schedcpu() (interrupt
context).  Note that holding the write lock implies blocking schedcpu()
from running (blocks softclock).

PID allocation is now MP-safe.

Note this actually fixes a bug on single processor systems that was probably
extremely difficult to tickle; it was possible that schedcpu() would run
off a bad pointer if the right clock interrupt happened to come in the
middle of a LIST_INSERT_HEAD() or LIST_REMOVE() to/from allproc.
1999-07-22 21:08:30 +00:00
thorpej 2715b812d1 Rework the process exit path, in preparation for making process exit
and PID allocation MP-safe.  A new process state is added: SDEAD.  This
state indicates that a process is dead, but not yet a zombie (has not
yet been processed by the process reaper).

SDEAD processes exist on both the zombproc list (via p_list) and deadproc
(via p_hash; the proc has been removed from the pidhash earlier in the exit
path).  When the reaper deals with a process, it changes the state to
SZOMB, so that wait4 can process it.

Add a P_ZOMBIE() macro, which treats a proc in SZOMB or SDEAD as a zombie,
and update various parts of the kernel to reflect the new state.
1999-07-22 18:13:36 +00:00
thorpej 2835fc6e46 Pull signal actions out of struct user, make them a separate proc
substructure, and allow them to be shared.

Required for clone(2).
1999-04-30 21:23:49 +00:00
thorpej 16936c9565 Break cdir/rdir/cmask info out of struct filedesc, and put it in a new
substructure, `cwdinfo'.  Implement optional sharing of this substructure.

This is required for clone(2).
1999-04-30 18:42:58 +00:00
mrg d2397ac5f7 completely remove Mach VM support. all that is left is the all the
header files as UVM still uses (most of) these.
1999-03-24 05:50:49 +00:00
christos ac66b8f92d Don't forget to lower the spl in the error case of sigprocmask 1999-02-13 15:25:51 +00:00
mycroft 1115f2e840 Er, NSIG is one *more* than the number of signals. 1998-11-13 17:23:52 +00:00
mycroft d6ffecf67c Oops; signal numbers are 1..NSIG, not 0..NSIG-1. 1998-11-13 17:12:54 +00:00
drochner 835d1b736c Make contsigmask, stopsigmask, sigcantmask kernel private. 1998-10-03 14:29:02 +00:00
enami 19031a5309 make this file compile again; the variable points signal action being
set is `nsa' and there is no variable `sa'.
1998-09-19 02:00:52 +00:00
christos eb1a214078 Add NOCLDWAIT (from FreeBSD) 1998-09-18 18:48:22 +00:00
pk 470227cc3b Check that the `current directory' is still mounted before dropping core in it. 1998-09-11 13:25:20 +00:00
mycroft fb526e055c Substantial signal handling changes:
* Increase the size of sigset_t to accomodate 128 signals -- adding new
  versions of sys_setprocmask(), sys_sigaction(), sys_sigpending() and
  sys_sigsuspend() to handle the changed arguments.
* Abstract the guts of sys_sigaltstack(), sys_setprocmask(), sys_sigaction(),
  sys_sigpending() and sys_sigsuspend() into separate functions, and call them
  from all the emulations rather than hard-coding everything.  (Avoids uses
  the stackgap crap for these system calls.)
* Add a new flag (p_checksig) to indicate that a process may have signals
  pending and userret() needs to do the full (slow) check.
* Eliminate SAS_ALTSTACK; it's exactly the inverse of SS_DISABLE.
* Correct emulation bugs with restoring SS_ONSTACK.
* Make the signal mask in the sigcontext always use the emulated mask format.
* Store signals internally in sigaction structures, rather than maintaining a
  bunch of little sigsets for each SA_* bit.
* Keep track of where we put the signal trampoline, rather than figuring it out
  in *_sendsig().
* Issue a warning when a non-emulated sigaction bit is observed.
* Add missing emulated signals, and a native SIGPWR (currently not used).
* Implement the `not reset when caught' semantics for relevant signals.

Note: Only code touched by the i386 port has been modified.  Other ports and
emulations need to be updated.
1998-09-11 12:50:05 +00:00
perry 275d1554aa Abolition of bcopy, ovbcopy, bcmp, and bzero, phase one.
bcopy(x, y, z) ->  memcpy(y, x, z)
ovbcopy(x, y, z) -> memmove(y, x, z)
   bcmp(x, y, z) ->  memcmp(x, y, z)
  bzero(x, y)    ->  memset(x, 0, y)
1998-08-04 04:03:10 +00:00
perry 730baa7431 fix sizeofs so they comply with the KNF style guide. yes, it is pedantic. 1998-07-31 22:50:48 +00:00
thorpej e95c22ee96 Don't cast the null residual pointer passed to vn_rdwr(). 1998-07-28 18:17:34 +00:00
nathanw 30cbf42b77 Implement short corefile name support, controlled by options SHORTCORENAME
and sysctl kern.shortcorename.

Closes PR kern/5191.
1998-06-28 21:34:58 +00:00
thorpej 8aee7782f5 defopt COMPAT_SUNOS 1998-06-25 23:40:33 +00:00
thorpej 808867c7cf defopt KTRACE 1998-06-25 21:17:15 +00:00
enami 9ad895e33c Backout previous issignal() change so that gdb can trace a process
which has subprocess again; the lite2 change conflicts our local change.
1998-05-07 00:45:16 +00:00
fvdl e5bc90f40c Merge with Lite2 + local changes 1998-03-01 02:20:01 +00:00
mrg d90485202c - add defopt's for UVM, UVMHIST and PMAP_NEW.
- remove unnecessary UVMHIST_DECL's.
1998-02-10 14:08:44 +00:00
mrg 1a8c7604f4 initial import of the new virtual memory system, UVM, into -current.
UVM was written by chuck cranor <chuck@maria.wustl.edu>, with some
minor portions derived from the old Mach code.  i provided some help
getting swap and paging working, and other bug fixes/ideas.  chuck
silvers <chuq@chuq.com> also provided some other fixes.

this is the rest of the MI portion changes.

this will be KNF'd shortly.  :-)
1998-02-05 07:59:28 +00:00
kleink 5d7a8f4a16 Modify the recent sigaltstack() interface change to use the __RENAME() scheme;
add __sigaltstack14().
1997-11-29 18:38:20 +00:00
mycroft d0a1101d26 Disable an effectively no-op reference to u_kproc, with an explanation of what
should be done with it eventually.
1997-10-16 02:45:39 +00:00
mycroft 701f15db33 Reinstate P_FSTRACE, with different semantics:
* Never send a SIGCHLD to the parent if P_FSTRACE is set.
* Do not permit mixing ptrace(2) and procfs; only permit using the one that
  was attached.
1997-04-28 04:49:27 +00:00
mycroft 43a0dc8b74 Remove remnants of P_FSTRACE, which is no longer used. 1997-04-28 02:51:41 +00:00
mycroft ead5e1a6f7 When stopping a process being traced through procfs, wake up the *parent* (in
case it happens to be doing a WAIT.
1997-04-28 02:36:05 +00:00
mycroft 1cf91041df Nuke the old COMPAT_09 truncation of UIDs, GIDs, process and process group IDs. 1997-04-23 18:59:53 +00:00
kleink c9c13ef470 Changed killpg1() to 'succeed' even if a process group consists of
SZOMB processes only; the POSIX.1 definition of a background process
group implies that kill(2)ing such a process group must succeed.
1997-04-03 21:08:27 +00:00
mikel 4ab6dc7d2e allow examination of SIGKILL and SIGSTOP signal handlers (but still
disallow changes); from Klaus Klein in PR standards/3398.
1997-03-27 07:52:25 +00:00
cgd e7af2a8237 * catch up with system call argument type fixups/const poisoning.
* Fix arguments to various copyin()/copyout() invocations, to avoid
  gratuitous casts.
* Some KNF formatting fixes
1996-12-22 10:21:06 +00:00
cgd 8595fc3073 make coredump() use more sensible error returns (even though they're
not used by anything, for now), and implement MNT_NOCOREDUMP by checking
whether or not MNT_NOCOREDUMP is set on the file system where the dump
would land (i.e. the file system of the process's current working
directory), and disallowing the core dump if it's set.
1996-10-23 23:13:19 +00:00
mrg 8fd70c1fe1 in coredump(), check the SUGID bit rather than testing various parts
of the cred structures.  this prevents a previously set[gu]id process
from generating a core file.
1996-10-18 08:39:34 +00:00
christos f443b89c92 backout previous kprintf change 1996-10-13 02:32:29 +00:00
christos 60d201973e printf -> kprintf, sprintf -> ksprintf 1996-10-10 22:46:11 +00:00
mycroft de1c962824 Don't core dump if ruid != euid or rgid != egid. 1996-09-01 01:56:10 +00:00
christos 4ef330b934 remove include of <sys/cpu.h> 1996-04-22 01:38:12 +00:00
christos 09afd77655 More proto fixes 1996-02-09 18:59:18 +00:00
christos 8a5b1b92e2 First pass at prototyping 1996-02-04 02:15:01 +00:00
jtc 2fce159ff8 Changed name of sigaltstack's ss_base field to ss_sp to match XPG4.2 and
traditional usage.
1996-01-04 22:21:33 +00:00
mycroft 245f292fed Prefix names of system call implementation functions with `sys_'. 1995-10-07 06:25:19 +00:00
mycroft 2d9aa901e9 Write core dumps with mode 0600. 1995-10-06 16:12:05 +00:00