Commit Graph

2989 Commits

Author SHA1 Message Date
thorpej fde1164ef5 Fix some signed/unsigned comparison warnings from GCC 3.3. 2002-08-25 23:23:22 +00:00
thorpej 88e741999d Fix signed/unsigned comparison warnings from GCC 3.3. 2002-08-25 23:16:39 +00:00
thorpej 4d94adc849 Fix some signed/unsigned comparison warnings from GCC 3.3. 2002-08-25 23:15:21 +00:00
thorpej 4bec56201d Fix signed/unsigned comparison warnings from GCC 3.3. 2002-08-25 22:51:05 +00:00
thorpej 556e3c90c4 Fix a signed/unsigned comparison warning from GCC 3.3. 2002-08-25 22:32:02 +00:00
thorpej c57c6b52cb Make uiomove()'s count argument a size_t rather than an int. 2002-08-25 22:28:40 +00:00
thorpej f1e8d159b0 Fix signed/unsigned conditional expression warning from GCC 3.3. 2002-08-25 21:47:50 +00:00
thorpej cc84cfd836 Fix signed/unsigned comparison warning from GCC 3.3. 2002-08-25 21:44:13 +00:00
thorpej 7055457a98 Fix some signed/unsigned comparison warnings from GCC 3.3. 2002-08-25 21:30:40 +00:00
thorpej 5f7ccd1634 Fix a signed/unsigned comparison warning from GCC 3.3. 2002-08-25 21:19:41 +00:00
thorpej cf013daeb3 Fix some signed/unsigned comparison warnings from GCC 3.3. 2002-08-25 21:18:15 +00:00
thorpej 139cdc3125 Make nbuf, nswbuf, and bufpages unsigned. Make all operations on these
variables unsigned, and update places where their values are printed.
2002-08-25 20:21:33 +00:00
thorpej f02cb5ee27 Make hashinit() use unsigned quantities throughout. 2002-08-25 20:01:12 +00:00
thorpej d4a2567abe Fix a signed/unsigned comparison warning from GCC 3.3. 2002-08-25 19:13:08 +00:00
augustss cdbff56c90 Add sysctl support for hw.dev.ubtbcmfw (so I can set the firmware
path for my BCM2033).
2002-08-24 17:27:01 +00:00
lukem 141ac20efe only print "init: trying /some/init" if RB_ASKNAME or if it's not the first
path we're trying.  (the intent but not the behaviour of the previous rev.)
2002-08-24 00:47:17 +00:00
matt 2d290eb699 Use the qtype_FOREACH macros. Print out address of hook that could not
be disestablished.
2002-08-23 20:50:25 +00:00
lukem 76f5313c64 in start_init(), if RB_ASKNAME is set in boothowto, ask for the path
name to start up as init (rather than just cycling thru initpaths[]
and panicing when out of options).  if RB_ASKNAME isn't set, the old
behaviour remains.  inspired by changes in der Mouse's patchtree.
resolves [kern/18027] from me.
2002-08-23 06:17:08 +00:00
thorpej c196b51fad In sbcompress(), if we toss an empty mbuf, make sure to update
sb_lastrecord if necessary.

From Daniel Hartmeier <daniel@benzedrine.cx>.
2002-08-22 20:56:48 +00:00
thorpej b2cc5a4c03 Make use of page loaning for large socket writes the default. The
SOSEND_NO_LOAN option can be used to go back to the old behavior.
2002-08-21 05:13:36 +00:00
itojun fcfced244e avoid integer overflow during computation of nbuf. from enami 2002-08-21 02:48:54 +00:00
thorpej 95cb683cfb Don't pass VM_PROT_EXEC to pmap_kenter_pa(). 2002-08-14 15:21:31 +00:00
manu 04e1708030 In exit1(), moved the call to the emulation exit hook to a place where it is
safet to sleep.
2002-08-13 05:42:27 +00:00
jdolecek 60be0b94a0 selscan(): make flag[] const 2002-08-08 20:40:25 +00:00
itojun f3f3dd4992 cast register_t/size_t to u_long on printing.
From: Havard Eidnes <he@netbsd.org>
2002-08-08 14:43:40 +00:00
itojun f35b1daee4 remove debugging code leftover 2002-08-08 14:38:47 +00:00
briggs 487de1e6b9 Only include sys/pmc.h if PERFCTRS is defined. 2002-08-07 11:13:40 +00:00
briggs 0b956d0b8b Implement pmc(9) -- An interface to hardware performance monitoring
counters.  These counters do not exist on all CPUs, but where they
do exist, can be used for counting events such as dcache misses that
would otherwise be difficult or impossible to instrument by code
inspection or hardware simulation.

