Commit Graph

5544 Commits

Author SHA1 Message Date
ad a2884738ea Nuke __HAVE_SPLBIGLOCK. 2007-06-15 20:59:38 +00:00
ad 029f4f9cd7 splstatclock, spllock -> splhigh 2007-06-15 20:17:07 +00:00
ad bd5831ff06 proc_free: avoid a potential race where we could free struct proc before
the last LWP in the process is off the CPU. Noted by yamt@.
2007-06-15 18:29:53 +00:00
ad 71d19c248a - ksem_proc_dtor: fix a use-after-free
- LOCK_ASSERT -> KASSERT
- Use kmem(9)
2007-06-15 18:27:13 +00:00
dyoung db12d3f8a6 #include sys/bootblocks.h for its MBR #definitions. 2007-06-14 17:18:40 +00:00
yamt 3aa0b315cd proc_drainrefs: fix the case of exec failure. 2007-06-14 14:29:50 +00:00
yamt b1cae5b7e6 exit_lwps: fix a deadlock. 2007-06-13 12:14:10 +00:00
christos 7754b3471a remove an unneeded cast and merge one more switch case. 2007-06-08 17:51:41 +00:00
christos 19a2c6c6d2 - only unlock if were dealing with a process.
- use the right mutex.
2007-06-08 17:49:13 +00:00
hannken 6087f7cc14 Dounmount(): rearrange mountlist_slock. vfs_allocate_syncvnode() may sleep
getting a new vnode so it must not be called with this simple_lock taken.

Fixes PR #36395
2007-06-07 10:03:12 +00:00
yamt da51d139a4 improve post-ubc file overwrite performance in common cases.
ie. when it's safe, actually overwrite blocks rather than doing
read-modify-write.

also fixes PR/33152 and PR/36303.
2007-06-05 12:31:30 +00:00
dsl 7ba299c5d4 Split sys__lwp_park() so that the compat/netbsd32 code can copyin and convert
its timeout then call the standard function.
2007-06-03 09:50:12 +00:00
dsl b38af594ea Move the #if at the top of trace_enter/exit back above the declaration of 'p'
(where it used to be in rev 1.147) so that this code compiles when none of
the trace options are in use.
Fixes PR kern/36431
2007-06-03 07:47:50 +00:00
dsl 21d1d4f346 Instead of unconditionally initialising the ktriov and conditionally
copying in aiov, just unconditionally copy in aiov.
Probably saves a mispredicted branch and a data cache miss - as well as
removing some code.
2007-06-02 13:38:31 +00:00
enami d35ef328a7 - Fix obvious typos so that sendto(2) works.
- Wrap lines again.
2007-06-02 01:24:34 +00:00
dsl d7f93c5c67 Split sys_bind() and sys_connect() so that compat code can use common code
once the 'address' has been copied into an mbuf.
Add extra flags for 'struct msghdr.msg_flags' to indicate that the address
  and control are already in mbufs, and that the uio structure is in userspace
  for sending data, rename sendit() to do_sys_sendmsg() to ensure no old code
  passes in random flags.
Changes to compat code to use new functions - removing some stackgap use.
Fix a 'use after free' in compat_43_sys_recvmsg.
I ***THINK*** the code that converts 'cmsg' formatted data is borked!
svr4_stream.c ought to be generated from svr4_32_stream.c during the build.
2007-06-01 22:53:52 +00:00
dsl d23c3b01a0 Add a ktrkuser() function that can be used to generate a KTR_USER trace
entry from kernel-resident data.
Mainly so I can (ab)use the KTR_USER entry for extra info.
2007-06-01 20:24:21 +00:00
ad 057666ad0c setrunnable: adjust to slightly different locking strategy post yamt-idlewlp.
Should fix kern/36398. Untested due to connectivity issues.
2007-05-31 22:06:09 +00:00
rmind 59085afd2c Make AIO initialization MP-safe.
Actually, lwp_exit() with (l != curlwp) will not work.
This fix might be pulled up from vmlocking branch.
2007-05-31 06:24:23 +00:00
rmind 0a227b1913 - Make aio_worker to handle pending exits and coredumps
- Allow aio_suspend() to be ended early by a signal
- Fix reference counting on LIO structures (remove hack)
- Use two global pools for AIO structures
- Minor cleanups

Patch provided by <ad>. Some additional modifications by me.
Reviewed by <yamt>.
2007-05-31 05:29:43 +00:00
dyoung 8c4b63fb77 Do not run ctags on sys/dev/usb/usb_port.h. Its #defines shadow
NetBSD symbols, such as clalloc(), that one might one to tag to.
2007-05-26 05:34:04 +00:00
tnn 6380d93405 When renaming, copy the new name into the designated memory area.
Tested by martti@
2007-05-22 10:39:10 +00:00
dsl b113bdbde9 Fix logic inversion - probably PR kern/36284 2007-05-21 18:30:35 +00:00
christos c61eed39a8 rename si_sigval -> si_value to match POSIX RTS. 2007-05-21 15:35:47 +00:00
skrll 5492d86688 Correct comment. 2007-05-21 11:56:35 +00:00
christos 09a50be501 - remove pathname_ interface.
- use macros to deal with pathnames in userspace, when veriexec is used.
- reorder the veriexec_ call arguments for consistency.
With help from elad@ finding the last bug.
2007-05-19 22:11:22 +00:00
yamt f03010953f merge yamt-idlelwp branch. asked by core@. some ports still needs work.
from doc/BRANCHES:

	idle lwp, and some changes depending on it.

	1. separate context switching and thread scheduling.
	   (cf. gmcgarry_ctxsw)
	2. implement idle lwp.
	3. clean up related MD/MI interfaces.
	4. make scheduler(s) modular.
2007-05-17 14:51:11 +00:00
hannken 64b7e5637e Fstrans_start() always returns zero, so change its type to void. 2007-05-17 07:26:21 +00:00
christos 50ab9d6934 - since mknod now can create regular files, make sure veriexec allows it.
Done in a way to minimize ifdefs. Per discussions with elad.
2007-05-17 00:46:30 +00:00
hannken 0453160a52 Use rwlock for fmi_shared_lock and fmi_lazy_lock.
Ok: Andrew Doran <ad@netbsd.org>
2007-05-16 16:11:56 +00:00
elad 6700cfccd6 Some Veriexec stuff that's been rotting in my tree for months.
Bug fixes:
  - Fix crash reported by Scott Ellis on current-users@.

  - Fix race conditions in enforcing the Veriexec rename and remove
    policies. These are NOT security issues.

  - Fix memory leak in rename handling when overwriting a monitored
    file.

  - Fix table deletion logic.

  - Don't prevent query requests if not in learning mode.


KPI updates:
  - fileassoc_table_run() now takes a cookie to pass to the callback.

  - veriexec_table_add() was removed, it is now done internally. As a
    result, there's no longer a need for VERIEXEC_TABLESIZE.

  - veriexec_report() was removed, it is now internal.

  - Perform sanity checks on the entry type, and enforce default type
    in veriexec_file_add() rather than in veriexecctl.

  - Add veriexec_flush(), used to delete all Veriexec tables, and
    veriexec_dump(), used to fill an array with all Veriexec entries.


