Commit Graph

3682 Commits

Author SHA1 Message Date
jdolecek 8f8952e2b1 add a macro to copy ksiginfo_t, and use it in kern_sig.c:ksiginfo_put()
change suggested by Christian Limpach
2003-11-01 17:59:57 +00:00
jdolecek 3abecdb88d avoid stong words in comments 2003-11-01 17:35:42 +00:00
cl 5d2db86263 cleanup whitespace and debugging output 2003-11-01 15:36:35 +00:00
jdolecek 0b33ae64cb in sigtimedwait(), use malloc(9)ed (and thus wired) memory for the waitset
we pass via sigctx, so that it guaranteed that the memory wouldn't be
paged out at the time the signal arrives

potential problem pointed out by YAMAMOTO Takashi
2003-11-01 07:44:14 +00:00
christos ddb8b44bce include opt_malloclog.h 2003-11-01 07:07:31 +00:00
cl f6e633af3a - add missing P_WEXIT check
- assign lwp to sa_vp before setting P_SA/L_SA flags
- don't unlock/lock the kernel lock around mi_switch unnecessarily
2003-11-01 02:09:52 +00:00
cl b936d40f39 Avoid sneaking past signal delivery in sa_upcall_userret():
generate unblocked upcalls in sa_unblock_userret(), before signal
delivery/p_userret handling in userret().

Also defer getting state for preempted upcalls because on some ports
preemption can happen between sa_unblock_userret() and sa_upcall_userret().
2003-11-01 01:38:46 +00:00
cl 8edffb7356 Avoid race condition where an LWP is put into the cache before
its state is saved:
- don't sa_putcachelwp() in sa_vp_repossess/sa_vp_donate
- only defer saving the event LWP's state
- sa_putcachelwp() after the interrupted LWP's state is saved
2003-10-31 23:36:50 +00:00
cl 8904362ede Allow defer of event and interrupted LWP state independently.
Removes code duplication in sa_upcall_getstate() and allows
sa_upcall_getstate() to be used to get state of a single LWP.
2003-10-31 22:47:44 +00:00
cl def5d22a63 Don't PHOLD() in sa_putcachelwp() because the scheduler lock is held.
PHOLD() before grabbing the scheduler lock unless the lwp is curlwp.
2003-10-31 22:03:18 +00:00
drochner f1aa108dd8 -fix ELF_INTERP_NON_RELOCATABLE:
-obey ELF_LINK_ADDR in ELF_load_file()
 -set ELF_LINK_ADDR in the probe() function if needed
-make ELF_NULL_ADDR the default, so that probe() functions dont need
 to set it explicitely
-allocate buffer for interpreter name only if needed
2003-10-31 14:00:52 +00:00
simonb 183066a619 Remove some assigned-to but otherwise unused variables. 2003-10-31 03:32:19 +00:00
simonb 6d85c5e0d5 Don't pass the (unused) return value args to the
trace_enter()/systrace_enter() functions.
2003-10-31 03:28:12 +00:00
cl 68a0d153d2 Don't grab the sched lock in lwp_continue() because lwp_continue() is
called from kpsignal2() with the sched lock held.  Get the lock in
sys__lwp_continue() instead.
2003-10-30 23:31:21 +00:00
jdolecek 5a9f1cf173 ksiginfo_put(): only copy what's needed of ksiginfo_t, to slightly optimize
the operation, and improve code readability at the same time
2003-10-30 16:32:58 +00:00
provos 4b425670af use a two-level bitmap as suggested by mogul and banga for fdalloc;
approved thorpej@
2003-10-30 07:27:02 +00:00
thorpej 67f69c1c63 Make callout_setfunc() a CPP macro. Suggested by enami. 2003-10-30 04:32:56 +00:00
simonb b6abb6ab1d Remove some assigned-to but otherwise unused variables. 2003-10-30 01:58:17 +00:00
thorpej db71356cd1 - Change callout_setfunc() to require that the callout handle is already
initialized.  Update the txp(4) to compensate.
- Statically initialize the TCP timer callout handles in the tcpcb
  template.  We still use callout_setfunc(), but that call is now much
  less expensive.  Add a comment that the compiler is likely to unroll
  the loop (so don't sweat that it's there).
