Commit Graph

1259 Commits

Author SHA1 Message Date
Bruce Evans 0e4f24a34e Avoid division by 0 in check_part(). (It occurred when max_nsectors == 0.
This case is clearly an error, but we keep calling check_part() to get
diagnostics.)

Fixed nearby indentation and commenting bugs.
1997-04-19 14:14:17 +00:00
Doug Rabson 18cab10cb3 Don't allow partial buffers to be cluster-comitted.
Zero the b_dirty{off,end} after cluster-comitting a group of buffers.

With these fixes, I was able to complete a 'make world' with remote src
and obj directories.
1997-04-18 14:12:17 +00:00
David Greenman 1ebd0c5945 Brought fix from the 2.2 branch forward (see rev 1.47.2.7): serious bugs
with reading the image header.
1997-04-18 02:43:05 +00:00
Poul-Henning Kamp 936342eff1 #include <sys/queue.h> 1997-04-14 18:23:48 +00:00
Bruce Evans 58611a61ed Fixed printing of registers in dbflalt_handler(). The registers
were always in a tss; that tss just changed from the one in the
pcb to common_tss (who knows where it was when there was no curpcb?).
Not using the pcb also fixed the problem that there is no pcb in
idle(), so we now always get useful register values.
1997-04-14 13:52:52 +00:00
John Dyson d7f7f3f20e Make a problem that I cannot reproduce go away for now. This commit
is to decrease the inconvienience of other developers until I can
really fix the code.
Reviewed by:	Donald J. Maddox <dmaddox@scsn.net>
1997-04-14 01:28:58 +00:00
John Dyson 95395ca1c1 Improve the buffer cache memory policy by moving pages over to the
cache queue more often.  The pageout daemon had to be waken up
more often than necessary since pages were not put on the
cache queue, when they should have been.
Submitted by:	David Greenman <dg@freebsd.org>
1997-04-13 03:33:25 +00:00
John Dyson 492da96c9d Correct the previous thread-fix commit. I made a clerical error. 1997-04-13 03:05:31 +00:00
John Dyson 5856e12e69 Fully implement vfork. Vfork is now much much faster than even our
fork. (On my machine, fork is about 240usecs, vfork is 78usecs.)

Implement rfork(!RFPROC !RFMEM), which allows a thread to divorce its memory
	from the other threads of a group.

Implement rfork(!RFPROC RFCFDG), which closes all file descriptors, eliminating
	possible existing shares with other threads/processes.

Implement rfork(!RFPROC RFFDG), which divorces the file descriptors for a
	thread from the rest of the group.

Fix the case where a thread does an exec.  It is almost nonsense for a thread
	to modify the other threads address space by an exec, so we
	now automatically divorce the address space before modifying it.
1997-04-13 01:48:35 +00:00
John Dyson c04b956c6f Effectively remove the previous commit to fix threads forking. The
change was a false-start, and needs more work.
1997-04-12 04:07:50 +00:00
John Dyson af9ec88589 Allow a kernel-supported process thread to do an exec without blasting
away the VM space of all of the other, associated threads.
1997-04-11 23:37:23 +00:00
Bruce Evans 9dd8309d56 Removed support for OLD_PIPE. <sys/stat.h> is now missing the hack that
supported nameless pipes being indistinguishable from fifos.  We're not
going back.
1997-04-09 16:53:45 +00:00
Bruce Evans 4e7506495b Include <sys/buf.h> instead of <sys/vnode.h>. kern_sysctl.c no
longer has anything to do with vnodes and never had anything to do
with buffers, but it needs the definitions of B_READ and B_WRITE
for use with the bogus useracc() interface and was getting them
bogusly due to excessive cleanups in rev.1.49.
1997-04-09 15:23:09 +00:00
Peter Wemm 263a339213 Remove explicit zero of p_vmspace on creation, it's now in the startzero
section of the proc struct.
1997-04-07 09:38:39 +00:00
Peter Wemm a2a1c95c10 The biggie: Get rid of the UPAGES from the top of the per-process address
space. (!)