New features:
  - Add a '-k' flag to veriexecctl, to keep the filenames in the kernel
    database. This allows Veriexec to produce slightly more accurate
    logs under certain circumstances. In the future, this can be either
    replaced by vnode->pathname translation, or combined with it.

  - Add a VERIEXEC_DUMP ioctl, to dump the entire Veriexec database.
    This can be used to recover a database if the file was lost.
    Example usage:

        # veriexecctl dump > /etc/signatures

    Note that only entries with the filename kept (that is, were loaded
    with the '-k' flag) will be dumped.

    Idea from Brett Lymn.

  - Add a VERIEXEC_FLUSH ioctl, to delete all Veriexec entries. Sample
    usage:

        # veriexecctl flush

  - Add a 'veriexec_flags' rc(8) variable, and make its default have
    the '-k' flag. On systems using the default signatures file
    (generaetd from running 'veriexecgen' with no arguments), this will
    use additional 32kb of kernel memory on average.

  - Add a '-e' flag to veriexecctl, to evaluate the fingerprint during
    load. This is done automatically for files marked as 'untrusted'.


Misc. stuff:
  - The code for veriexecctl was massively simplified as a result of
    eliminating the need for VERIEXEC_TABLESIZE, and now uses a single
    pass of the signatures file, making the loading somewhat faster.

  - Lots of minor fixes found using the (still under development)
    Veriexec regression testsuite.

  - Some of the messages Veriexec prints were improved.

  - Various documentation fixes.


All relevant man-pages were updated to reflect the above changes.

Binary compatibility with existing veriexecctl binaries is maintained.
2007-05-15 19:47:43 +00:00
dsl 2e12e4f4e1 Fallout from caddr_t deletion - remove a load of redundant (void *) casts. 2007-05-13 20:24:21 +00:00
dsl 9bdbb03424 nanosleep1() shouldn't try to get the current time into a NULL address. 2007-05-13 19:51:35 +00:00
dsl f23edc42dd Instead of the #define versions of tc_getfrequency() and nanouptime(), use
the function ones in kern_kern_clock.c (adding tc_getfrequency).
Adjust includes so this builds.
2007-05-13 14:43:52 +00:00
dsl 88e6c5604d Add a #define for nanouptime() in the !__HAVE_TIMECOUNTERS case. 2007-05-13 10:58:50 +00:00
dsl 1c85a3efd8 Split sys_nanosleep(). 2007-05-13 10:34:25 +00:00
dsl 701496b5c6 Split the fcntl locking code out from its copyin/out.
Use to avoid all the stackgap stuff in compat code.
2007-05-12 23:02:49 +00:00
dsl ef3fdc4a07 Change interface to settimeofday1() so that it can also be used from
compat code in order to avoid the stackgap.
2007-05-12 20:27:13 +00:00
dsl c83f8a10ad Change the compat sys_[fl]utime code to not use the stackgap. 2007-05-12 17:28:19 +00:00
dsl f56bfb975c Add the child 'rusage' of an exiting process to its own 'rusage' exactly
once, and prior to passing it to the caller of sys_wait4() and at the same
time as adding it to the parent.
Commands like:
time sh -c 'i=0; while [ $i -lt 1000 ]; do i=$(expr $i + 1); done'
now give same output.
2007-05-08 20:10:14 +00:00
manu 31b57f40ff Add the TFTPROOT kernel option for TFTP'ing root RAMdisk at root mount time.
This allows working around situations where a kernel with embedded RAMdisk
cannot be booted by the bootloader because the RAMdisk is too big.
2007-05-08 06:10:27 +00:00
rmind 10c3d35ca0 Rename vfs_aio.c to sys_aio.c as decided in <tech-kern>.
Please note, that <tech-kern> people should note about
file names before commit. Otherwise, function may fail
with errno set to EDIRTY, and return -1. ;)
2007-05-07 22:22:20 +00:00
dsl 1844147fa9 Split sys_wait4() so that compat code can fiddle with the returned 'status'
and 'rusage' without having to copy data to/from stackgap buffers.
The old split (find_stopped_child) could be removed.
amd64 seems to run netbsd32, linux and linux32 emulations. sparc64 compiles.
2007-05-07 16:53:17 +00:00
dsl 832ca390e2 Add child rusage values to exiting process in 'find_stopped_child'
so that it is (correctlly) available to the caller of wait4().
The self and child rusage values remain split for zombies.
2007-05-07 09:30:14 +00:00
dyoung e1d4e2922e In AppleTalk, IPv4, and IPv6 routing domains, help sockaddr_cmp()
avoid an indirect function call by comparing the family, length,
and bytes [dom->dom_sa_cmpofs, dom->dom_sa_cmpofs + dom->dom_sa_cmplen),
corresponding to the the sockaddrs' "address" members.

For ISO, actually use sockaddr_iso_cmp, for a change.  Thanks to
yamt@ for pointing out my error.
2007-05-06 02:56:37 +00:00
ad 501930d97e aio_init: limit wmesg strings to 8 characters. 2007-05-05 20:38:43 +00:00
yamt c9ba84ac33 aio_worker: exit properly. 2007-05-04 14:28:40 +00:00
rmind 29cb26a639 - Make aio_listio_max and aio_max changeable via sysctl.
- Set a lower priority for AIO-worker thread, because current could cause
  interactivity problems (eg. with qemu - thanks <xtraeme> for testing).
  Mark it as XXX for now - after priority model change, this should
  be reconsidered anyway.
- Do not copyout() with lock held in sys_aio_cancel().
- Fix a leak of the lock in aio_process().
- Check for any error of cv_wait_sig().
- Cache p->p_aio in aio_exit().

Thanks <ad> for catching the issues!
2007-05-03 22:03:40 +00:00
dyoung 72f0a6dfb0 Eliminate address family-specific route caches (struct route, struct
route_in6, struct route_iso), replacing all caches with a struct
route.

The principle benefit of this change is that all of the protocol
families can benefit from route cache-invalidation, which is
necessary for correct routing.  Route-cache invalidation fixes an
ancient PR, kern/3508, at long last; it fixes various other PRs,
also.

Discussions with and ideas from Joerg Sonnenberger influenced this
work tremendously.  Of course, all design oversights and bugs are
mine.

DETAILS

1 I added to each address family a pool of sockaddrs.  I have
  introduced routines for allocating, copying, and duplicating,
  and freeing sockaddrs:

        struct sockaddr *sockaddr_alloc(sa_family_t af, int flags);
        struct sockaddr *sockaddr_copy(struct sockaddr *dst,
                                       const struct sockaddr *src);
        struct sockaddr *sockaddr_dup(const struct sockaddr *src, int flags);
        void sockaddr_free(struct sockaddr *sa);

  sockaddr_alloc() returns either a sockaddr from the pool belonging
  to the specified family, or NULL if the pool is exhausted.  The
  returned sockaddr has the right size for that family; sa_family
  and sa_len fields are initialized to the family and sockaddr
  length---e.g., sa_family = AF_INET and sa_len = sizeof(struct
  sockaddr_in).  sockaddr_free() puts the given sockaddr back into
  its family's pool.

  sockaddr_dup() and sockaddr_copy() work analogously to strdup()
  and strcpy(), respectively.  sockaddr_copy() KASSERTs that the
  family of the destination and source sockaddrs are alike.

  The 'flags' argumet for sockaddr_alloc() and sockaddr_dup() is
  passed directly to pool_get(9).