2003-10-27 16:52:01 +00:00
fvdl 404fa205d1 Fix (bogus) unitialized variable warning. 2003-10-26 20:55:57 +00:00
jdolecek ad67de5ad8 move ALLOCSYS() macro from <sys/systm.h> to kern_alloc.c - it's the
only place which uses it
2003-10-26 10:45:03 +00:00
jdolecek 2e59e9ae06 allocate virtual memory for SYSV shm, msg and semaphore structures
separately from the bufpages, so that it would be possible to eventually
make their limits changeable in runtime

make static all local variables which do not need to be exported to other
kernel parts
2003-10-26 10:32:24 +00:00
lukem f85d2d1c14 Use ${HOST_SH} instead of `sh'.
If necessary, pull in <bsd.sys.mk> to get the definition of HOST_SH;
Makefiles that pull in one of (most of) <bsd.*.mk> will get this anyway.
2003-10-26 07:25:33 +00:00
christos 2017bf9a94 Fix uninitialized variable warning 2003-10-25 18:31:59 +00:00
jdolecek 0c303462c5 modify sigtimedwait(2) to return full siginfo if available, and pass the wait
set using a pointer, to save couple bytes in struct sigctx

also fix fallout from recent lwp_wakeup() change, where we failed to properly
detect if tsleep() returned as result of lwp_wakeup() or signal outside
our wait set; could have caused problems for threaded apps using sigwait(2)
et.al.
2003-10-25 16:50:37 +00:00
yamt 01de53d5f4 don't assume the order of upcall stacks in the array from userland.
(it's reversed in the case of topdown vm.)

kern/23266 from Kouichirou Hiratsuka and tested by him.
2003-10-25 12:08:45 +00:00
christos cb02efca51 fix uninitialized variable 2003-10-25 09:06:51 +00:00
christos 9ff8e797c6 fix uninitialized variables. one of them is a compiler bug. 2003-10-25 09:03:59 +00:00
kleink 661f76699f POSIX: when attempting to fdatasync(2) a file which is not open for
writing, fail with EBADF.
2003-10-25 01:18:01 +00:00
yamt a526db13df sa_unblockyield:
don't assert that syscall arguments are sane.
return an appropriate error instead.
2003-10-24 16:11:21 +00:00
yamt 3f32c6ab70 don't use NULL as vaddr_t. 2003-10-24 00:53:43 +00:00
thorpej 4011fcfefd Cache the "adjusted" value of sb_max when sb_max is changed, in order
to avoid doing quad math in sbreserve().

Change suggested by Simon Burge, and code inspired by a similar change
in FreeBSD.
2003-10-21 22:55:47 +00:00
manu a591d65ec7 One more section type in the Mach-O format. Now /usr/X11R6/bin/quartz-wm links
and run (it aborts because the dock is not launched).
2003-10-20 22:42:40 +00:00
wiz 48f28cea9e sa_vp_faultaddr, sa_vp_ofaultaddr, sa_vp_stacks_low, and sa_vp_stacks_high
are vaddr_t (and thus unsigned long).
Initialize them with 0 instead of NULL.
Closes PR 23204 by Dheeraj Reddy.
2003-10-20 07:15:26 +00:00
manu d77ec799a5 Support Darwin static binaries (I should say: support the only Darwin
static binary: otool). Dynamic binaires have a pointer to the Mach-O
header on the top of the stack, static binaries don't have this, and
having it produced a crash.

One bugfix: the EXEC_MACHO code assumes that entry = NULL means that
the entry point has not been found in the load commands seen so far.
Therefore we need to initialized entry to NULL if we want a static binary
to discover it. (dynamic binaries were forced to iscover it because when
the intepreter load command is found, entry is updated whatever its
value was before).

One hack: Both COMPAT_MACH and COMPAT_DARWIN are willing to run Mach-O
binaries. COMPAT_MACH fails for dynamic binaries because it cannot find
the interpreter in /emul/mach. For static binaires, it will accept them
(and for Darwin static binaries, this will cause a failure). Until we
rite a test for matchinf Darwin static binaries, just swap the order of
COMPAT_MACH and COMPAT_DARWIN in the exec switch so that COMPAT_DARWIN
is tried first (this will have the advantage of speeding up program
startup). EXECSW_PRIO_{FIRST_LAST} does not seem to work...
2003-10-19 07:52:22 +00:00
simonb 59fb31d7cc Remove unreachable break after return and goto statements. 2003-10-19 01:44:48 +00:00
thorpej eea31306c8 Remove the superuser check for MNT_FORCE on new mounts. It's been
pointed out by several people that it offers no real protection.
2003-10-15 17:26:38 +00:00
hannken a3a898ff0f Add the gating of system calls that cause modifications to the underlying
file system.
The function vfs_write_suspend stops all new write operations to a file
system, allows any file system modifying system calls already in progress
to complete, then sync's the file system to disk and returns. The
function vfs_write_resume allows the suspended write operations to
complete.

From FreeBSD with slight modifications.

Approved by: Frank van der Linden <fvdl@netbsd.org>
2003-10-15 11:28:59 +00:00
dbj fe7c786886 add mnt_iflag field to struct mount for internal flags
mv MNT_GONE, MNT_UNMOUNT and MNT_WANTRDWR to this field
additonally add mnt_writeopcountupper and mnt_writeopcountlower fields
in preparation for pending write suspension support work
bump kernel version to 1.6ZD
2003-10-14 14:02:56 +00:00
thorpej a58b40631e * Shuffle some flags to make it easier to visually compare lists
of flags.
* In the new mount case, make sure to clear the mount "action" flags.
* Allow MNT_FORCE to be set by root on new mounts.
2003-10-13 18:02:20 +00:00
pk db855cea5a ksiginfo_get/exit hook: protect queue operations with splsoftclock() (noted
by Christos).
2003-10-12 20:09:50 +00:00
pk a749472593 ksiginfo_put: protect queue operation with splsoftclock(), since it can
be called from timer interrupts.
2003-10-12 14:32:05 +00:00
chs d2835f509a use "poll" as the wmesg for poll. 2003-10-10 15:24:28 +00:00
lukem 1c33b4e6a4 Overhaul MBR handling (part 1):
<sys/bootblock.h>:
    *	Added definitions for the Master Boot Record (MBR) used by
	a variety of systems (primarily i386), including the format
	of the BIOS Parameter Block (BPB).
	This information was cribbed from a variety of sources
	including <sys/disklabel_mbr.h> which this is a superset of.

	As part of this, some data structure elements and #defines
	were renamed to be more "namespace friendly" and consistent
	with other bootblocks and MBR documentation.
	Update all uses of the old names to the new names.

<sys/disklabel_mbr.h>:
    *	Deprecated in favor of <sys/bootblock.h> (the latter is more
	"host tool" friendly).

amd64 & i386:
    *	Renamed /usr/mdec/bootxx_dosfs to /usr/mdec/bootxx_msdos, to
	be consistent with the naming convention of the msdosfs tools.

    *	Removed /usr/mdec/bootxx_ufs, as it's equivalent to bootxx_ffsv1
	and it's confusing to have two functionally equivalent bootblocks,
	especially given that "ufs" has multiple meanings (it could be
	a synonym for "ffs", or the group of ffs/lfs/ext2fs file systems).

    *	Rework pbr.S (the first sector of bootxx_*):
	    +	Ensure that BPB (bytes 11..89) and the partition table
		(bytes 446..509) do not contain code.
	    +	Add support for booting from FAT partitions if BOOT_FROM_FAT
		is defined.  (Only set for bootxx_msdos).
	    +	Remove "dummy" partition 3; if people want to installboot(8)
		these to the start of the disk they can use fdisk(8) to
		create a real MBR partition table...
	    +	Compile with TERSE_ERROR so it fits because of the above.
		Whilst this is less user friendly, I feel it's important
		to have a valid partition table and BPB in the MBR/PBR.

    *	Renamed /usr/mdec/biosboot to /usr/mdec/boot, to be consistent
	with other platforms.

    *	Enable SUPPORT_DOSFS in /usr/mdec/boot (stage2), so that
    	we can boot off FAT partitions.

    *	Crank version of /usr/mdec/boot to 3.1, and fix some of the other
	entries in the version file.

installboot(8) (i386):
    *	Read the existing MBR of the filesystem and retain the BIOS
    	Parameter Block (BPB) in bytes 11..89 and the MBR partition
	table in bytes 446..509.  (Previously installboot(8) would
	trash those two sections of the MBR.)

mbrlabel(8):
    *	Use sys/lib/libkern/xlat_mbr_fstype.c instead of homegrown code
	to map the MBR partition type to the NetBSD disklabel type.


Test built "make release" for i386, and new bootblocks verified to work
(even off FAT!).
2003-10-08 04:25:43 +00:00
thorpej 68723a995b * Shuffle some data structures so, and add a flags word to ksiginfo_t.
Right now the only flag is used to indicate if a ksiginfo_t is a
  result of a trap.  Add a predicate macro to test for this flag.
* Add initialization macros for ksiginfo_t's.
* Add accssor macro for ksi_trap.  Expands to 0 if the ksiginfo_t was
  not the result of a trap.  This matches the sigcontext trapcode semantics.
* In kpsendsig(), use KSI_TRAP_P() to select the lwp that gets the signal.
  Inspired by Matthias Drochner's fix to kpsendsig(), but correctly handles
  the case of non-trap-generated signals that have a > 0 si_code.

This patch fixes a signal delivery problem with threaded programs noted by
Matthias Drochner on tech-kern.

As discussed on tech-kern.  Reviewed and OK's by Christos.
2003-10-08 00:28:40 +00:00
thorpej bcf389773b Whitespace nits. 2003-10-07 00:23:17 +00:00
christos e59ff2cb68 Don't look for file descriptor matches when a process is exiting. From
Andrey Petrov.
2003-10-04 03:45:49 +00:00
itojun 98d5598feb when dropping M_PKTHDR, need to free m_tag associated with it. 2003-10-03 20:56:11 +00:00
christos 754bffb7e7 Fix problem with signal trampoline version checking that did not take into
account that emulations usually use version 0 and provide their own in kernel
trampolines.
2003-10-03 17:51:13 +00:00
christos 1f6ab188f9 If the user passes enough space, output the per cpu states instead of
aggregating them.
2003-10-03 15:33:42 +00:00
kleink cad1622bfb Need opt_posix.h for P1003_1B_SEMAPHORE. 2003-10-02 09:30:16 +00:00
itojun d104a1a89a make debug_sysctl() sysctl MIB check more strict. from smak.
attack similar to NetBSD-SA2003-014 can be mounted due to this flaw.
2003-10-01 21:45:14 +00:00
cl 1453f2ca48 make sa_vp_donate update p_nrlwps when it retires an LWP 2003-10-01 14:50:06 +00:00
christos 7bd9c302eb Regen 2003-09-30 20:36:40 +00:00
christos 4420def0dc #ifdef _LIBC the semid_t syscalls since we don't define semid_t in userland
except in the libc case.
XXX: Should we define __semid_t instead and make those visible from userland
again? Only ktrace and syscall() get affected.
2003-09-30 20:36:10 +00:00
christos a474dc2106 Keep track of which prototypes we declared already so that we don't
declare them again.
2003-09-30 20:34:28 +00:00
cb 93491c15d3 fix O_NOFOLLOW for non-O_CREAT case.
Reviewed by: christos@ (some time ago)
2003-09-29 10:04:03 +00:00
dsl eed203ed54 Simod has persuaded me to remove the 'sizeof (struct kinfo_drivers)' field. 2003-09-28 13:24:48 +00:00
mycroft ad3b20a692 A nit I ran into while copying this code for something else... 2003-09-27 23:10:47 +00:00
dsl 84577b4fe4 Add kern.root_partition (sysinst needs to know it)
Add kern.drivers - reports driver names and major numbers
Remove some redundant caddr_t casts.
2003-09-27 07:58:55 +00:00
matt 3ce59aebf3 Deal with signal trampoline being const. 2003-09-27 00:57:45 +00:00
matt 2546f51a33 Regen. 2003-09-26 23:11:16 +00:00
matt ebb8ea4c89 Constify __sigaction_sigtramp argument 'void * tramp'. 2003-09-26 23:08:24 +00:00
matt 6986092cfe Add a machine-dependent SIGTRAMP_VALID macro which is used to test whether
a trampoline version is valid or not.
2003-09-26 22:14:19 +00:00
christos b2ceab3824 constify sendsig/trapsignal 2003-09-25 21:59:18 +00:00
scw a3b1a08d1e Fix for PR kern/22933
Avoid gcc3 pointer alias bugs caused by casting between struct callout
and struct callout_circq.
2003-09-25 10:44:11 +00:00
yamt 4e746c95f7 in getblk(), don't call allocbuf() for B_LOCKED buffers.
LFS misses total size of B_LOCKED buffer (locked_queue_bytes) when
getblk() re-size them.

XXX maybe needs a better fix.
2003-09-24 10:44:44 +00:00
nathanw b1a13994b7 When the syscall was made a compat syscall and the function name
changed to compat_16_sys___sigaction14, the name of the _args
structure chaged as well.
2003-09-23 17:59:48 +00:00
thorpej f0d728e698 Avoid a type punning warning in the MALLOC_DEBUG case. 2003-09-23 16:36:59 +00:00
christos 643e2f262c Regen 2003-09-23 14:34:38 +00:00
christos b601ca6ba8 __sigaction14 should have been COMPAT_16 a while ago. GC it now. 2003-09-23 14:34:07 +00:00
christos 6edc0e184e - pass signo to fownsignal [ok by jd]
- make urg signal handling use fownsignal
- remove out of band detection in sowakeup
2003-09-22 12:59:55 +00:00
jdolecek 7cea8a1389 cleanup & uniform descriptor owner handling:
* introduce fsetown(), fgetown(), fownsignal() - this sets/retrieves/signals
  the owner of descriptor, according to appropriate sematics
  of TIOCSPGRP/FIOSETOWN/SIOCSPGRP/TIOCGPGRP/FIOGETOWN/SIOCGPGRP ioctl; use
  these routines instead of custom code where appropriate
* make every place handling TIOCSPGRP/TIOCGPGRP handle also FIOSETOWN/FIOGETOWN
  properly, and remove the translation of FIO[SG]OWN to TIOC[SG]PGRP
  in sys_ioctl() & sys_fcntl()
* also remove the socket-specific hack in sys_ioctl()/sys_fcntl() and
  pass the ioctls down to soo_ioctl() as any other ioctl

change discussed on tech-kern@
2003-09-21 19:16:48 +00:00
manu b01f5cf127 Extra sanity checks: all char devices won't have an associated tty. 2003-09-21 18:40:38 +00:00
christos 8cf3af3092 - support for siginfo_t in ktrace
- make sure allocation for ksiginfo_t worked
2003-09-19 22:51:31 +00:00
christos 070899d51e support for siginfo_t in ktrace 2003-09-19 22:50:02 +00:00
christos 59294d6a54 fix typo (ktr -> ksi) 2003-09-16 15:59:28 +00:00
drochner 3e287f891b Take into account the possibility that the ktrace flags can change
during a read(v)/write(v). If that happeded, we either passed a NULL
pointer or a pointer to something uninitialized as iov to ktrace,
or we got a memory leak. In read/write (w/o -v) we zero-initialize
the iov now to limit damage, in the -v calls the (dynamically allocated)
pointer is checked after the I/O.
2003-09-16 15:55:26 +00:00
cl 52a920b5da add comments to the pagefault code 2003-09-16 15:28:45 +00:00
cl d973127f38 Regen. 2003-09-16 13:49:23 +00:00
cl c08e54b26b fix SA/pthread pagefault failure:
- prevent BLOCKED upcalls on double page faults and during upcalls
- make libpthread handle blocked threads which hold locks
- prevent UNBLOCKED upcalls from overtaking their BLOCKED upcall
this adds a new syscall sa_unblockyield
see also http://mail-index.netbsd.org/tech-kern/2003/09/15/0020.html
2003-09-16 13:46:24 +00:00
christos 1f73cefd27 - convert to circleq
- add simple lock for the list
- make get function remove the item from the list
- eliminate superfluous functions
thanks to enami and matt for the feedback.
2003-09-16 12:07:11 +00:00
christos 5501eeaa6b add siginfo lock and siginfo queue initialization. 2003-09-16 12:06:07 +00:00
christos 31663f15a1 add initialization of siginfo lock and queue.
Also initialize the lock for lwps, although it is not used for proc0 for
code consistency.
2003-09-16 12:05:49 +00:00
christos 048fedf253 include opt_compat_netbsd.h, otherwise we don't get the right signal
trampoline code in compat code.
2003-09-15 00:33:35 +00:00
christos bed9693362 include <sys/poll.h> 2003-09-15 00:22:20 +00:00
christos e8ae1a44db ksiginfo_t support. 2003-09-14 23:47:09 +00:00
christos cc39a7a050 remove variable name from prototype. 2003-09-14 23:45:53 +00:00
christos ccb1345dde provide some more ksiginfo info. 2003-09-14 23:45:16 +00:00
christos ab8558b680 - don't trash the linked list pointers in the ksiginfo_t reuse case
[thanks enami]
- fix uninitialized variable in the exit hook.
  [thanks yamt]
2003-09-14 17:39:03 +00:00
yamt 966ada0097 assert that uio passed to uiomove() has valid uio_iovcnt. 2003-09-14 11:12:14 +00:00
yamt 0a4f15d329 when allocating a new vnode,
increment numvnodes before releasing vnode_free_list_slock.
2003-09-14 11:09:48 +00:00
christos 9970fc6a83 handle siginfo for deferred signals. Allocate a ksiginfo pool, and store
the information there.
TODO:
1. since timer stuff gets called from an interrupt context, we could
   preallocate ksiginfo_t's from the pool, so we don't need a kmem
   pool.
2. probably the sa signal delivery syscall can be changed to take
   a ksiginfo_t so we can use only one pool.
3. maybe when we add realtime signal support, add a resource limit
   on the number of ksiginfo_t's a process can allocate.
2003-09-14 06:59:13 +00:00
christos 24045725fc set the sigval in the setitimer case. 2003-09-14 06:56:22 +00:00
christos 35a41eaf06 enable SI_TIMER notification. 2003-09-13 22:39:18 +00:00
christos 4148967f74 provide siginfo_t in for SIGCHLD 2003-09-13 15:32:40 +00:00
jdolecek a034152027 move dupfd from struct proc to struct lwp - it's per-LWP, not per-process; we
use curlwp where the lwp is not directly available, i.e. in device open
routines

briefly discussed on tech-kern
2003-09-13 08:32:10 +00:00
christos 136f9cd821 PR/15397: Jason Thorpe: directory operations on pathnames that refer to
directories and have trailing slashes should succeed. Ok'd by kjk.
Fix provided by enami.
2003-09-11 17:33:42 +00:00
yamt ec0f99a001 acquire bqueue_slock around bremfree(). 2003-09-11 15:34:26 +00:00
christos 6b4bd0dc1b regen. 2003-09-11 14:00:21 +00:00
christos 71ee0b2991 - print comment in compat syscalls too.
- print ifdef's in the header files.
2003-09-11 13:59:49 +00:00
cl 96b4f15141 KNF and use f instead of s to temporarily save l_flag 2003-09-11 01:32:09 +00:00
drochner 6fb02278a3 Fix the "COW" case if a process does a detach() between fork()
and exit(): we have to lookup the entry in the private copy
again, otherwise the wrong list is manipulated.
should fix a panic on postgres shutdown reported by Marc Recht

being here, improve sone debug messages
2003-09-10 17:01:04 +00:00
christos cbd4e9f601 Regen 2003-09-10 16:44:12 +00:00
christos 883b4b0369 we don't need sigreturn and sigcode glue if we are not compat_16 anymore. 2003-09-10 16:43:34 +00:00
kleink 5c5edae988 sigaction1(): if SA_SIGINFO is set but not supported, fail early.
As discussed with Christos.
2003-09-10 16:41:26 +00:00
yamt 50401b2019 use curcpu() rather than curlwp->l_cpu. 2003-09-10 10:55:50 +00:00
cl f8a1f76075 fix timerupcall breakage after SA_SIGINFO changes:
- sa_upcall only stores a pointer to the `arg'
2003-09-09 15:16:30 +00:00
drochner 00c27c6064 Make per-process shm segment descriptor magement scale better for large
shminfo.shmseg, in view of the fact that only few processes utilize a
significant fraction of it:
-turn the table into a linked list, elements allocated from a pool(9)
-On fork(), just bump a refcount instead of copying the list; it will
 be decremented on exit() and exec(). Only copy if an attach or detach
 takes place in between, which is rarely the case.
