Commit Graph

3600 Commits

Author SHA1 Message Date
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