Commit Graph

3124 Commits

Author SHA1 Message Date
thorpej b9cdec841a Pass the process priority we want to compare to resched_proc(). Restores
resetpriority() behavior.  Thanks to Enami Tsugutomo for pointing out my
mistake.
2003-01-15 07:12:20 +00:00
matt c838a0fb9e In vmcmd_readvn, if the page is mapped executable and PMAP_NEED_PROCWR
is defined, call pmap_procwr to synchronize the icache.  This fixes the
problem of dynamic programs crashing on powerpc systems.
2003-01-12 05:24:17 +00:00
pk da40c6dd43 schedcpu(): after updating the process CPU tick counters, we no longer need
to run at splstatclock(); continue at splsched().
2003-01-12 01:48:56 +00:00
msaitoh f0f871744a remove cinit()
This functions is completely null, not called from anywhere and
defined since rev. 1.1 (July 1993).
2003-01-08 12:00:25 +00:00
wiz 1035faff1d writable, not writeable. 2003-01-06 20:30:28 +00:00
wiz a2278794f4 descriptor, not decriptor. 2003-01-06 13:19:51 +00:00
mrg 78ccb64bb2 move #include <sys/reboot.h> with the rest of the <sys/...> headers. 2003-01-02 00:12:16 +00:00
augustss 33c067f13e Make it compile without USERCONF. 2003-01-01 17:06:59 +00:00
mycroft d73e77b28c Update copyright notice. 2003-01-01 00:00:13 +00:00
thorpej 0d3b1b8a4f Add support for quiet and silent boots to the autoconfiguration
message machinery.

Quiet boots look like this (inspired by BSD/OS):
.
.
Found tlp0 at pci0
.
.
Found wd0 at wdc0
.
.

Silent boots look like this:
.
.
Detecting hardware...<twiddle>done.
.
.

NOTE: This requires cooperation on the part of all device drivers,
changes to which have not yet been checked in.
2002-12-31 23:59:11 +00:00
thorpej f631b51555 Add aprint_error(), which is like aprint_normal(), but also records
the number of times it is called.  This allows subsystems to report
the number of errors that occurred during a quiet/silent subsystem
startup.  aprint_get_error_count() reports this count and resets it
to 0.

Also add printf_nolog(), which is like printf(), but prevents the
output from hitting the system log.
2002-12-31 23:45:36 +00:00
thorpej 3770328cab Add the following message printing routines, designed for printing
autoconfiguration messages:

aprint_normal: Send to console unless AB_QUIET.  Always goes to the log.
aprint_naive: Send to console only if AB_QUIET.  Never goes to the log.
aprint_verbose: Send to console only if AB_VERBOSE.  Always goes to the log.
aprint_debug: Send to console and log only if AB_DEBUG.

API inspired by the same routines in BSD/OS.

Will be used to address kern/5155.
2002-12-31 17:48:03 +00:00
thorpej 438dc24855 Partially expose some of the kernel printf internals in the new
<sys/kprintf.h> header file.  This allows subsystems that need
printf semantics other than what are provided by the standard
kernel printf routines to implement exactly what they want.
2002-12-31 16:53:26 +00:00
thorpej 85c31b11c3 * Move the resched check from setrunnable() and resetpriority() to
a new inline, resched_proc().
* When performing the resched check, check the priority against the
  current priority on the CPU the process last ran on, not always the
  current CPU.
2002-12-29 17:40:26 +00:00
yamt 78d9abec0c sync comment for vflush with reality.
from FreeBSD.
2002-12-29 06:47:57 +00:00
thorpej 63ccfc36f6 Add a comment about affinity to awaken(). 2002-12-29 02:08:39 +00:00
gmcgarry f8f2c11fe0 Re-add yield(). Only used by compat code at the moment. 2002-12-21 23:52:05 +00:00
manu 4a06119a9d Pass the system call table to trace_enter() and ktrsys() so that it is
possible to use alternate system call tables. This is usefull for
displaying correctly the arguments in Mach binaries traces.