2003-09-09 15:02:45 +00:00
itojun 311078a035 truncated output from pty problem. fix by enami
http://mail-index.netbsd.org/tech-kern/2003/09/06/0002.html
2003-09-08 11:14:18 +00:00
scw 20fb5a9f59 Cast from pointer type to db_addr_t via intptr_t. 2003-09-07 21:28:16 +00:00
yamt 02b67863b8 assert mbuf chains m_cat'ed are of the same type. 2003-09-07 12:04:13 +00:00
yamt 1c9095a5b6 buffer with B_CALL shouldn't be brelse'ed. assert it. 2003-09-07 11:59:40 +00:00
yamt 059404deaf bremfree needs bqueue_slock held. assert it. 2003-09-07 11:57:43 +00:00
manu 83798d2727 Correctly check Mach-O fat header so that fat binaries get launched. 2003-09-07 11:16:59 +00:00
jdolecek 671a5964fa one more sc_pgid change 2003-09-07 09:31:47 +00:00
jdolecek 0eb65eb6f2 for logsoftc.sc_pgid, use negative value for process group and positive
for process ID, to match e.g. how socket code sets things up
2003-09-07 09:30:20 +00:00
christos 1dc335c017 SA_SIGINFO changes. 2003-09-06 22:03:09 +00:00
jdolecek 465f95a5ec Embed information about kernel version and some of used kernel options
into compiled LKMs. Check this information when LKM is loaded into kernel
and refuse LKMs not matching currently running kernel. Provide LMFORCE
ioctl to skip this check for those feeling adventurous.