pmc(9) is meant to be a general interface.  Initially, the Intel XScale
counters are the only ones supported.
2002-08-07 05:14:47 +00:00
briggs 5b1917a886 Regen for pmc_get_info, pmc_control. 2002-08-07 04:54:29 +00:00
briggs a67324a44a New syscalls: sys_pmc_get_info and sys_pmc_control. 2002-08-07 04:52:53 +00:00
pooka 2bc5807797 Add FORK_CLEANFILES flag to fork1(), which makes the new process start out
with a clean descriptor set (ie. not copied or shared from parent).

for rfork()
2002-08-06 13:58:08 +00:00
manu 6e3939dc6a Move the call up exit hooks before curproc = NULL so that we can
use lockmgr in exit hooks.
2002-08-02 22:45:57 +00:00
soren f7f75af9c5 Make NAMEI_DIAGNOSTIC compile. 2002-08-02 04:49:35 +00:00
itojun 4f0c9c76b6 sync up with latest openbsd systrace.
- avoid race conditions by having seqno in ioctl
- better uid/gid tracking
- "replace" policy to replace args
- less diffs, as many of local changes were fed back to openbsd already

due to the 1st item, it was impossible for us to provide backward-compatibility
(new kernel + old bin/systrace won't work).  upgrade both.
2002-07-30 16:29:28 +00:00
thorpej 4c9de392fd Bring down a fix from the "newlock" branch, slightly modified:
* In pool_prime_page(), assert that the object being placed onto the
  free list meets the alignment constraints (that "ioff" within the
  object is aligned to "align").
* In pool_init(), round up the object size to the alignment value (or
  ALIGN(1), if no special alignment is needed) so that the above invariant
  holds true.
2002-07-30 01:41:00 +00:00
manu 08a69f7d15 Make killproc really public, and while we are there, constify. 2002-07-28 22:18:51 +00:00
enami 97d2db87f2 Cosmetic changes. 2002-07-26 06:04:57 +00:00
enami b81058e7fc Add some necessary but missing resource deallocation. 2002-07-26 06:04:12 +00:00
jdolecek 02eb342b57 Make sure that the pointer to old parent process for ptraced children
gets reset properly when the old parent exits before the child. A flag
is set in old parent process when the child is reparented in ptrace(2).
If it's set when process is exiting, all running processes have their
'old parent process' pointer checked and reset if appropriate. Also
change to use 'struct proc *' pointer directly, rather than pid_t.
This fixes security/14444 by David Sainty.

Reviewed by Christos Zoulas.
2002-07-25 20:04:02 +00:00
hannken 91f71a4f61 The buffer returned by BUFQ_PEEK must remain the same until BUFQ_GET is
called. It may be used as the "current" buffer.
2002-07-23 14:00:16 +00:00
jdolecek e462e316fb Make sure repeated TIOCSCTTY doesn't corrupt session hold count.
Fixes kern/17382 by David Laight.
2002-07-21 20:43:53 +00:00
hannken 7de36862a8 Rename bufq_init() to bufq_alloc().
Add bufq_free() to remove a buffer queue.
Avoid MALLOC while holding a spinlock.

From Chuck Silvers.
2002-07-21 15:32:17 +00:00
itojun 7f9bb4693b missing systrace_lock() around lock operation. sync w/openbsd, provos ok 2002-07-21 00:25:01 +00:00
thorpej 67b2a0cf06 * Add copyin_proc() and copyout_proc(), which are like copyin() and
copyout(), except they can operate on any process, not just curproc.
* Use this in uiomove() to allow UIO_USERSPACE to non-curproc.
2002-07-20 03:58:24 +00:00
itojun 09168838b3 comment clarification. from openbsd 2002-07-20 00:03:08 +00:00
itojun 9aa540391b add missing systrace_{un,}lock in systrace_poll. reported to provos.
don't use MALLOC() with variable size.  from openbsd.
2002-07-19 23:55:01 +00:00
christos 100356d547 remove __GNUC__ lossage. 2002-07-16 19:53:37 +00:00
hannken 10ff5e6607 Implement a new device buffer queue interface.
One basic struct, a function to setup a queue with a specific strategy and
three macros to put buf's into the queue, get and remove the next buf or
get the next buf without removal.

The BUFQ_XXX interface will be removed in the future.
The B_ORDERED flag is not longer supported.

Approved by: Jason R. Thorpe <thorpej@wasabisystems.com>
2002-07-16 18:03:17 +00:00
thorpej 64a96a4664 Rename DTYPE_SYSTRACE to DTYPE_MISC. DTYPE_MISC can now be used by
any misc. pseudo-device which requires cloning semantics.
2002-07-16 16:40:55 +00:00
matt 79d770a01a Add wchan to a panic (must have NOWAIT). 2002-07-11 17:18:48 +00:00
pooka 15d9246bb2 Add FORK_NOWAIT flag, which sets init as the parent of the forked
process. Useful for FreeBSD rfork() emulation.

ok'd by Christos
2002-07-11 10:37:26 +00:00
drochner c318ca38c7 fix off-by-one error in string len check 2002-07-10 19:04:09 +00:00
thorpej a08a4aecac Regenerate: Added __sigaction_sigtramp at #340. 2002-07-04 23:34:28 +00:00
thorpej 011d4d5f44 Add kernel support for having userland provide the signal trampoline:
* struct sigacts gets a new sigact_sigdesc structure, which has the
  sigaction and the trampoline/version.  Version 0 means "legacy kernel
  provided trampoline".  Other versions are coordinated with machine-
  dependent code in libc.
* sigaction1() grows two more arguments -- the trampoline pointer and
  the trampoline version.
* A new __sigaction_sigtramp() system call is provided to register a
  trampoline along with a signal handler.
* The handler is no longer passed to sensig() functions.  Instead,
  sendsig() looks up the handler by peeking in the sigacts for the
  process getting the signal (since it has to look in there for the
  trampoline anyway).
* Native sendsig() functions now select the appropriate trampoline and
  its arguments based on the trampoline version in the sigacts.

Changes to libc to use the new facility will be checked in later.  Kernel
version not bumped; we will ride the 1.6C bump made recently.
2002-07-04 23:32:02 +00:00
thorpej 2807c6789c Rename SB_UPDATE_TAIL() to SB_EMPTY_FIXUP(), per suggestion from
Jonathan Stone.
2002-07-03 21:39:40 +00:00
thorpej 668640a43d Rename sbappend_stream() to sbappendstream(), per suggestion from
Jonathan Stone.
2002-07-03 21:36:57 +00:00
thorpej 0585ce1489 Make insertion of data into socket buffers O(C):
* Keep pointers to the first and last mbufs of the last record in the
  socket buffer.
* Use the sb_lastrecord pointer in the sbappend*() family of functions
  to avoid traversing the packet chain to find the last record.
* Add a new sbappend_stream() function for stream protocols which
  guarantee that there will never be more than one record in the
  socket buffer.  This function uses the sb_mbtail pointer to perform
  the data insertion.  Make TCP use sbappend_stream().

On a profiling run, this makes sbappend of a TCP transmission using
a 1M socket buffer go from 50% of the time to .02% of the time.

Thanks to Bill Sommerfeld and YAMAMOTO Takashi for their debugging
assistance!
2002-07-03 19:06:47 +00:00
yamt d96bff0e27 add KSTACK_CHECK_MAGIC. discussed on tech-kern. 2002-07-02 20:27:44 +00:00
itojun 0a9d2ad2d7 provide KERN_URND, which extracts sizeof(int) random number from the kernel
(similar to /dev/urandom, for use within chroot jail).
2002-07-02 17:06:17 +00:00
thorpej 11bb3d047b Avoid NULL pointer dereference. kern/17438, xs@kittenz.org. 2002-07-02 16:22:28 +00:00
thorpej f055878614 Fix using poll(2) on systrace descriptors. 2002-07-02 16:16:33 +00:00
thorpej 10c252ba47 Changes to allow the IPv4 and IPv6 layers to align headers themseves,
as necessary:
* Implement a new mbuf utility routine, m_copyup(), is is like
  m_pullup(), except that it always prepends and copies, rather
  than only doing so if the desired length is larger than m->m_len.
  m_copyup() also allows an offset into the destination mbuf, which
  allows space for packet headers, in the forwarding case.
* Add *_HDR_ALIGNED_P() macros for IP, IPv6, ICMP, and IGMP.  These
  macros expand to 1 if __NO_STRICT_ALIGNMENT is defined, so that
  architectures which do not have strict alignment constraints don't
  pay for the test or visit the new align-if-needed path.
* Use the new macros to check if a header needs to be aligned, or to
  assert that it already is, as appropriate.

Note: This code is still somewhat experimental.  However, the new
code path won't be visited if individual device drivers continue
to guarantee that packets are delivered to layer 3 already properly
aligned (which are rules that are already in use).
2002-06-30 22:40:32 +00:00
yamt 5154ea5e5b constify diskerr(). 2002-06-28 16:37:20 +00:00
itojun 67c6a98161 disallow ktrace on P_SUGID. from openbsd 2002-06-28 01:59:36 +00:00
christos c96f693db0 PR/17407: Jim Wise: Systrace does not work without procfs.
FIX: use process_domem as thorpej suggested.
2002-06-27 13:22:54 +00:00
wrstuden 6b88bf15ae If we're in a chroot, and we are looking up '..', make sure we are
still in the chroot. If not, teleport the lookup to the chroot
and log. Closes an assisted-jail escape method pointed out by
xs@kittenz.org. Patch from xs@kittenz.org and myself
2002-06-21 02:19:12 +00:00
eeh 4283dfcbf3 Use the number of args in the sysent rather than calculating it from the
sysent's argsize.  It should be faster and fix 32-bit compat emulations.
2002-06-19 23:35:35 +00:00
fvdl 87b285ba0d Repair damage done in systrace commit. Since argsize is nog longer
passed, assume it's sy_narg * sizeof (register_t). The code
made this assumption implicitly anyway. Fixes compat_*32 tracing.
2002-06-18 08:01:30 +00:00
thorpej 2d2b1d78ae sys_fpathconf: Don't panic in the default case; just return EOPNOTSUPP. 2002-06-18 02:04:08 +00:00
thorpej 5cbb1e82f1 * Don't bother protecting the body of the source file with #ifdef SYSTRACE.
It's not even built if the option isn't present.
* Use cdev_decl() to generate prototypes for the devsw functions.
* Minor whitespace cleanup.
* Nuke the SYSTR_CLONE ioctl from orbit; instead, just clone it in
  systraceopen(), like we do with svr4_net.
2002-06-18 01:24:15 +00:00
christos acf2d4083d Niels Provos systrace work, ported to NetBSD by kittenz and reworked... 2002-06-17 16:22:50 +00:00
matt 91650be524 Fix 2 bugs with MSG_WAITALL. The first is to not block forever if one is
trying to MSG_PEEK for more than the socket can hold.  The second is that
before sleeping waiting for more data, upcall the protocol telling it you
have just received data so it can kick itself to re-fill the just drained
socket buffer.
2002-06-11 00:21:33 +00:00
he a8c83879a2 In soreceive(), if any part of a received record has been freed,
and an error occurs, make sure the socket doesn't retain a partial
copy by dropping the rest of the record.

This would otherwise trigger a panic("receive 1a") under DIAGNOSTIC.

Fixes PR#16990, suggested fix adapted.

Reviewed by Matt Thomas.
2002-06-10 20:43:16 +00:00
drochner 49c4cfb2c5 provide a db_vprintf() which is exactly what the name suggests 2002-06-05 17:53:52 +00:00
simonb 4c67158999 Use "#ifdef __mips__" instead of "#ifdef mips"; shared libraries work
for kernels compiled with gcc 3.x.
2002-06-03 13:07:00 +00:00
lukem 06de426449 SIMPLEQ rototill:
- implement SIMPLEQ_REMOVE(head, elm, type, field).  whilst it's O(n),
  this mirrors the functionality of SLIST_REMOVE() (the other
  singly-linked list type) and FreeBSD's STAILQ_REMOVE()
- remove the unnecessary elm arg from SIMPLEQ_REMOVE_HEAD().
  this mirrors the functionality of SLIST_REMOVE_HEAD() (the other
  singly-linked list type) and FreeBSD's STAILQ_REMOVE_HEAD()
- remove notes about SIMPLEQ not supporting arbitrary element removal
- use SIMPLEQ_FOREACH() instead of home-grown for loops
- use SIMPLEQ_EMPTY() appropriately
- use SIMPLEQ_*() instead of accessing sqh_first,sqh_last,sqe_next directly
- reorder manual page; be consistent about how the types are listed
- other minor cleanups
2002-06-01 23:50:52 +00:00
itojun 1638da93e1 support setsockopt() with larger data (up to MCLBYTES).
From: Hitoshi Asaeda <Hitoshi.Asaeda@sophia.inria.fr>
2002-05-31 20:33:11 +00:00
atatat c52a7f3287 "a.out" -> "elf" in a comment 2002-05-31 16:49:12 +00:00
eeh cfee9f2e02 Since a register_t is probably not an int, don't try to print it with %d. 2002-05-31 01:10:35 +00:00
eeh 45a9507815 Native 32-bit and 32-bit emulation are mutually exclusive. We should not
even try to execute 32-bit binaries as native on a 64-bit kernel.
2002-05-31 00:52:20 +00:00
itojun ae5a9e211d re-scan all ifnet after domaininit() for if_afdata initialization. 2002-05-27 13:46:45 +00:00
perseant 43ca783b4a Back out rev 1.174 of vfs_subr.c, because the splbio() wasn't protecting
enough to be useful, and broadening it so that it did would have meant
that operations possibly requiring synchronous disk activity would have
to be done in splbio().  This clearly was not going to work.

Worked around this in the LFS case by having lfs_cluster_callback put an
extra hold on the vnode before calling biodone(), and taking the hold
off without HOLDRELE's problematic list swapping.  lfs_vunref() will take
care of that---in thread context---on the next write if need be.

Also, ensure that the list walking in lfs_{writevnodes,segunlock,gather}
takes into account the possibility that the list may change
underneath it (possibly because it itself deleted an element).

Tested on i386, test-compiled on alpha.
2002-05-23 23:05:25 +00:00
itojun e54108f021 in m_aux_delete, no need to chase beyond victim. from Archie Cobbs, sync w/kame 2002-05-23 05:45:34 +00:00
thorpej e839580821 Move kernel_lock manipulation info functions so that they will
show up in a profile.
2002-05-21 01:38:26 +00:00
perseant ec0ca919be Protect v_freelist with splbio(), since HOLDRELE can be called in
interrupt context (through brelvp).  (LFS may be the only subsystem
affected by this problem.)

Tested on i386.
2002-05-20 22:50:57 +00:00
matt 0dc8ee943d Eliminate more commons or redundant declarations. 2002-05-14 02:58:32 +00:00
matt 44b3464a48 debug0, debug1, debug15 are defined elsewhere. XXX there needs to a
better was of doing this.
2002-05-13 07:13:58 +00:00
matt 0cb85bc7b9 Eliminate commons. 2002-05-12 23:06:27 +00:00
matt e89ff519c5 Make domains extern. 2002-05-12 20:36:58 +00:00
enami af81fabf7c Remove #ifdef DIAGNOSTIC around panic(). It is better than NULL pointer
dereference.
2002-05-11 11:56:57 +00:00
enami 3700fdfba4 Don't release the lock on mount point vnode so early when doing update mount.
Otherwise, race condition occurs (e.g., between mountd(8) and next mount(8)
when multiple update mount command is invoked from shell script).
2002-05-11 00:45:06 +00:00
atatat de7144e830 Maintain a short list of the actual descriptors that were closed and
log that intead of being ambiguous about which of 0, 1, and/or 2 it
was that was closed.
2002-05-09 17:57:07 +00:00
thorpej f1f51aa2b8 Move code shared by procfs and the kernel proper out of procfs and
into the kernel proper (renaming functions from procfs_* to process_*).
2002-05-09 15:44:44 +00:00
enami b42b2c8323 In soreceive(), don't call sopendfree() if MSG_DONTWAIT is set
since it may sleep.  nfsrv_rcv() tries to do its jobs in softintr
handler as far as possible.
2002-05-07 08:06:35 +00:00
eeh 80ef33c4c1 Back out previous. 2002-05-03 01:22:30 +00:00
thorpej 654768f185 Let the sosend_loan() path be selected at run-time; patch the variable
use_sosend_loan to enable/disable it.  The SOSEND_LOAN kernel option
now causes it to default to 1.
2002-05-03 00:35:14 +00:00
eeh 89e107d917 Regen. 2002-05-03 00:22:16 +00:00
eeh edc73e0d53 Move the copyout out of ntp_adjtime1 and into the syscall wrapper. 2002-05-03 00:22:15 +00:00
eeh 679cac37b9 Regen. 2002-05-03 00:22:15 +00:00
eeh 9bd29db83b Use #if defined(_LP64) to determine if we're generating 64-bit binaries,
not #if defined(alpha).
2002-05-03 00:20:56 +00:00