2 I added routines for initializing sockaddrs in each address
  family, sockaddr_in_init(), sockaddr_in6_init(), sockaddr_iso_init(),
  etc.  They are fairly self-explanatory.

3 structs route_in6 and route_iso are no more.  All protocol families
  use struct route.  I have changed the route cache, 'struct route',
  so that it does not contain storage space for a sockaddr.  Instead,
  struct route points to a sockaddr coming from the pool the sockaddr
  belongs to.  I added a new method to struct route, rtcache_setdst(),
  for setting the cache destination:

        int rtcache_setdst(struct route *, const struct sockaddr *);

  rtcache_setdst() returns 0 on success, or ENOMEM if no memory is
  available to create the sockaddr storage.

  It is now possible for rtcache_getdst() to return NULL if, say,
  rtcache_setdst() failed.  I check the return value for NULL
  everywhere in the kernel.

4 Each routing domain (struct domain) has a list of live route
  caches, dom_rtcache.  rtflushall(sa_family_t af) looks up the
  domain indicated by 'af', walks the domain's list of route caches
  and invalidates each one.
2007-05-02 20:40:22 +00:00
yamt 6bcb315f7d lockdebug_abort: s/int/u_int/ for lock id as the rest of code. 2007-05-02 14:07:02 +00:00
rmind 0994dd0691 - Create sysctl nodes for AIO.
- Add POSIX defined system variables and constants of AIO_LISTIO_MAX and
  AIO_MAX values.  Both with _POSIX_ASYNCHRONOUS_IO, provide them in
  sysconf(3) and getconf(1) interfaces.
- Clean up sysconf(3) for handling sysctl nodes dynamically.
2007-05-01 01:01:25 +00:00
dsl e6918d8f47 Remove proc->p_ru and the 'rusage' pool.
I think it existed to cache the numbers in kernel memory of a zombie when
proc->p_stats was part of the 'u' area - so got freed earlier and wouldn't
(easily) be accessible from a separate process.  However since both the
p_ru and p_stats fields are freed at the same time it is no longer needed.
Ride the recent 4.99.19 version change.
2007-04-30 20:11:41 +00:00
rmind 9c025db4ef Regen syscalls for AIO. 2007-04-30 14:47:32 +00:00
rmind 67d703cf25 Import of POSIX Asynchronous I/O.
Seems to be quite stable. Some work still left to do.

Please note, that syscalls are not yet MP-safe, because
of the file and vnode subsystems.

Reviewed by: <tech-kern>, <ad>
2007-04-30 14:44:28 +00:00
dsl 0df00dcf55 Split the statvfs functions so that the 'work' is done to a kernel buffer
which can either be copied directly to userspace, or converted then copied.
Saves replicating a lot of code in the compat functions (esp. for
getvfsstat) at a cast of an extra function call in the non-emulated case -
which is unlikely to be measurable given the other costs of the actions
involved (even on vax).
Remove dofhstat() and dofhstatvfs() (and the last caller).
Remove some redundant stackgap_init() calls.
2007-04-30 08:32:14 +00:00
msaitoh 8ce1f4fff2 fix typos 2007-04-29 20:23:34 +00:00
isaki e7c552f22e Fix format of the combination of 'F\B\L' and ':\V' in
bitmask_snprintf(9).
2007-04-28 13:11:53 +00:00
dsl e9a2689558 Since ktrace/systrace can sleep, move the VREF(dp) to before them. 2007-04-26 21:21:44 +00:00
dsl 41bef1b523 Be a little less over-zelous about converting ".." at the emulation root
to the real root.  Rather that do the check inside lookup() - where it
applies to to every ".." in a pathname, explicitly check the start of
the caller-supplied buffers and any absolute symbolic links.
Note that in the latter case the re-search from the real root is supressed.
Should fix PR kern/36225
2007-04-26 20:58:37 +00:00
dsl 9f6d43522e Pass the emulation root string into namei() from emul_find_interp() so that
the ktrace entries for lookups done during exec can have the full filename.
This is rather a hack :-)
2007-04-26 20:06:55 +00:00
dsl 7a81c4d42e Move the ktrace (and systrace) in namei() inside the retry loop for
emulation lookups.
If doing a lookup relative to the emulation root, prepend the emulation root
to the traced filename.
While here pass the filename length through to the ktrace code since namei()
knows the length and ktr_namei() would have to call strlen().
Note: that if namei() is being called during execve processing, the emulation
root name isn't available and "/emul/???" is used.  Also namei() has to use
strlen() to get the lenght on the emulatoon root - even though it is a
compile-time constant string.
2007-04-26 16:27:32 +00:00
dsl 47799dd2af Move the place where we convert the return value of emulation lookups that
would return the emulation-root to the real root to the main exit path.
Means that lookups of both "/" and "/." get converted from "/emul/xxx" to "/".
2007-04-25 20:41:42 +00:00
dsl 0182ef09da When we return the real root instead of the emulated root, we may
not have the parent vnode for the emulated root - so dont vput() it.
May fix PR kern/36197.
2007-04-23 07:04:30 +00:00
dsl 2ad47f228f I'm not sure why I decided that cwdinit() shouldn't copy cwd_edir.
Since this is called in fork() it does rather need to give the child
process the parent's emulation root.
This means that (for example) an emulated shell will, by default, run
programs from the emulation root.
2007-04-22 18:41:49 +00:00
dsl b8fbaf8c4b Change the way that emulations locate files within the emulation root to
avoid having to allocate space in the 'stackgap'
  - which is very LWP unfriendly.
The additional code for non-emulation namei() is trivial, the reduction for
  the emulations is massive.
The vnode for a processes emulation root is saved in the cwdi structure
  during process exec.
If the emulation root the TRYEMULROOT flag are set, namei() will do an initial
  search for absolute pathnames in the emulation root, if that fails it will
  retry from the normal root.
".." at the emulation root will always go to the real root, even in the middle
  of paths and when expanding symlinks.