as discussed on tech-kern@, thanks to feedback from Bill Studenmund and others
2003-09-06 19:08:53 +00:00
wrstuden d9f694842d Adjust struct sockbuf and sorflush() so that we don't zero out
every field; some need to stay around.

Fixes a bug where by calling shutdown() on a socket with knotes
will cause the kernel to panic when the kernel closes the socket.
Other access, such as calling kevent() may also trigger the panic.

Debugged with help from Jason and Allen. Patch reviewed by same plus
Itojun and Matt Thomas.

This problem seems to be the same one that FreeBSD saw in their PR
number 54331.

Kernel version _not_ bumped as we will piggyback the bump earlier today.
2003-09-04 16:44:05 +00:00
matt 12588bd8b6 Adapt to the new calling conventions of unp_connect2 2003-09-04 04:33:49 +00:00
itojun 119a24cbdd clarify comment on m_cat(). 2003-09-04 04:10:32 +00:00
matt d7506a7151 Fix typo. 2003-09-03 22:20:34 +00:00
matt ecf95073f1 Change the behavor of AF_LOCAL connect() to sleep until the server has
accepted the connection.  This can prevent a client from overwhelming a
server.
2003-09-03 21:30:12 +00:00
ragge 412d4e7d1b Use correct basic types when addresses are given in function calls. 2003-09-03 11:36:52 +00:00
ragge 76d3da2d68 Do correct pointer casts. 2003-09-03 11:13:14 +00:00
ragge d13eca2ef5 long -> unsigned long. 2003-09-03 10:55:22 +00:00
drochner 98cfd7bc8b also feed getdents/readdir data to KTRACE 2003-09-02 12:31:35 +00:00
yamt b3d9c9a976 remove an obsolete comment. pointed by enami@ 2003-09-01 12:13:55 +00:00
fvdl 6c4d7c0fee Fix error in previous commit: the first vaddr_t argument to uvm_km_suballoc
is in/out, so it must be zeroed out before passing it, otherwise the
uvm_km_suballoc call would get stack garbage, and fail randomly.
2003-08-31 12:59:05 +00:00
ragge b20fe4bd92 Do not cast a pointer to a pointer with different basic type when given
as function argument. It makes assumptions about pointer internals
that do not necessarily have to be true.
2003-08-30 07:54:32 +00:00
enami 02a34f5f66 Use VM_DEFAULT_ADDRESS as a hint to map sigcode instead of an equivalent
value of !TOPDOWN_VM case.
2003-08-29 13:29:32 +00:00
junyoung d532b6f4e6 Expand NEW_VMCMD() macro to a real function new_vmcmd() for the
non-debugging case as well, rather than expanding it inline. This saves
a bunch of kernel bits, e.g. 4kB from GENERIC on i386.
2003-08-29 01:44:02 +00:00
enami 2340975258 Use vm_map_{min,max}() rather than accessing struct vm_map.header.{start,end}
directly.
2003-08-28 14:54:32 +00:00
manu e3ce76f536 Added a malloc freelist sanity check function, for debugging purposes 2003-08-26 21:48:53 +00:00
cb 5f734a1850 fix a race condition between path resolution in userland
and the subsequent namei(): inform the kernel portion of
valid filenames and then disallow symlink lookups for
those filenames by means of a hook in namei().
with suggestions from provos@