If NULL is given, then the regular systam call table for the process is used.
2002-12-21 16:23:56 +00:00
gmcgarry a5424a9df1 Remove yield() until the scheduler supports the sched_yield(2) system
call.
2002-12-20 05:43:09 +00:00
gmcgarry 74da856861 yield() -> preempt(). 2002-12-20 05:06:25 +00:00
thorpej 4c82425f5e Regen: reserved syscall slots for sigwaitinfo(2), sigtimedwait(2),
and sigqueue(2).
2002-12-19 23:53:42 +00:00
thorpej 39e4cd68c4 Reserve syscall slots for sigwaitinfo(2), sigtimedwait(2), and
sigqueue(2).
2002-12-19 23:51:00 +00:00
manu 5ba396cfb3 Added support for exchange of Mach messages between processes.
This does not buy us new functionnality for now, because we still have to
discover how mach_init (which acts as a name server, enabling processes to
discover each other's ports) is able to receive messages from other processes
(this is a bootstrap problem, and the bootstrap port might be the place to
search).

While we are there:
- removed a lot of debug which is now available using ktrace.
- reworked message handling to avoid mutliple copyin/copyout of the
same data. ktrace of Mach message now uses the in-kernel copy of the
message instead of copying it from userland.
- packed mach trap handlers arguments into a structure to avoid modifying
everything next time we have to add an argument.
2002-12-17 18:42:54 +00:00
jdolecek 94062cc04a add support for optional arch-specific restriction of valid value
for kern.maxproc
2002-12-16 18:15:18 +00:00
jdolecek 300acddf8c don't allow kern.maxproc bigger than PID_MAX - PID_SKIP; the pid allocation
code in fork1() would enter endless loop if all the allowed pids are taken
by running processes
2002-12-12 20:54:58 +00:00
jdolecek d18332248c replace magic number '500' in pid allocation code with a macro PID_SKIP,
defined in <sys/proc.h> (along PID_MAX, NO_PID)
2002-12-12 20:41:45 +00:00
christos 80564fa341 always compile in mach ktrace support; it is to small to bother. 2002-12-12 17:40:40 +00:00
abs 39387a63f4 Define nofile and maxuprc variables (set to NOFILE and MAXUPRC), so they can
be patched in a compiled kernel.
2002-12-11 23:23:45 +00:00
manu 4d607adf4f Load __OBJC and ____CGSERVER sections of Mach-O binaries as __TEXT. 2002-12-11 19:28:41 +00:00
jdolecek 5fd22809a5 Add kern.forkfsleep sysctl - set/get time (in miliseconds) for which
process would be forced to sleep in fork() if it hits either global
or user maxproc limit. Default is zero (no forced sleep).
Maximum is 20 seconds.
2002-12-11 19:14:34 +00:00
atatat 7ede0eeb03 Provide a ioctl called FIOGETBMAP (there are some who call
it...FIBMAP) that translates a logical block number to a physical
block number from the underlying device.  Via VOP_BMAP().
2002-12-11 18:25:03 +00:00
jdolecek f13ab92159 put back portion of fork-bomb protection removed in last commit,
and make the sleep length depend on value of variable forkfsleep;
it's set to zero by default (no sleep)
this is a preparation for making the sleep length settable via sysctl
2002-12-11 18:09:07 +00:00
scw 39a5a9dc76 Add two sysctls: kern.labelsector and kern.labeloffset.
These are of use to userland code which previously depended on the
hard-coded values of LABELSECTOR and LABELOFFSET to figure out the
location of the disklabel for a particular platform.

With the introduction of umbrella ports such as evbarm, evbmips, etc,
the location of the disklabel may vary between kernels for the same
MACHINE. This sysctl will allow userland programs to remain independent
of the particular flavour of MACHINE in such cases.
2002-12-11 12:59:29 +00:00
groo b9df764f32 Remove portion of fork-bomb protection that has unfortunate side effects. 2002-12-11 05:01:22 +00:00
thorpej e8cc3884de Rename __LDPGSZ to AOUT_LDPGSZ, to accurately reflect what it is. 2002-12-10 17:14:02 +00:00
thorpej 78ea2dd367 Use __LDPGSZ (which must be == USRTEXT) as the text address for a.out
executables, and eliminate the USRTEXT constant, which was only used
by the a.out exec code.
2002-12-10 05:14:24 +00:00
manu 6492e2171f Added support for dumping mach messages in ktrace/kdump. While we are
there, KNFify a few functions.
2002-12-09 21:29:20 +00:00
christos 0948705ad2 s/NOSYMLINK/O_NOFOLLOW/ 2002-12-06 22:44:49 +00:00
jdolecek 4c7e9f23da pipe_stat(): add S_IRUSR and S_IWUSR to mode; this is what Linux does,
and seems like generally sensible (more sensible than not doing so), so done
in generic code rather than compat glue only

Change proposed in PR kern/18767 by Emmanuel Dreyfus.
2002-12-05 16:30:55 +00:00
jdolecek 16e3e3cd55 Couple fork-bomb defense changes:
- leave 5 processes for root-only use, the previous value of 1
  was unsufficient to execute additional commands once logged, and
  perhaps also not enough to actually login remotely with recent (open)sshd
- protect the log of "proc: table full" with ratecheck(), so that
  the message is only logged once per 10 seconds; though syslogd normally
  doesn't pass the repeated messages through, this avoids flooding
  syslogd and potentially also screen/logs
- If the process hits either system limit of number of processes in system,
  or user's limit of same, force the process to sleep for 0.5 seconds
  before returning failure. This turns 2000 rampaging fork monsters into
  2000 harmlessly snoozing fork monsters.
  The sleep is intentionally uninterruptible by signals.

These are not intended as ultimate protection agains fork-bombs.
Determined attacker can eat CPU differently than via repeating
fork() calls. But this is good enough to help protect against
programming mistakes or simple-minded tests.

Based on FreeBSD kern_fork.c change in revision 1.132 by
Mike Silbersack <silby at FreeBSD org>

Change also discussed on tech-kern@NetBSD.org, thread
'Fork bomb protection patch'.
2002-12-05 16:24:46 +00:00
yamt 172a847692 initialize uvm.aiodoned_proc. 2002-12-05 10:30:00 +00:00
jdolecek 2c21ec9d61 Unfortunately, we can't really know if select collision is needed
until after wakeup event, so we can't clear the SI_COLL flag
in selrecord(). Thus, effectively back rev. 1.57 off.

Problem reported in PR kern/17517 by David Laight, program triggering
the problem is in regress/sys/kern/poll/poll3w.c.
2002-11-30 13:46:58 +00:00
jdolecek 555659c55c there is single emul_irix now
use irix_n32_setregs for the IRIX n32 execsw entry
2002-11-30 13:19:37 +00:00
manu 005949afda cosmetic fix 2002-11-30 11:20:51 +00:00
jdolecek 615f789e98 fix typo in comment. pointed out by David Sainty 2002-11-30 09:59:22 +00:00
jdolecek e0d29a5578 fix bug in previous - if child was traced and p_opptr == p_pptr,
need to reparent the process to initproc, so that child wouldn't
have its p_pptr pointer still pointing on the exited parent

pointed out by Dave Sainty in private mail (the patch in kern/14443
didn't have this bug)
2002-11-30 09:54:43 +00:00
jdolecek a45e0497c5 selwakeup(): don't bother with pfind() in SI_COLL case; sel_pid is always zero
in this case, and even if not, the process would be already woken up by the
wakeup() call
change sent as part of kern/17517 by David Laight

XXX perhaps should KASSERT() sel_pid is zero in the SI_COLL case
2002-11-29 19:48:22 +00:00
manu 39b522c107 back out the previous change, which is useless. Darwin loads the libraries
that are required by the binary, not the libraries required by the libraries
required by the binary.

Hopefully, binaries should load again on i386.
2002-11-29 15:49:09 +00:00
manu b36d0c1bf6 Maitain a chainedlist of already loaded Mach-O objects, to avoid loading
the same file multiple times because of recursive loading (ie: libx require
liby and libz and liby require libz, so libz would be loaded twice)

This is probably suboptimal, but it enable /bin/sh to load on the PowerPC,
so it's a good interim solution until we figure precisely how things should
work.

I'm not sure whether this makes the excessive recursive check useless or not.
2002-11-29 11:31:11 +00:00
jdolecek b439ca6951 exit1(): make sure that, if orphaned child is being traced, it's
reparented back to original parent before it's killed.
This makes the original parent aware that the child has exited if
the debugger failed to wait() on the debugged zombie before exiting.
Since we clear tracing flags before killing the child, the reparenting
logic in wait4() wouldn't be triggered, so it's necessary to do it here.

Problem reported and fix provided in kern/14443 by David Sainty.
2002-11-28 21:41:29 +00:00