Absolute symlinks found using absolute paths in the emulation root will be
  relative to the emulation root (so /usr/lib/xxx.so -> /lib/xxx.so links
  inside the emulation root don't need changing).
If the root of the emulation would be returned (for an emulation lookup), then
  the real root is returned instead (matching the behaviour of emul_lookup,
  but being a cheap comparison here) so that programs that scan "../.."
  looking for the root dircetory don't loop forever.
The target for symbolic links is no longer mangled (it used to get the
  CHECK_ALT_xxx() treatment, so could get /emul/xxx prepended).
CHECK_ALT_xxx() are no more. Most of the change is deleting them, and adding
  TRYEMULROOT to the flags to NDINIT().
A lot of the emulation system call stubs could now be deleted.
2007-04-22 08:29:55 +00:00
ad b0c22204d2 process_stoptrace: after setting a pending stop on curproc, call issignal
once to have it do the needful. PR kern/36161.
2007-04-19 22:42:10 +00:00
yamt 3829d825af malloc: fix a deadlock. 2007-04-19 11:03:44 +00:00
yamt 2c410c0431 sys_accept: fix usecount botch and double soclose in rev.1.108. 2007-04-18 10:20:02 +00:00
pooka 052ed1b786 wrap calls to pgsignal() in proclist_mutex 2007-04-17 19:52:56 +00:00
chs aba740b225 define a pager flag PGO_RECLAIM, similar to FSYNC_RECLAIM, and use it
to skip unnecessary flushing when layered file system vnodes are recycled.
this also prevents a deadlock with the dodgy LFS putpages routine.
fixes the non-LFS part of PR 36150.
2007-04-16 05:14:54 +00:00
yamt 2f6be2ad41 - soabort: don't leak a socket on error.
- add an assertion.
2007-04-15 05:25:48 +00:00
yamt db7c239cd4 sys_accept: don't leak a socket on error. 2007-04-15 05:25:02 +00:00
perseant 55307f6a04 Include the lwpid in the lock panic message, so we don't see silly messages
like
	lockmgr: pid 17, not exclusive lock holder 17 unlocking
2007-04-14 06:59:25 +00:00
ad c7f468e608 turnstile_wakeup: when restoring inherited priority, only lock curlwp
if its lock is sched_mutex. We can arrive here while on a sleep queue
(from eg cv_wait) and so curlwp will already be locked.
2007-04-10 13:11:08 +00:00
pooka f3fbb884a5 If mount(MNT_UPDATE) is called for a non-VROOT directory, don't vput()
the "mountpoint" vnode twice due to an error branch.

thanks go to Gert Doering for reporting the problem and testing the fix
and to Juergen Hannken-Illjes for much of the analysis work leading to
the discovery of the problem cause
2007-04-09 21:11:03 +00:00
gdt c2f4bcfa32 regen
(changes in RCS Ids only)
2007-04-09 15:00:42 +00:00
gdt bf25020786 vop_link: reorder commented arguments to match actual calling order
(dvp, vp).

ok wrstuden@
2007-04-09 14:58:28 +00:00
hannken fc6776f366 Remove now obsolete vn_start_write() and vn_finished_write() and
corresponding flags.

Revert softdep_trackbufs() to its state before vn_start_write() was added.

Remove from struct mount now unneeded flags IMNT_SUSPEND* and
members mnt_writeopcountupper, mnt_writeopcountlower and mnt_leaf.

Welcome to 4.99.17
2007-04-08 11:20:42 +00:00
rmind 1e2aad36da Revert the latest changes back to 1.25 rev. 2007-04-05 01:33:31 +00:00
rmind 330166a2eb Fix tbl, which was misstyped as tlb. 2007-04-04 11:01:10 +00:00
wrstuden db2a757990 Add a KASSERT to address CID: 4335.
Make sure that if we pull a buffer off of the read queue that it really
is a read request. Lower in this routine we base which queue we
dequeue the request from on its read/write state. Thus if a write
op ever ended up on the read queue, we'd explode (dereference NULL).
2007-04-04 02:30:43 +00:00
rmind 1db98c3723 socreate: l cannot be NULL.
CID: 4314
2007-04-03 23:44:53 +00:00
rmind 497adf4cc1 drvctlioctl: Plug a possible memory leak.
CID: 4363
2007-04-03 23:02:39 +00:00
rmind 5174ef0ece fileassoc_file_delete: Handle an error case of fileassoc_table_lookup().
CID: 4431
2007-04-03 22:29:23 +00:00
hannken 0adf7298aa Remove calls to now obsolete vn_start_write() and vn_finished_write(). 2007-04-03 16:11:31 +00:00
yamt ef47d5b67e - don't use veriexec_mountspecific_key uninitialized.
- fix weird "Veriexec: IDS mode, allowing unmount" messages.
2007-04-03 09:17:31 +00:00
christos 7074d009d5 Don't panic if we don't find a symbol or string table. Perhaps the kernel
has been stripped?
2007-04-02 16:44:44 +00:00
hannken 13daf5bc6e Remove calls to now obsolete vn_start_write() and vn_finished_write(). 2007-04-01 10:15:01 +00:00
ad 0ac3a31ea3 Cosmetic changes. 2007-03-30 11:06:58 +00:00
ad 3d5b66ed02 Always include kernel_lock so that LOCKDEBUG checks can find the symbol. 2007-03-30 11:05:59 +00:00
ad 5714ab2718 Make cv_has_waiters() return type bool. 2007-03-29 17:39:34 +00:00
ad 79da439b94 - cv_wakeup, cv_broadcast -> cv_signal where appropriate
- Update some comments.
2007-03-29 17:37:13 +00:00
ad 4911263df8 cv_wakeup -> cv_signal 2007-03-29 17:35:17 +00:00
ad 6cf46baa77 - cv_wakeup: remove this. There are ~zero situations where it's useful.
- cv_wait and friends: after resuming execution, check to see if we have
  been restarted as a result of cv_signal. If we have, but cannot take
  the wakeup (because of eg a pending Unix signal or timeout) then try to
  ensure that another LWP sees it. This is necessary because there may
  be multiple waiters, and at least one should take the wakeup if possible.
  Prompted by a discussion with pooka@.
- typedef struct lwp lwp_t;
- int -> bool, struct lwp -> lwp_t in a few places.
2007-03-29 17:34:39 +00:00
hubertf 3bfc0c42ee Remove duplicate #include's
From: Slava Semushin <php-coder@altlinux.ru>
2007-03-26 22:52:44 +00:00
rmind 7b9af0160d Handle newlwp() error case. Currently, newlwp() cannot fail, but this
will likely change in the future.
2007-03-24 16:43:56 +00:00
ad bb25376cda Fix a deadlock w/kqueue that was introduced with the last set of changes.
Spotted by yamt@.
2007-03-23 18:33:43 +00:00
dsl f99253cbf6 Somehow a single K&R function definition was lurking - nuke it. 2007-03-21 21:18:56 +00:00
ad fed1793605 Improvements to lwp_wait1(), for PR kern/35932:
- Better detect simple cycles of threads calling _lwp_wait and return
  EDEADLK. Does not handle deeper cycles like t1 -> t2 -> t3 -> t1.
- If there are multiple threads in _lwp_wait, then make sure that
  targeted waits take precedence over waits for any LWP to exit.
- When checking for deadlock, also count the number of zombies currently
  in the process as potentially reapable. Whenever a zombie is murdered,
  kick all waiters to make them check again for deadlock.
- Add more comments.

Also, while here:

- LOCK_ASSERT -> KASSERT in some places
- lwp_free: change boolean arguments to type 'bool'.
- proc_free: let lwp_free spin waiting for the last LWP to exit, there's
  no reason to do it here.
2007-03-21 18:25:59 +00:00
ad e0fd341348 Changes to LWP wakeup:
- Don't bother sorting the sleep queues, since user space controls the
  order of removal.
- Change setrunnable(t) to lwp_unsleep(t). No functional change from the
  perspective of user applications.
- Minor cosmetic changes.
2007-03-20 23:25:17 +00:00
skrll 335ac44f76 Restore previous semantics of PT_LWPINFO and make sure to lwp_addref the
LWP.

OK'ed by ad.
2007-03-15 20:55:15 +00:00
ad 1b83cbc3d6 sodopendfreel: Getting a bit over ambitious.. Go to splvm() before calling
pool_cache_put().
2007-03-15 16:28:31 +00:00
ad 06aeb1d344 - Remove the LWP counters. The race between park/unpark rarely occurs
so it's not worth counting.

- lwp_wakeup: set LW_UNPARKED on the target. Ensures that _lwp_park will
  always be awoken even if another system call eats the wakeup, e.g. as a
  result of an intervening signal. To deal with this correctly for other
  system calls will require a different approach.

- _lwp_unpark, _lwp_unpark_all: use setrunnable if the LWP is not parked
  on the same sync queue: (1) simplifies the code a bit as there no point
  doing anything special for this case (2) makes it possible for p_smutex
  to be replaced by p_mutex and (3) restores the guarantee that the 'hint'
  argument really is just a hint.
2007-03-14 23:58:24 +00:00
yamt b84c74b2d4 sys__lwp_park: whitespace. no functional change. 2007-03-14 23:07:27 +00:00
yamt b1b0d0db04 sys__lwp_park: don't restart on signals. PR/35969 from Andrew Doran. 2007-03-14 23:00:32 +00:00
dyoung 3cd3acad77 Exclude some files that replicate NetBSD typedefs and #defines. 2007-03-14 17:20:22 +00:00
ad 19ae9745a3 Don't call pipe_init if PIPE_SOCKETPAIR is defined. 2007-03-13 17:23:49 +00:00
ad 883bea1471 Revert previous now that simplelock.h has been fixed. 2007-03-13 15:59:47 +00:00
dogcow 592f917095 now that simple_lock is a define elsewhere as well, #undef it in the
regress case.
2007-03-13 13:25:57 +00:00
thorpej 217c6e4c0e Return EEXIST if attempting to install a RAS that is already installed. 2007-03-13 04:44:06 +00:00
ad a240617e8c msgctl1: fix a lock leak. 2007-03-13 03:43:54 +00:00
ad 1c7c7fe356 Sync with kern_proc.c: make p2->p_rasmutex a spin mutex at IPL_SCHED. 2007-03-13 00:35:44 +00:00
ad bf8c3c1d7b mutex_vector_enter: put a read memory barrier between the final check that
(1) the holder is no longer running and (2) the waiters bit is set. Needed
to ensure that the operations happen in the correct order.
2007-03-12 22:34:08 +00:00
ad 194273271b Use mutexes/condvars. 2007-03-12 21:33:07 +00:00
ad c81da4c01d Put a lock around pipe->pipe_peer. 2007-03-12 21:31:03 +00:00
ad b171797731 Pass an ipl argument to pool_init/POOL_INIT to be used when initializing
the pool's lock.
2007-03-12 19:05:05 +00:00
ad 59d979c5f1 Pass an ipl argument to pool_init/POOL_INIT to be used when initializing
the pool's lock.
2007-03-12 18:18:22 +00:00
ad 3fcdeca2cc Use mutexes. 2007-03-12 16:42:14 +00:00
ad 7888016cf9 Use mutexes & condvars. 2007-03-12 16:20:53 +00:00
matt 57257364a0 Define/use MUTEX_COUNT_BIAS for those implementations that need one (like
vax).
2007-03-12 02:19:14 +00:00
ad a3128f66df Adjust previous: move the release of specificdata after the very last
file system operation.
2007-03-11 23:40:58 +00:00
ad 1bf149ba4c exit1: destroy the proc/lwp specificdata after calling uvm_proc_exit, as
file systems can still be using it.
2007-03-11 23:19:49 +00:00
ad f96f2e2a7f Add the LWP's runtime to kinfo_lwp. 2007-03-11 21:38:38 +00:00
ad 9a92ddadc8 Put back mtsleep() temporarily. Converting everything over to condvars
at once will take too much time..
2007-03-11 21:36:48 +00:00
dsl 6d1bab1af3 Split the work for sys_stat, sys_lstat, sys_fstat and sys_fhstat out into
separate functions that don't do the copyout.
This allows all the compat_xxx versions to convert the 'struct stat' to
the correct format without using the 'stackgap'.
The stackgap isn't at all LWP friendly, and needs to be removed from
any compat functions that might involve threads (inc. clone()).
The code is still binary compatible with existing LKMs.
2007-03-10 16:50:01 +00:00
ad b1da576054 Add a MUTEX_NODEBUG type that avoids allocating debugging resources for
the lock. To be used for e.g. struct vm_page until a better way is found.
2007-03-10 16:01:13 +00:00
ad 64e54fbb70 lockdebug:
- Initialize on the first allocation.
- Handle overflow better. PR kern/35723.
2007-03-10 15:56:21 +00:00
ad ba01c7d177 qc_init: don't leave pointers to destroyed pools hanging or we will
allocate from them later.
2007-03-10 15:54:14 +00:00
matt 770557b66a If STACKALIGN is defined, use it instead of ALIGN. Some arches need a
stack more aligned that ALIGN will give.
2007-03-09 22:25:56 +00:00
ad c147748d84 - Make the proclist_lock a mutex. The write:read ratio is unfavourable,
and mutexes are cheaper use than RW locks.
- LOCK_ASSERT -> KASSERT in some places.
- Hold proclist_lock/kernel_lock longer in a couple of places.
2007-03-09 14:11:22 +00:00
ad 50a8df5d23 mutex_onproc: remove unnecessary memory barriers. 2007-03-09 14:08:26 +00:00
yamt fd1a6294d1 fileassoc_table_lookup: call fileassoc_init if it has not been done yet.
fixes crashes sys_unlink when there are no users of fileassoc.
2007-03-09 05:51:50 +00:00
yamt 27515959ec fix typos in comments. 2007-03-09 05:00:26 +00:00
ad 7caf5b2025 trace_enter, trace_exit: acquire kernel_lock for systrace. 2007-03-08 21:25:27 +00:00
drochner c29d907bea use char* for the kernel representation of the user profile buffer
address too, for consistency
(we've lost some abstraction here)
2007-03-06 16:16:02 +00:00
drochner 5f590e753e regen 2007-03-06 16:10:17 +00:00
drochner 067e5852ea make the first argument to profil(2) char*, for consistency with <unistd.h> 2007-03-06 16:09:21 +00:00
drochner 7767c569f2 Make the attach functions for real and pseudo devices share as much code
as possible. For that, split out a function which does the allocation
of a softc (without linking it into global structures) and a function
which inserts the device into the global alldevs lists and the per-driver
cd_devs.
There is a little semantic change involved: the pseudo-device code didn't
interpret FSTATE_STAR as such, for no good reason. This looks harmless;
I'll modify driver frontends as I find ways to test.
Get config_makeroom() out of the public namespace - that's clearly an
internal of autoconf which drivers can't be allowed to deal with.
2007-03-05 20:32:43 +00:00
ad 0261e46854 - proc_unstop: adjust p_nrlwps correctly. Should fix PR kern/35657.
- LOCK_ASSERT -> KASSERT
- Update a couple of comments.
2007-03-05 20:29:14 +00:00
yamt a71bbfc44d netbsd_elf_signature: fix a caddr_t removal botch which
causes "init: not found".
2007-03-05 09:22:02 +00:00
dogcow 66b89c08f2 die, caddr_t, die. 2007-03-05 04:59:19 +00:00
mrg 3a04ec414c change an error message from:
Mutex error: sched_unlock_idle: sched_unlock_idle
to
	Mutex error: sched_unlock_idle: sched_mutex not locked
2007-03-04 21:06:13 +00:00
ad 681b77eb72 lwp_userret: if the process is exiting, don't bother looking for signals. 2007-03-04 20:59:00 +00:00
yamt 95ef0a2720 fix a fallout from caddr_t changes. 2007-03-04 14:33:57 +00:00
christos 2058fdeab3 add a lockpanic function that prints more detailed error messages. 2007-03-04 06:20:25 +00:00
christos 53524e44ef Kill caddr_t; there will be some MI fallout, but it will be fixed shortly. 2007-03-04 05:59:00 +00:00
itohy d2585a8c91 Remove extra space so that symbol renaming works properly. 2007-03-03 10:08:18 +00:00
ad 61a2eec6c3 _lwp_wakeup: set the cancellation pending if the LWP is not sleeping. 2007-03-02 21:06:27 +00:00
ad 4cbc498383 sys__lwp_park: explicitly drop the kernel lock, for the benefit of compat32.
XXX The stack gap stuff is not MP or MT safe and needs to go away.
2007-03-02 16:14:37 +00:00
ad 8a9f592723 sys__lwp_park: on a !MULTIPROCESSOR kernel the LWP is already locked. 2007-03-02 16:09:53 +00:00
itohy cdbe0f0296 kern_mutex.c:190: macro `MUTEX_RECEIVE' used without args
kern_mutex.c:199: macro `MUTEX_RECEIVE' used without args
kern_mutex.c:206: macro `MUTEX_GIVE' used without args
2007-03-02 13:14:12 +00:00
yamt 6d6b100a95 kmem_backend_alloc: fix a null dereference. 2007-03-02 12:30:53 +00:00
martin dd8b45ebc6 Split the disklabel checksum function into two, so we can pass the
length separately.
Use this for foreign-endianess labels in wedge autodiscovery, and
calculate the checksum of those before we swap various fields in the
label.
2007-03-01 21:30:50 +00:00
ad 0bffc80584 Fix a couple of races with LWP park/unpark. 2007-03-01 14:55:06 +00:00
pooka f7ed04a6ff simplify previous a bit. no functional change. 2007-03-01 10:02:31 +00:00
pooka 428270cc03 avoid lock leak in error branch of sys_fchdir()
thanks to Tom Spindler and Greg Oster in helping find the cure
2007-02-28 20:39:06 +00:00
ad a76d1d298c Further avoid unnecessary trips through lwp_userret()/issignal(). 2007-02-27 15:19:54 +00:00
yamt c574bfa378 typedef pri_t and use it instead of int and u_char. 2007-02-27 15:07:28 +00:00
ad 72b15048da turnstile_wakeup(): on a !MULTIPROCESSOR kernel the LWP is already locked. 2007-02-27 12:17:55 +00:00
ad cbe547e6a7 - Nuke mutex_owner()
- mutex_getowner() -> mutex_owner()
2007-02-26 19:11:28 +00:00
ad f944608c11 Add a comment. 2007-02-26 19:06:10 +00:00
drochner b68dbc6775 regen 2007-02-26 12:20:03 +00:00
drochner 8b8213b508 sync with lwp.h: _lwp_unpark_all() returns ssize_t 2007-02-26 12:19:00 +00:00
yamt e781af39bd implement priority inheritance. 2007-02-26 09:20:52 +00:00
christos 2a84b2c2c1 Revert the kauth_impl.h change. Elad is going to maintain this. Asked by core@ 2007-02-24 20:41:33 +00:00
ad 9501d652a0 setrunnable(): don't require that sleeps be interruptable. This breaks
smbfs. Fixes PR/35787.
2007-02-23 16:51:47 +00:00
thorpej 4f3d5a9cc0 TRUE -> true, FALSE -> false 2007-02-22 06:34:42 +00:00
matt 93feeb1203 Fix lossage from boolean_t -> bool and updated x86 bus_dma. 2007-02-22 04:38:02 +00:00
thorpej dd962f8680 Pick up some additional files that were missed before due to conflicts
with newlock2 merge:

Replace the Mach-derived boolean_t type with the C99 bool type.  A
future commit will replace use of TRUE and FALSE with true and false.
2007-02-21 23:48:10 +00:00
thorpej 712239e366 Replace the Mach-derived boolean_t type with the C99 bool type. A
future commit will replace use of TRUE and FALSE with true and false.
2007-02-21 22:59:35 +00:00
ad 67323d2552 When sending signals, only boost the priority of the receiving LWP if
the process is being killed.
2007-02-20 17:47:03 +00:00
ad cebcfebbd2 kernel_lock():
- Fix error in previous.
- Call LOCKDEBUG_WANTLOCK() so the "exclusive wanted" count isn't off.
2007-02-20 16:10:10 +00:00
ad 723654a989 _kernel_lock(): we can recurse here if we take an interrupt while spinning.
Don't double book the time spent with lockstat.
2007-02-20 15:56:59 +00:00
dsl 1736f4ea10 Revert 'optimisation' added in rev 1.179.
On i386 (at least) gcc manages two generate two forwards branches which are not
usually taken for the old code, and one forwards branch that is usually taken
for my 'improved version'.  Since (IIRC) both athlon and P4 will predict
forwards branches 'not taken' the old code is likely to be faster :-(
Faster variants exist, especially ones using the cmov instruction.
2007-02-19 22:14:15 +00:00
cube 632ece3eaf Introduce a new member to struct emul, e_startlwp, to be used by
sys__lwp_create.  It allows using the said syscall under COMPAT_NETBSD32.

The libpthread regression tests now pass on amd64 and sparc64.
2007-02-19 15:10:02 +00:00
matt 44109561cb Convert to structure initializers. Use __arraycount 2007-02-18 23:16:59 +00:00
pooka 2da757310f if doing VOP_CREATE via sys_mknod, set va_rdev to VNOVAL instead of 0 2007-02-18 20:36:36 +00:00
pooka 2deb71d45f Support creating regular files with mknod(2) to match Linux/Solaris
behaviour.  This happens if mode contains S_IFREG.  mknod(2) is
still restricted to the superuser.

no objections from tech-kern
2007-02-18 19:57:29 +00:00
dsl d64834e4f1 Add code to support per-system call statistics:
option SYSCALL_STATS	counts the number of times each system call is made
option SYSCALL_TIMES	counts the amount of time spent in each system call
Currently the counting hooks have only been added to the i386 system call
handler, and the time spent in interrupts is not subtracted.
It ought also be possible to add the times to the processes profiling
counters in order to get a more accurate user/system/interrupt split.
The counts themselves are readable via the sysctl interface.
2007-02-18 16:58:15 +00:00
dsl ff6d800c8f Optimise canonicalisation of l_rtime for the case when the start and stop
times are in the same second.
2007-02-18 16:03:06 +00:00
dsl 6209b5bbf3 The pre-kauth 'struct ucread' and 'struct pcred' are now only used in the
(depracted some time ago) 'struct kinfo_proc' returned by sysctl.
Move the definitions to sys/syctl.h and rename in order to ensure all the
users are located.
2007-02-18 15:20:34 +00:00
dyoung 5493f188c7 KNF: de-__P, bzero -> memset, bcmp -> memcmp. Remove extraneous
parentheses in return statements.

Cosmetic: don't open-code TAILQ_FOREACH().

Cosmetic: change types of variables to avoid oodles of casts: in
   in6_src.c, avoid casts by changing several route_in6 pointers
   to struct route pointers.  Remove unnecessary casts to caddr_t
   elsewhere.

Pave the way for eliminating address family-specific route caches:
   soon, struct route will not embed a sockaddr, but it will hold
   a reference to an external sockaddr, instead.  We will set the
   destination sockaddr using rtcache_setdst().  (I created a stub
   for it, but it isn't used anywhere, yet.)  rtcache_free() will
   free the sockaddr.  I have extracted from rtcache_free() a helper
   subroutine, rtcache_clear().  rtcache_clear() will "forget" a
   cached route, but it will not forget the destination by releasing
   the sockaddr.  I use rtcache_clear() instead of rtcache_free()
   in rtcache_update(), because rtcache_update() is not supposed
   to forget the destination.

Constify:

   1 Introduce const accessor for route->ro_dst, rtcache_getdst().

   2 Constify the 'dst' argument to ifnet->if_output().  This
     led me to constify a lot of code called by output routines.

   3 Constify the sockaddr argument to protosw->pr_ctlinput.  This
     led me to constify a lot of code called by ctlinput routines.

   4 Introduce const macros for converting from a generic sockaddr
     to family-specific sockaddrs, e.g., sockaddr_in: satocsin6,
     satocsin, et cetera.
2007-02-17 22:34:07 +00:00
pavel 934634a18c Change the process/lwp flags seen by userland via sysctl back to the
P_*/L_* naming convention, and rename the in-kernel flags to avoid
conflict. (P_ -> PK_, L_ -> LW_ ). Add back the (now unused) LSDEAD
constant.

Restores source compatibility with pre-newlock2 tools like ps or top.

Reviewed by Andrew Doran.
2007-02-17 22:31:36 +00:00
dsl bcedbf7f41 Acquire proclist_lock in pgid_in_session() so we don't reference potentially
stale proc & pgrp pointers.
2007-02-17 21:46:13 +00:00
dsl c8a3495cd1 Acquire proclist_lock across the p_find() and pg_find() calls while
processing FIOSETOWN and TIOCSPGRP ioctls.
2007-02-17 21:43:08 +00:00
hannken 198beb0314 Make fstrans(9) the default helper for file system suspension.
Replaces the now obsolete vn_start_write()/vn_finished_write().
2007-02-16 17:23:53 +00:00
ad 3363855a4a Remove spllowersoftclock() and CLKF_BASEPRI(), and always dispatch callouts
via a soft interrupt. In the near future, softclock will be run from process
context.
2007-02-16 02:53:43 +00:00
ad 57aa4fbf3b proc_free() was returning a NULL rusage pointer to wait() when a traced
process was reparented. Change proc_free() to copy the rusage to a buffer
on the stack if required, so it can be passed both to the debugger and
to the real parent process.

Fixes kern/35582 (kernel panics with gdb).
2007-02-16 00:39:16 +00:00
ad a72414e44c lwp_free(): pass curlwp to KERNEL_LOCK(), not 'l'. 2007-02-16 00:35:45 +00:00
ad 2b011d2fa7 sigswitch(): don't blat the kernel_lock count that sleepq_block() saved
earlier.
2007-02-16 00:35:20 +00:00
ad 087fdb9080 Count the number of CPUs at boot and stash in 'ncpu'. Eventually should
have each CPU register at attach, so we can figure out the topology for
the scheduler.
2007-02-15 20:32:47 +00:00
ad d91014721f Add uvm_kick_scheduler() (MP safe) to replace wakeup(&proc0). 2007-02-15 20:21:13 +00:00
ad 10a11a26b3 - Add a mutex_wakeup() which clears the waiters flag and wakes all waiters.
Will be needed to fix a problem with mutexes on sparc.
- mutex_tryenter(): fix a false "locking against myself" error.
2007-02-15 15:49:27 +00:00
ad 9abeea588a Replace some uses of lockmgr() / simplelocks. 2007-02-15 15:40:50 +00:00
ad dc5c8ac21f Restore proc::p_userret in a limited way for Linux compat. XXX 2007-02-15 15:13:10 +00:00
yamt d972f83ff5 sigswitch: fix a deadlock. 2007-02-15 15:10:44 +00:00
ad d5bb4b3485 Remove some pointless !__NetBSD__ cases. 2007-02-15 15:08:59 +00:00
yamt b8060d4382 newlwp: ensure not to assign lid 0. 2007-02-15 15:08:42 +00:00
yamt 0844695f78 unwrap short lines. 2007-02-11 15:41:53 +00:00
yamt f39831ee99 workqueue_exit: update a comment. 2007-02-11 15:37:20 +00:00
yamt be27733fd7 use cv_signal rather than cv_broadcast where appropriate. 2007-02-11 15:36:35 +00:00
yamt 8721382dee remove a duplicated inclusion of sleepq.h. 2007-02-11 14:29:01 +00:00
ad 6bcf70b518 - Add/correct comments.
- Print correct function name when an assertion triggers.
2007-02-10 21:07:52 +00:00
hannken 9c928583f1 newlock2: syncer_lock is now a mutex. 2007-02-10 15:51:02 +00:00
yamt 997a2a3c4f remove function prototypes of sa_awaken. 2007-02-10 14:02:01 +00:00
ad 2a34c11ab8 Regen. 2007-02-10 11:32:58 +00:00
ad b6ab00c330 A quick hack to get things building again: put back the SA system calls
with no arguments, and alias them to sys_nosys. To be revisited.
2007-02-10 11:32:21 +00:00
ad 8f4adbff6b Regen. 2007-02-10 10:25:44 +00:00
ad f7c038012b Fix arguments to _lwp_park/unpark/unpark_all to match userland. 2007-02-10 10:24:44 +00:00
ad 36d73dc21a Remove unused file. 2007-02-10 10:18:32 +00:00
christos 1735b4d5c0 avoid using struct proc in the perfctrs case, where the variable might
not be used.
2007-02-10 02:55:18 +00:00
ad b07ec3fc38 Merge newlock2 to head. 2007-02-09 21:55:00 +00:00
elad 5a6bb5eba2 remove empty line 2007-02-08 16:06:58 +00:00
elad 24d02b5648 style nit 2007-02-08 00:26:50 +00:00
rmind ea2709ce49 PR/28458: shmat(2) shmaddr argument is not honored as intended.
Patch applied, thanks for Minoura Makoto.

Please note, that one should fail if cannot attach to shmaddr,
but not attach it to other place.

OK by uwe@
2007-02-07 18:45:36 +00:00
elad 01b9a124ad - Properly autocreate tables,
- Properly track number of used slots in the table,
- Track number of "assocs" per entry.
2007-02-07 09:38:04 +00:00
elad 3d8c2eee5f Add comment referring to kvm_proc.c. 2007-02-07 08:04:48 +00:00
elad 119d4b5acd PR/35253: YAMAMOTO Takashi: fileassoc hash size problem
fileassoc_table_add() was removed from the KPI and made internal. From now
fileassoc(9) will manage the optimal table size internally.

Input from and okay yamt@.
2007-02-06 01:09:48 +00:00
rillig ff925d7fe2 typo. 2007-02-05 14:34:29 +00:00
yamt f6217feae5 kmem_alloc: fix a null dereference reported by Chuck Silvers. 2007-02-05 11:53:46 +00:00
elad 9ac600139e Initialize pathname_t objects to NULL. 2007-02-04 20:33:02 +00:00
chs 0507747213 more fixes for the new vnode locking scheme:
- don't use SAVESTART in calls to relookup() from unionfs,
   just vref() the desired vnode when we need to.
 - fix locking and refcounting in the unionfs EEXIST error cases.
 - release any vnode locks before calling VFS_ROOT(), vfs_busy() is enough.
   this allows us to simplify union_root() and fix PR 3006.
 - union_lock() doesn't handle shared lock requests correctly,
   so convert them to exclusive instead.  fixes PR 34775.
 - in relookup(), avoid reusing "dp" for different purposes,
   the error handling wasn't right.  (actually just get rid of dp.)
   also, change relookup() to ignore LOCKLEAF and always return the
   vnode locked since the callers already expect this.
2007-02-04 15:03:20 +00:00
cbiere 89165435c8 Avoid unnecessary cast in bufq_disksort_init(). 2007-02-01 00:36:37 +00:00
elad 85f515764b Fix notify only logic for credentials scope. Thanks ad@! 2007-01-31 16:30:09 +00:00
ad f8ab9664c4 ffree(): don't call kauth_cred_free() with a held simplelock. 2007-01-31 16:00:43 +00:00
elad c439bcfe43 Add a new scope, the credentials scope, which is internal to the kauth(9)
implementation and meant to be used by security models to hook credential
related operations (init, fork, copy, free -- hooked in kauth_cred_alloc(),
kauth_proc_fork(), kauth_cred_clone(), and kauth_cred_free(), respectively)
and document it.

Add specificdata to credentials, and routines to register/deregister new
"keys", as well as set/get routines. This allows security models to add
their own private data to a kauth_cred_t.

The above two, combined, allow security models to control inheritance of
their own private data in credentials which is a requirement for doing
stuff like, I dunno, capabilities?
2007-01-31 10:08:23 +00:00
elad 8b125f4fa5 PR/35524: Brian de Alwis: panic from free in pathname_get
Patch applied, thanks for the report!
2007-01-31 08:29:20 +00:00
hannken 4d607243ba Change fstrans enum types to upper case.
No functional change.

From Antti Kantee <pooka@netbsd.org>
2007-01-29 15:42:50 +00:00
elad 87352b7746 Add a comment to indicate the reason for kauth_init() and secmodel_start()
being where they are. Suggested by and okay christos@.
2007-01-27 22:54:58 +00:00
elad d7cf9c93bb Start the security model sooner.
As with previous commit, we want to allow the secmodel code to control
the credential inheritance, etc., so we need it started earlier (also
before proc0_init()).
2007-01-27 01:13:10 +00:00
elad 3238d589b2 No need to include acct.h, sysctl.h, and time.h. 2007-01-26 23:50:36 +00:00
elad 4ee02bdcac Initialize kauth(9) sooner.
Since we'll soon want to be able to control the inheritance of credentials,
kauth(9) needs to be ready for use much sooner -- at least before the call
to proc0_init().
2007-01-26 21:57:47 +00:00
elad 4f9ade2efc Add missing specificdata_key_delete() in fileassoc_deregister(). 2007-01-26 12:36:46 +00:00
elad fe9f141d4d Fix tyop in comment: specifidata -> specificdata. 2007-01-25 13:58:40 +00:00
elad 73a4d95bb6 Update comment: device -> mount. No functional change. 2007-01-25 13:57:28 +00:00
elad 317687e988 Don't rely on KAUTH_PROCESS_CANSEE for environment just yet,
otherwise we're allowing anyone to read the environment unless
curtain is enabled.

From yamt@.
2007-01-22 15:11:52 +00:00
elad a78693aa19 Kill KAUTH_PROCESS_RESOURCE and just replace it with two actions for
nice and rlimit.
2007-01-20 16:47:38 +00:00
hannken 1b9c6382e3 New file system suspension API to replace vn_start_write and vn_finished_write.
The suspension helpers are now put into file system specific operations.
This means every file system not supporting these helpers cannot be suspended
and therefore snapshots are no longer possible.

Implemented for file systems of type ffs.

The new API is enabled on a kernel option NEWVNGATE.  This option is
not enabled by default in any kernel config.

Presented and discussed on tech-kern with much input from
Bill Studenmund <wrstuden@netbsd.org> and YAMAMOTO Takashi <yamt@netbsd.org>.

Welcome to 4.99.9 (new vfs op vfs_suspendctl).
2007-01-19 14:49:08 +00:00
elad 39714ce48b Oops - this should have gone in a long time ago.
Weak alias secmodel_start to a nop routine, for building without a secmodel
in the kernel.
2007-01-17 12:27:24 +00:00
elad 096a7f4744 Use KAUTH_ARG(). 2007-01-17 12:21:34 +00:00
dogcow 8f871f1a8d #include <sys/sa.h> to get sys_upcall_t def. 2007-01-16 20:12:40 +00:00
elad f3cc348dad Introduce secmodel_register() and secmodel_deregister() (for now left
undocumented) and change logic in kauth_authorize_action() to only
allow an action if it wasn't explicitly allowed/denied and there are no
secmodels loaded.

Okay yamt@.
2007-01-16 11:51:22 +00:00
ad d71c91cb2c Regen. 2007-01-16 05:29:54 +00:00
ad 606e323b3e Add sched_yield(). 2007-01-16 05:28:45 +00:00
ad 2ec3e26f21 Regen. 2007-01-16 01:32:52 +00:00
ad b9b02583e6 Add prototypes for: _lwp_kill, _lwp_detach, _lwp_park, _lwp_unpark,
_lwp_unpark_all, sched_yield.
2007-01-16 01:30:45 +00:00
pooka 88f603fea0 TAILQ_INIT a mountpoint's vnode queue and always add vnodes to the
tail instead of an explicit check to add to the head for an empty
queue.  Apparently TAILQ_INSERT_HEAD happens to work for a
non-initialized head and does implicit initialization so that
TAILQ_INSERT_TAIL works after that.
2007-01-15 19:13:30 +00:00
elad 6df6f0ea65 Introduce kauth_proc_fork() to control credential inheritance. 2007-01-15 17:45:32 +00:00
elad 8ed50e44ae veriexec_file_delete() and veriexec_table_delete() now take 'struct lwp *'
too.
2007-01-11 16:24:47 +00:00
elad 4cc18ba6e8 Make 'veriexec_verbose' static. 2007-01-11 15:10:25 +00:00