Have each process use the kernel stack and pcb in the kvm space.  Since
the stacks are at a different address, we cannot copy the stack at fork()
and allow the child to return up through the function call tree to return
to user mode - create a new execution context and have the new process
begin executing from cpu_switch() and go to user mode directly.
In theory this should speed up fork a bit.

Context switch the tss_esp0 pointer in the common tss.  This is a lot
simpler since than swithching the gdt[GPROC0_SEL].sd.sd_base pointer
to each process's tss since the esp0 pointer is a 32 bit pointer, and the
sd_base setting is split into three different bit sections at non-aligned
boundaries and requires a lot of twiddling to reset.

The 8K of memory at the top of the process space is now empty, and unmapped
(and unmappable, it's higher than VM_MAXUSER_ADDRESS).

Simplity the pmap code to manage process contexts, we no longer have to
double map the UPAGES, this simplifies and should measuably speed up fork().

The following parts came from John Dyson:

Set PG_G on the UPAGES that are now in kernel context, and invalidate
them when swapping them out.

Move the upages object (upobj) from the vmspace to the proc structure.

Now that the UPAGES (pcb and kernel stack) are out of user space, make
rfork(..RFMEM..) do what was intended by sharing the vmspace
entirely via reference counting rather than simply inheriting the mappings.
1997-04-07 07:16:06 +00:00
Peter Wemm 271b264e4c No longer use an i386tss as the basis of our pcb - it wasn't particularly
convenient and makes life difficult for my next commit.  We still need
an i386tss to point to for the tss slot in the gdt, so we use a common
tss shared between all processes.

Note that this is going to break debugging until this series of commits
is finished.  core dumps will change again too. :-(  we really need
a more modern core dump format that doesn't depend on the pcb/upages.

This change makes VM86 mode harder, but the following commits will remove
a lot of constraints for the VM86 system, including the possibility of
extending the pcb for an IO port map etc.

Obtained from: bde
1997-04-07 06:45:18 +00:00
Peter Dufault 0ddf9be1f0 Make MOD_* macros almost consistent:
Use the name argument almost the same in all LKM types.  Maintain
the current behavior for the external (e.g., modstat) name for DEV,
EXEC, and MISC types being #name ## "_mod" and SYCALL and VFS only
#name.  This is a candidate for change and I vote just the name without
the "_mod".

Change the DISPATCH macro to MOD_DISPATCH for consistency with the
other macros.

Add an LKM_ANON #define to eliminate the magic -1 and associated
signed/unsigned warnings.

Add MOD_PRIVATE to support wcd.c's poking around in the lkm structure.

Change source in tree to use the new interface.

Reviewed by:	Bruce Evans
1997-04-06 11:14:13 +00:00
John Dyson a04c970a7a Fix the gdb executable modify problem. Thanks to the detective work
by Alan Cox <alc@cs.rice.edu>, and his description of the problem.

The bug was primarily in procfs_mem, but the mistake likely happened
due to the lack of vm system support for the operation.  I added
better support for selective marking of page dirty flags so that
vm_map_pageable(wiring) will not cause this problem again.

The code in procfs_mem is now less bogus (but maybe still a little
so.)
1997-04-06 02:29:45 +00:00
Doug Rabson 42146e3747 [Previous comment was incorrect for these files]
Added calls to VFS lock debugging macros to make fixing filesystems' locking
easier.
1997-04-04 17:47:43 +00:00
Doug Rabson de15ef6aef Add a function vop_sharedlock which a copy of vop_nolock without the
implementation #ifdef out.  This can be used for now by NFS.  As soon
as all the other filesystems' locking is fixed, this can go away.

Print the vnode address in vprint for easier debugging.
1997-04-04 17:46:21 +00:00
David Greenman 66141753e6 Killed unnecessary vp == NULL check after namei. 1997-04-04 09:06:20 +00:00
David Greenman a3cf6ebae3 Oops, only free component name buffer if namei() didn't. This bug has
been in here since I wrote the code 3 years ago! Thanks, Bruce!

Submitted by:	bde
1997-04-04 07:30:06 +00:00
David Greenman 6d5a0a8c23 Various fixes:
1. imgp->image_header needs to be cleared for the bp == NULL && `goto
   interpret' case, else exec_fail_dealloc would free it twice after
   an error.

2. Moved the vp->v_writecount check in exec_check_permissions() to
   near the end.  This fixes execve("/dev/null", ...) returning the
   bogus errno ETXTBSY.  ETXTBSY is still returned for attempts to
   exec interpreted files that are open for writing.  The man page
   is very old and wrong here.  It says that ETXTBSY is for pure
   procedure (shared text) files that are open for writing or reading.

3. Moved the setuid disabling in exec_check_permissions() to the end.
   Cosmetic.  It's more natural to dispose of all the error cases
   first.

...plus a couple of other cosmetic changes.

Submitted by:	bde
1997-04-04 04:17:11 +00:00
David Greenman 8677f5094d Lose the vnode lock on a permissions failure.
Submitted by:	Tor Egge <Tor.Egge@idi.ntnu.no>
1997-04-04 01:30:33 +00:00
Peter Wemm b79c6a8603 Don't incorrectly set P_SUGID in setre[ug]id() for no reason, as noticed
by bde.
Don't return EPERM in setre[ug]id() just because the caller passes in
the current effective id in the second arg (ie: no change), as suggested
by ache.
1997-04-02 17:05:49 +00:00
Bruce Evans 0f1adf65ab Use OID_AUTO instead of magic number for the Lite2 sysctl debug.busyprt.
Removed declaration of vfs_unmountroot() again.

Staticized vgonel().
1997-04-01 13:05:34 +00:00
Bruce Evans f9cf920341 Use OID_AUTO instead of magic number for the old sysctl debug.rcluster.
The magic number conflicted with the rotting disabled one in ext2fs for
debug.doasyncfree.

Removed messy debugging variable/constant/sysctl debug.doreallocblks.
Lite2 removed it, and we don't use the code that it controls.
1997-04-01 11:48:30 +00:00
Bruce Evans d8a4f230d5 Use OID_AUTO instead of magic number for old sysctl debug.elf_trace. The
magic number conflicted with the one for the Lite2 sysctl debug.busyprt.

Staticized some variables.

Removed unused #includes.
1997-04-01 10:41:48 +00:00
Bruce Evans 7f725eacc1 Use OID_AUTO instead of a magic number for Lite2 sysctl debug.lockf_debug.
Removed unused #includes.
1997-04-01 10:30:06 +00:00
Bruce Evans 6898627ce2 Fixed commented-out Lite2 sysctl debug.lockpausetime.
Removed unused #includes.
1997-04-01 10:18:51 +00:00
Bruce Evans 3f39dbc52d Removed potentially harmful garbage <vm/lock.h> and fixed bogus
use of it.  It was actually harmless because the use was null due
to fortuitous include orders and identical (wrong) idempotency
macros.
1997-04-01 08:39:07 +00:00
Peter Wemm b67cbc6548 Implement code for an OpenBSD-style issetuigid().
This is valueable for library code which needs to be able to find out
whether the current process is or *was* set[ug]id at some point in the
past, and may have a "tainted" execution environment.  This is especially
a problem with the trend to immediately revoke privs at startup and regain
them for critical sections.  One problem with this is that if a cracker
is able to compromise the program while it's still got a saved id, the
cracker can direct the program to regain the privs.  Another problem is
that the user may be able to affect the program in some other way (eg:
setting resolver host aliases) and the library code needs to know when it
should disable these sorts of features.

Reviewed by: ache
Inspired by: OpenBSD (but with a different implementation)
1997-03-31 15:13:33 +00:00
Peter Wemm 7ec6369d7e Regenerate (added issetugid) 1997-03-31 14:55:05 +00:00
Peter Wemm 56f12a6cb5 issetugid is now implemented rather than reserved 1997-03-31 14:52:50 +00:00
Peter Wemm a89a5370c5 Do not set the P_SUGID flag in seteuid()/setegid() if nothing has changed.
(for supporting issetugid())

Reviewed by: ache  (as was the previous commit, rev 1.29)
1997-03-31 13:47:00 +00:00
Peter Wemm 229a15f084 Do not set the P_SUGID flag in seteuid()/setegid() if nothing has changed.
(for supporting issetugid())
1997-03-31 13:41:49 +00:00
Peter Wemm a08f4bf601 Fully implement the clause in Appendix B.4.2.2 from Posix 1003.1
that allows traditional BSD setuid/setgid behavior.

The only visible difference should be that a non-root setuid program
(eg: inn's "rnews" program) that is setuid to news, can completely
"become" uid news. (ie: setuid(geteuid())  This was allowed in
traditional 4.2/4.3BSD and is now "blessed" by Posix as a special
case of "appropriate privilige".

Also, be much more careful with the P_SUGID flag so that we can use it
for issetugid() - only set it if something changed.

Reviewed by: ache
1997-03-31 13:36:46 +00:00
Peter Wemm 8a5d815aa0 Make setgroups(0, xxx) behave as it does on SYSV, namely clear the groups
vector except for the egid in groups[0].  There is a risk that programs
that come from SYSV/Linux that expect this to work and don't check for
error returns may accidently pass root's groups on to child processes.

We now do what is least suprising (to non BSD programs/programmers) in
this scenario, and nothing is changed for programs written with BSD groups
rules in mind.

Reviewed by: ache
1997-03-31 13:21:37 +00:00
David Greenman a91b87211d In accept1(), falloc() is called after the process has awoken, but prior
to removing the connection from the queue. The problem here is that
falloc() may block and this would allow another process to accept the
connection instead. If this happens to leave the queue empty, then the
system will panic with an "accept: nothing queued".

Also changed a wakeup() to a wakeup_one() to avoid the "thundering herd"
problem on new connections in Apache (or any other application that has
multiple processes blocked in accept() for the same socket).
1997-03-31 12:30:01 +00:00
Peter Wemm 57862eed22 Code to do lchown(2), copied from chown(2) except it's NOFOLLOW in ND_INIT
instead of FOLLOW.
1997-03-31 12:21:37 +00:00
Peter Wemm f77da2867a Regenerate 1997-03-31 12:17:45 +00:00
Peter Wemm 4eb542c64b Reserve 252 (poll, first in OpenBSD)
Reserve 253 (issetugid, as in OpenBSD)
Allocate 254 for lchown(2)
1997-03-31 12:14:48 +00:00
Peter Wemm 6c14d95d0d Treat symlinks as first class citizens with their own uid/gid rather than
as shadows of their containing directory.  This should solve the problem
of users not being able to delete their symlinks from /tmp once and for
all.

Symlinks do not have modes though, they are accessable to everything that
can read the directory (as before).  They are made to show this fact at
lstat time (they appear as mode 0777 always, since that's how the the
lookup routines in the kernel treat them).

More commits will follow, eg: add a real lchown() syscall and man pages.
1997-03-31 12:02:53 +00:00
David Greenman 9caaadb63a Changed the way that the exec image header is read to be filesystem-
centric rather than VM-centric to fix a problem with errors not being
detectable when the header is read.
Killed exech_map as a result of these changes.
There appears to be no performance difference with this change.
1997-03-31 11:11:26 +00:00
Peter Wemm 55a278acdd Make sure we touch all the temporary files at startup, because we assume
they were created later on.  This is not the case when processing
syscalls.isc in the ibcs2 area.  (It generates no declarations, it's
all either hidden (already prototyped elsewhere) or unimplemented).
1997-03-29 11:11:18 +00:00
Peter Wemm 17a8bb9de0 Add missing $Id$
Note; the RCS file has also been reconstructed to have a CSRG vendor branch.
1997-03-25 17:11:30 +00:00
Peter Wemm 356b94e0d3 Replace original rev 1.3; Author: bde; Date: 1997/02/25 17:24:43;
Fix counting of simplelocks in SIMPLELOCK_DEBUG
Fix style regression
1997-03-25 16:38:01 +00:00
Peter Wemm 4bdb9b1168 Replace original rev 1.2; Author: mpp; Date: 1997/02/12 06:52:30
Add missing #include <sys/systm.h>
1997-03-25 16:36:35 +00:00
Peter Wemm a1ce9d5c33 Replace original revision 1.1; Author dyson; Date: 1997/02/10 02:28:15
Changes from Lite2:
- DEBUG -> SIMPLELOCK_DEBUG
- cosmetic fixes
- bzero of lock at init time -> explicit init of members.
1997-03-25 16:32:46 +00:00
Peter Wemm 6f3ca62e56 This commit was generated by cvs2svn to compensate for changes in r24269,
which included commits to RCS files with non-trunk default branches.
1997-03-25 16:27:20 +00:00
Peter Wemm 53bf4bb2cf Import 4.4BSD-Lite2 onto CSRG branch 1997-03-25 16:27:20 +00:00
Bruce Evans afd2f6c218 Don't include <sys/ioctl.h> in the kernel. Stage 5: include
<sys/ioctl_compat.h> and sometimes <sys/filio.h> instead of
<sys/ioctl.h> in tty-related files.  <sys/ttycom.h> is still
usually imported bogusly via <sys/termios.h>.
1997-03-24 12:03:06 +00:00
Bruce Evans 2098241054 Don't include <sys/ioctl.h> in the kernel. Stage 4: include
<sys/ttycom.h> and sometimes <sys/filio.h> instead of <sys/ioctl.h>
in miscellaneous files.  Most of these files have nothing to do
with ttys but need to include <sys/ttycom.h> to get the definitions
of TIOC[SG]PGRP which are (ab)used to convert F[SG]ETOWN fcntls into
ioctls.
1997-03-24 11:52:29 +00:00
Bruce Evans 71455815cc Don't include <sys/ioctl.h> in the kernel. Stage 3: include
<sys/filio.h> instead of <sys/ioctl.h> in non-network non-tty files.
1997-03-24 11:37:53 +00:00
Bruce Evans fce002fdef Don't include <sys/ioctl.h> in the kernel. Stage 1: don't include
it when it is not used.  In most cases, the reasons for including it
went away when the special ioctl headers became self-sufficient.
1997-03-24 11:25:10 +00:00
Guido van Rooij 8f89943eda Add generation number randomization. Newly created filesystems wil now
automatically have random generation numbers. The kenel way of handling those
also changed. Further it is advised to run fsirand on all your nfs exported
filesystems. the code is mostly copied from OpenBSD, with the randomization
chanegd to use /dev/urandom
Reviewed by:	Garrett
Obtained from: OpenBSD
1997-03-23 20:08:22 +00:00
Bruce Evans 3ac4d1ef0c Don't #include <sys/fcntl.h> in <sys/file.h> if KERNEL is defined.
Fixed everything that depended on getting fcntl.h stuff from the wrong
place.  Most things don't depend on file.h stuff at all.
1997-03-23 03:37:54 +00:00
Mike Pritchard 9a8f4a4c93 Restore Bruce's original comment. It seems that "iff" = if and only if,
and is not a typo.  It is used other places in the kernel, too.
1997-03-22 20:34:21 +00:00
Mike Pritchard 269ebc8621 Fix a typo in a comment of a recent commit. 1997-03-22 16:52:19 +00:00
Bruce Evans 774fce94c0 Removed `volatile' from declaration of `time', and removed the resulting
null casts.  `time' is nonvolatile for accesses within a region locked
by splclock()/splx().  Accesses outside such a region are invalid, and
splx() must have the side effect of potentially changing all global
variables (since there are hundreds of sort of volatile variables like
`time'), so declaring `time' as volatile didn't have any real benefits.
1997-03-22 08:03:51 +00:00
Bruce Evans 3c81694426 Fixed some invalid (non-atomic) accesses to `time', mostly ones of the
form `tv = time'.  Use a new function gettime().  The current version
just forces atomicicity without fixing precision or efficiency bugs.
Simplified some related valid accesses by using the central function.
1997-03-22 06:53:45 +00:00
Bill Paul 0b788fa1da Add support to sendmsg()/recvmsg() for passing credentials between
processes using AF_LOCAL sockets. This hack is going to be used with
Secure RPC to duplicate a feature of STREAMS which has no real counterpart
in sockets (with STREAMS/TLI, you can apparently use t_getinfo() to learn
UID of a local process on the other side of a transport endpoint).

What happens is this: the client sets up a sendmsg() call with ancillary
data using the SCM_CREDS socket-level control message type. It does not
need to fill in the structure. When the kernel notices the data,
unp_internalize() fills in the cmesgcred structure with the sending
process' credentials (UID, EUID, GID, and ancillary groups). This data
is later delivered to the receiving process. The receiver can then
perform the follwing tests:

- Did the client send ancillary data?
	o Yes, proceed.
	o No, refuse to authenticate the client.

- The the client send data of type SCM_CREDS?
	o Yes, proceed.
	o No, refuse to authenticate the client.

- Is the cmsgcred structure the right size?
	o Yes, proceed.
	o No, signal a possible error.

The receiver can now inspect the credential information and use it to
authenticate the client.
1997-03-21 16:12:32 +00:00
Bruce Evans 444f003cca Fixed null pointer panic in devtotty(). Fixed bounds checking in
devtotty().  devtotty() must check its arg carefully since the arg is
supplied as ioctl data.  This should fix PR3004.

Renamed devtotty() to snpdevtotty().
1997-03-16 19:11:40 +00:00
Bruce Evans d8d6519c63 Fixed the hash formula. Lite2 doesn't have phashinit(), so Lite2's hash
formula uses `& nchash'.  This is very broken when nchash is a prime
number instead of 1 less than a power of 2, but the Lite2 formula was
merged in.

Merged some cosmetic changes from Lite2, rev.1.21 and Lite1.  The merge
was difficult because the Lite2 code is essentially ours (phk's) except
where Lite2 improved or broke it.

Summary of the Lite2 changes:
- in the copyright, phk's rights have been transferred to the Regents.
  This change should be reviewed.
- nchENOENT went away; the "no" vnode is now simply 0.
- comments were improved.
- style was "improved".
- goto instead of Fanatism (sic) was considered bad :-).
- there are some small changes to support whiteouts.
- new cache entries are added in more cases.  More work is required
  near here to change the hash table size if kern.desiredvnodes is
  changed using sysctl.
- rescanning of the hash bucket in cache_purgevfs() was removed.  This
  change should be reviewed.
1997-03-08 15:22:14 +00:00
Guido van Rooij dfd0621acc Fix style bugs and other bugs in the NFS fix. 1997-03-08 15:14:30 +00:00
John Dyson d6faa36b42 Remove unnecessary check for vp->v_mount being null. Pointed
out by BDE.
1997-03-07 14:40:54 +00:00
Gary Palmer 324d42ad57 Fix (I hope) the NFS hole. This is only compile tested.
Submitted by:	(partly) davids@SECNET.COM via BUGTRAQ
1997-03-07 07:42:41 +00:00
Bruce Evans c68fa33937 Try a no-wait malloc first in clist_alloc_cblocks(). If this fails, then
complain and blunder on.

Should be in 2.2, preferably with a better fix.
1997-03-05 16:45:01 +00:00
David Greenman 2f2160da3b Fixed splbio problems in vinvalbuf. Closes PR#2875, although fixed
differently by me.
1997-03-05 04:54:54 +00:00
Mike Smith 3a558f83dd Check that vp->v_mount is non-null in fsync() before dereferencing it to
obtain the mountpoint's MNT_ASYNC flag.

This is a Very Definite Last-Minute 2.2 Bugfix Candidate.

Reviewed by:	sef
1997-03-05 01:42:14 +00:00
Bruce Evans 4a8b966013 Attach vfs_sysctl() one level lower so that only the levels below
VFS_GENERIC aren't done in the FreeBSD way.  The previous commit
broke the nfs sysctls.
1997-03-04 18:31:56 +00:00
Andrey A. Chernov 53490b7634 Oops, fix typo. 1997-03-03 23:02:43 +00:00
Andrey A. Chernov 30cf3ac460 Don't copy more than MAXLOGNAME bytes in getlogin() syscall,
it is stricter than padded s_login size check was there.
1997-03-03 22:46:16 +00:00
Bruce Evans 3a76a5949b Merged Lite2's vfs_sysctl(). It doesn't fit very well into FreeBSD's
(phk's) sysctl framework, and I needed special code to disambiguate
the VFS_GENERIC node from the VFS_VFSCONF leaf, so I only converted
the leaves to the FreeBSD framework.  The error handling isn't quite
right.  CSRGS's sysctls seem to return ENOTDIR too much and FreeBSD's
sysctls don't agree with the man page.
1997-03-03 12:58:20 +00:00
Andrey A. Chernov 964ca0caee Use MAXLOGNAME for stricter size check in setlogin() syscall instead of
sizeof of padded s_login array
1997-03-03 10:15:48 +00:00
Bruce Evans dc91a89e83 Restored some pre-Lite2-merge source-level compatibility to the mount()
and getvfsbyname() interfaces.  The new interfaces are now hidden from
applications unless _NEW_VFSCONF is defined.  The new vfsconf interfaces
don't work yet.
1997-03-02 17:53:37 +00:00
Bruce Evans a896f0256c Moved vfs sysctls to where Lite2 put them. No code changes yet. 1997-03-02 11:06:22 +00:00
Wolfram Schneider 6faaa756b5 Include copyright message from <sys/copyright.h> 1997-03-01 17:49:09 +00:00
Bruce Evans 93437134e2 Added a copyright and restored order. 1997-02-28 10:14:24 +00:00
Bruce Evans a1ab34e3d0 Wrapped mi_switch() with splstatclock()/splx(). This fixes excessive
interrupt latency for certain cases involving for restarting stopped
processes.
1997-02-27 18:03:48 +00:00
Bruce Evans 886ee0aa9f Fixed loading of vfs's. The Lite2 merge added unnecessary compatibility
cruft and resulted in loading usually following a null pointer.  Use
something closer to the pre-Lite2 code, including not making a copy of
the new filesystem's config info.  Not making a copy also fixes a race
for loading and a memory leak for unloading.

Fixed unloading of vfs's.  maxvfsconf wasn't maintained.

Look up the vfs to unload by name instead of by number.  The numbers
should go away as soon as all mount utilities are converted.
1997-02-27 16:40:20 +00:00
Bruce Evans b98afd0d00 Fixed Lite2 merge of spechash simplelocking. It was misplaced in
checkalias() and missing in vfinddev() and vcount().
1997-02-27 16:08:43 +00:00
John Dyson fd7f690f94 Fix the previous simple_lock fix breakage in the combined
vput/vrele routine.  Fix a panic message.  Fix the vop_nounlock
routine so that "special" filesystems that use it work correctly.
1997-02-27 05:28:58 +00:00
John Dyson 0d955f71a1 Fix the simple_lock problem with the physical I/O buffer code, and
also fix the missing simple_unlock in vrele, and improve vrele/vput
by merging them into one routine.  BDE pointed these problems out.
1997-02-27 02:57:03 +00:00
Bruce Evans 7c1557c4af Fixed unmounting of the root fs. vfs_unmountroot() wasn't fully updated
to do Lite2 locking and vfs_unmountall() wasn't as simple as the Lite2
version.
1997-02-26 15:35:42 +00:00
Bruce Evans c35e283a80 Merged some missing locking from Lite2:
- getnewvnode() and vref() were missing one simple_unlock() each.
- the Lite2 locking changes weren't merged at all in
  printlockedvnodes() or sysctl_vnode().  Merging these undid
  some KNF style regressions.
1997-02-25 19:33:23 +00:00
Garrett Wollman 639acc13e2 Create a new branch of the kernel MIB, kern.ipc, to store
all of the configurables and instrumentation related to
inter-process communication mechanisms.  Some variables,
like mbuf statistics, are instrumented here for the first
time.

For mbuf statistics: also keep track of m_copym() and
m_pullup() failures, and provide for the user's inspection
the compiled-in values of MSIZE, MHLEN, MCLBYTES, and MINCLSIZE.
1997-02-24 20:30:58 +00:00
Peter Wemm d050e1a8a0 Regenerate to include correct Id string 1997-02-22 12:52:35 +00:00
Peter Wemm 6875d25465 Back out part 1 of the MCFH that changed $Id$ to $FreeBSD$. We are not
ready for it yet.
1997-02-22 09:48:43 +00:00
Mike Pritchard 77bf994fe8 Support the installation of character devices via an lkm.
Closes PR# 1716

Submitted by:	jpt@magic.net
1997-02-22 01:20:57 +00:00
Bruce Evans d5e4d7e154 Improved select():
- avoid malloc() if the number of fds is small.
- pack the bits better so that `small' is quite large.
- don't waste time generating zero bits for null fd_set pointers or
  scanning these bits.

Possibly improved select():
- free malloc()ed storage before returning.  This is simpler and I
  think huge select()s aren't worth optimizing since they are rare,
  relative gain would be small and there would be tiny costs for all
  selects().

Reviewed by:	ache (first version by him too)
1997-02-20 11:51:52 +00:00
Garrett Wollman b1396a353b Make the operation of sonewconn1() a bit clearer by calling
pru_attach() before putting the new connection on the
connection queue.
1997-02-19 19:15:43 +00:00
David Greenman e47bda0730 Fix from PR #2757:
execve() clears the P_SUGID process flag in execve() if the binary
executed does not have suid or sgid permission bits set.

This also happens when the effective uid is different from the real
uid or the effective gid is different from the real gid. Under
these circumstances, the process still has set id privileges and
the P_SUGID flag should not be cleared.

Submitted by:	Tor Egge <Tor.Egge@idt.ntnu.no>
1997-02-19 03:51:34 +00:00
Garrett Wollman d8392c6c39 uipc_mbuf.c: do a better job of counting how often we have to wait
for memory, or are denied a cluster.

uipc_socket2.c: define some generic ``operation-not-supported'' entry points
for pr_usrreqs.
1997-02-18 20:43:07 +00:00
Bruce Evans a8687b6dcd Added some ufs #includes so that this compiles with option LOCKF_DEBUG.
Moving this all from ufs wasn't a good move.  At least the debugging
routines depend on the file system.

Cleaned up the LOCKF_DEBUG #includes.
1997-02-18 14:37:26 +00:00
Bruce Evans 78fd7b3d49 Fixed namei caching for LOOKUPs. It was broken for lstat() and olstat().
Successful lstat()s purged an existing entry as well as not caching the
result.

This bug was introduced in Lite1 by setting the LOCKPARENT flag for
[o]lstat() in order to support the inherit-attributes-from-parent-
directory misfeature for symlinks.  LOCKPARENT was previously only set
for CREATEs and DELETEs.  It is now set for LOOKUPs, but only for
[o]lstat(), so the problem wasn't very noticeable.
1997-02-18 06:46:41 +00:00
Bruce Evans 25ed2ac223 Changed `#ifdef COMPAT_PRELITE2' to `#ifndef NO_COMPAT_PRELITE2' so that
the old VFS_VFSCONF sysctl is enabled by default.

Initialize the vfc_vfsops field to non-NULL in sysctl_ovfs_conf()
so that the old VFS_VFSCONF sysctl actually works.  The old (still
current) getvfsent.c uses this "kernel-only" field to decide which
vfs's are configured (the old implementation returned null entries
for unconfigured vfs's).
1997-02-18 04:58:11 +00:00
David Greenman 70e534e78f Pass P_SUGID on to the child of a fork(). It was possible to get rlogin
to coredump previously since it (somewhat uniquely) is setuid and forks
without execing, and thus without passing P_SUGID the child could
coredump and possibly divulge sensitive information (such as encrypted
passwords from the passwd database).
1997-02-17 10:58:46 +00:00
Garrett Wollman 30f700e9c7 Provide an alternative mbuf cluster allocator which permits use of
clusters greater than one page in length by calling contigmalloc1().
This uses a helper process `mclalloc' to do the allocation if
the system runs out at interrupt time to avoid calling contigmalloc
at high spl.  It is not yet clear to me whether this works.
1997-02-13 19:41:40 +00:00
Garrett Wollman 5bee01c83f For large values of sb_max or MCLBYTES, it was possible for the expression
sb_max * MCLBYTES / (MSIZE + MCLBYTES)
used in sbreserve() to overflow, causing all socket creation attempts
to fail.  Force the calculation to use u_quad_t's, which makes overflow
less likely.
1997-02-13 18:05:46 +00:00