also, add (currently unused) seqnr field to struct
systrace_replace, from provos@
2003-08-25 09:12:42 +00:00
atatat 2768d776d4 Use pfind() in proc_sysctl() to find the target process instead of a
home-grown routine.  Remove defcorenamelen, since it's not used
anywhere.
2003-08-24 19:20:40 +00:00
chs 939df36e55 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.
2003-08-24 17:52:28 +00:00
itojun e5255bfd47 make proc.curproc.* check more strict. atatat 2003-08-24 06:11:19 +00:00
junyoung d366db246b TNF & remove trailing spaces. 2003-08-22 02:01:32 +00:00
yamt a7f9b1d8e0 don't make zero-sized mappings. 2003-08-21 15:17:03 +00:00
yamt 7847549d35 use LSDEAD instead of SDEAD for lwp state. 2003-08-20 14:04:00 +00:00
yamt 611b0b9f15 don't use a space char in wmesg.
it makes outputs of SIGINFO confusing.
2003-08-20 13:54:48 +00:00
yamt be09ed029e fix indent. 2003-08-20 13:50:53 +00:00
dsl 40bac1084c When writing the disklabel:
- Write label to all netbsd (type 169) mbr partitions (even if they don't
  already have a label).
- Update any label found in sector LABELSECTOR and sector 0.
Latter change makes DIOCWDINFO (etc) work on raidframe (fixing bin/22529).
2003-08-19 11:49:24 +00:00
simonb bc73aa40f5 Return NULL instead of 0 for functions that return pointers.
Sprinkle some KNF whitespace.
2003-08-15 02:59:32 +00:00
itojun 95758d3554 avoid oldlenp mixup (in-kernel pointer and userland pointer). from atatat 2003-08-14 05:14:52 +00:00
fvdl 8655b27bf5 SA fixes from Stephan Uphoff. Quoting him:
The patch below (hopefully) improves some signaling problems
found by Nathan.

It also contains some cleanup of the sa_upcall_userret() function
removing any sleep calls using PCATCH.

Unblocked threads now only use an upcall stack after they
acquire the virtual CPU.
This prevents unblocked threads from stealing all available
upcall stacks.


Tested by Nick Hudson.
2003-08-11 21:18:18 +00:00
dsl 3530472a3b Rework VTIME calculations so that they don't hit numeric overflow (ok now
for hz < ~200kHz).  Old code failed VTIME > 214 even with hz=100.
Fixes kern/12285.
2003-08-11 10:49:06 +00:00
pk 9f987d0ac0 Workaround to prevent a lockup in pipelock() in the case that signals are
pending while we must wait for the lock.
2003-08-11 10:24:41 +00:00