Commit Graph

7148 Commits

Author SHA1 Message Date
elad 7f720ad562 KAUTH_GENERIC_CANSEE -> KAUTH_REQ_NETWORK_SOCKET_CANSEE.
Not quite the same semantics but it's okay. Once our sockets have
credentials (and they will) it's all the same.
2009-10-03 20:24:39 +00:00
elad 5b3a96a24d Move KAUTH_NETWORK_BIND::KAUTH_REQ_NETWORK_BIND_PORT policy back to the
subsystem (or close to it).

Note: Revisit KAUTH_REQ_NETWORK_BIND_PRIVPORT.
2009-10-03 03:59:39 +00:00
elad 82ce55ed44 Move policies for KAUTH_PROCESS_{CANSEE,CORENAME,STOPFLAG,FORK} back to
the subsystem.

Note: Consider killing the signal listener and sticking
      KAUTH_PROCESS_SIGNAL here as well.
2009-10-03 03:38:31 +00:00
elad 111de3833c Finish moving socket policy to the subsystem. 2009-10-03 01:41:39 +00:00
elad 452ced03bd Move sched policy back to the subsystem. 2009-10-03 01:30:25 +00:00
elad 212f5fa214 Move kevent policy back to the subsystem. 2009-10-03 00:14:07 +00:00
elad abc7a4290b Put module loading policy back in the subsystem.
Revisit: consider moving kauth_init() above module_init() in main().
2009-10-03 00:06:37 +00:00
elad 1f98cab201 Put the tty opening policy back in the subsystem.
Remove include we don't need from the secmodel code.
2009-10-02 23:58:53 +00:00
elad 510083464f Move some of the socket policy back to the subsystem.
Remove include we don't need in the secmodel code.
2009-10-02 23:50:16 +00:00
elad 8751f894d8 Put signal delivery policy back in the subsystem. 2009-10-02 23:24:15 +00:00
elad 09f3ac9e2f Stick nice policy in its own subsystem and call the listener "resource"
rather than "rlimit"...
2009-10-02 22:46:18 +00:00
elad bcc5014bd0 Move rlimit policy back to the subsystem.
For this we needed proc_uidmatch() exposed, which makes a lot of sense,
so put it back in sys_process.c for use in other places as well.
2009-10-02 22:38:45 +00:00
elad 2ae3a70827 Move ptrace's security policy back to the subsystem itself.
Add a ptrace_init() so we have a place to register the listener; called
next to ktrinit().
2009-10-02 22:18:56 +00:00
elad 40cc528a28 Move psets security policy back to the subsystem and keep suser logic only
in the suser secmodel code.
2009-10-02 21:56:28 +00:00
elad 932cd15f91 Move ktrace's subsystem security policy to the subsystem itself, and keep
just the suser-related logic in the suser secmodel.
2009-10-02 21:47:35 +00:00
elad 53ca19a3b3 First part of secmodel cleanup and other misc. changes:
- Separate the suser part of the bsd44 secmodel into its own secmodel
    and directory, pending even more cleanups. For revision history
    purposes, the original location of the files was

        src/sys/secmodel/bsd44/secmodel_bsd44_suser.c
        src/sys/secmodel/bsd44/suser.h

  - Add a man-page for secmodel_suser(9) and update the one for
    secmodel_bsd44(9).

  - Add a "secmodel" module class and use it. Userland program and
    documentation updated.

  - Manage secmodel count (nsecmodels) through the module framework.
    This eliminates the need for secmodel_{,de}register() calls in
    secmodel code.

  - Prepare for secmodel modularization by adding relevant module bits.
    The secmodels don't allow auto unload. The bsd44 secmodel depends
    on the suser and securelevel secmodels. The overlay secmodel depends
    on the bsd44 secmodel. As the module class is only cosmetic, and to
    prevent ambiguity, the bsd44 and overlay secmodels are prefixed with
    "secmodel_".

  - Adapt the overlay secmodel to recent changes (mainly vnode scope).

  - Stop using link-sets for the sysctl node(s) creation.

  - Keep sysctl variables under nodes of their relevant secmodels. In
    other words, don't create duplicates for the suser/securelevel
    secmodels under the bsd44 secmodel, as the latter is merely used
    for "grouping".

  - For the suser and securelevel secmodels, "advertise presence" in
    relevant sysctl nodes (sysctl.security.models.{suser,securelevel}).

  - Get rid of the LKM preprocessor stuff.

  - As secmodels are now modules, there's no need for an explicit call
    to secmodel_start(); it's handled by the module framework. That
    said, the module framework was adjusted to properly load secmodels
    early during system startup.

  - Adapt rump to changes: Instead of using empty stubs for securelevel,
    simply use the suser secmodel. Also replace secmodel_start() with a
    call to secmodel_suser_start().

  - 5.99.20.

Testing was done on i386 ("release" build). Spearated module_init()
changes were tested on sparc and sparc64 as well by martin@ (thanks!).

Mailing list reference:

	http://mail-index.netbsd.org/tech-kern/2009/09/25/msg006135.html
2009-10-02 18:50:12 +00:00
pooka 68f37adaa6 Give humanize_number & format_bytes their own spots in the sun and move
from kern_subr to subr_humanize.
2009-10-02 15:48:41 +00:00
pooka bea18fb702 Add dealloccnt to list of things to be considered in the stetson-harrison
decision making algorithm for flushing a wapbl transation.
2009-10-01 12:28:34 +00:00
pooka 5b19885537 Turn a KASSERT into a panic. I don't want us to be randomly
overwriting memory on non-DIAGNOSTIC kernels if resource estimation
fails.
2009-10-01 07:42:45 +00:00
dyoung e533051d0f #include "drvctl.h" for the NDRVCTL definition. Without the NDRVCTL
definition, drvctl_init() is not called, the drvctl_eventq is not
initialized, and the kernel will panic in devmon_insert() when a
device is detached.

Thanks to Jared McNeill for pointing out the panic.
2009-09-29 22:40:15 +00:00
pooka 8de13bd4c6 regen: remove VNODE_LOCKDEBUG 2009-09-29 11:54:52 +00:00
pooka ab3237b942 Add a switch on whether to create VNODE_LOCKDEBUG checks or not.
Since VNODE_LOCKDEBUG has never been generally useful, default to
off.  However, the checks can still be generated by flipping the
switch for the isolated cases where this form of dynamic analysis
is useful and the person using it knows what she is doing.
2009-09-29 11:51:02 +00:00
dholland 8d36057243 Move a big wodge of symlink-following code from nfsd to inside
lookup_for_nfsd(). This code is, or at least should be, the same as
the regular symlink-following code plus an extra flag nfsd needs.

The two lots of code can/will be merged in the future.
2009-09-27 17:23:53 +00:00
dholland fb458255a3 Rename lookup() to lookup_for_nfsd(), to make it clear just whose
private backdoor entry point this is.

Also, clone the lookup_for_nfsd() entry point as
lookup_for_nfsd_index(), for use by a different call site in nfsd that
does different unclean things with nameidata.
2009-09-27 17:19:07 +00:00
dyoung 7e8a3f8dc1 Replace 'struct device *' with 'device_t', throughout. No functional
change intended.
2009-09-25 19:21:09 +00:00
yamt d571330722 cwdinit: whitespace fix. no functional changes. 2009-09-24 06:14:22 +00:00
pooka 9b040bc3a9 Split config_init() into config_init() and config_init_mi() to help
platforms which want to call config_init() very early in the boot.
2009-09-21 12:14:46 +00:00
jmcneill ae17b8bef2 If vfs_mountroot fails, print a list of supported file systems. If no
file systems are supported by the kernel, print a big fat warning instead.
2009-09-19 16:20:41 +00:00
pooka 26e4989d18 Provide unwind log for bufq sysctls, since (theoretically) bufq might
not be initialized during kernel bootstrap and therefore "permanent"
nodes can be created only with an unwind log.
2009-09-17 09:54:27 +00:00
pooka 8a9910b608 Can't use CTLFLAG_PERMANENT here without providing a rollback log,
since accept filters aren't (necessarily) added during kernel boot
phase.

pointed out & tested by Geoff Wing
2009-09-17 08:09:49 +00:00
dyoung 8497597988 Nothing calls config_activate(9) any longer, so delete it. 2009-09-16 22:45:23 +00:00
dyoung 36fffd8d02 In pmf(9), improve the implementation of device self-suspension
and make suspension by self, by drvctl(8), and by ACPI system sleep
play nice together.  Start solidifying some temporary API changes.

1. Extract a new header file, <sys/device_if.h>, from <sys/device.h> and
   #include it from <sys/pmf.h> instead of <sys/device.h> to break the
   circular dependency between <sys/device.h> and <sys/pmf.h>.

2. Introduce pmf_qual_t, an aggregate of qualifications on a PMF
   suspend/resume call.  Start to replace instances of PMF_FN_PROTO,
   PMF_FN_ARGS, et cetera, with a pmf_qual_t.

3. Introduce the notion of a "suspensor," an entity that holds a
   device in suspension.  More than one suspensor may hold a device
   at once.  A device stays suspended as long as at least one
   suspensor holds it.  A device resumes when the last suspensor
   releases it.

   Currently, the kernel defines three suspensors,

   3a the system-suspensor: for system suspension, initiated
      by 'sysctl -w machdep.sleep_state=3', by lid closure, by
      power-button press, et cetera,

   3b the drvctl-suspensor: for device suspension by /dev/drvctl
      ioctl, e.g., drvctl -S sip0.

   3c the system self-suspensor: for device drivers that suspend
      themselves and their children.  Several drivers for network
      interfaces put the network device to sleep while it is not
      administratively up, that is, after the kernel calls if_stop(,
      1).  The self-suspensor should not be used directly.  See
      the description of suspensor delegates, below.

   A suspensor can have one or more "delegates".  A suspensor can
   release devices that its delegates hold suspended.  Right now,
   only the system self-suspensor has delegates.  For each device
   that a self-suspending driver attaches, it creates the device's
   self-suspensor, a delegate of the system self-suspensor.

   Suspensors stop a system-wide suspend/resume cycle from waking
   devices that the operator put to sleep with drvctl before the cycle.
   They also help self-suspension to work more simply, safely, and in
   accord with expectations.

4. Add the notion of device activation level, devact_level_t,
   and a routine for checking the current activation level,
   device_activation().  Current activation levels are DEVACT_LEVEL_BUS,
   DEVACT_LEVEL_DRIVER, and DEVACT_LEVEL_CLASS, which respectively
   indicate that the device's bus is active, that the bus and device are
   active, and that the bus, device, and the functions of the device's
   class (network, audio) are active.

   Suspend/resume calls can be qualified with a devact_level_t.
   The power-management framework treats a devact_level_t that
   qualifies a device suspension as the device's current activation
   level; it only runs hooks to reduce the activation level from
   the presumed current level to the fully suspended state.  The
   framework treats a devact_level_t qualifying device resumption
   as the target activation level; it only runs hooks to raise the
   activation level to the target.

5. Use pmf_qual_t, devact_level_t, and self-suspensors in several
   drivers.

6. Temporarily add an unused power-management workqueue that I will
   remove or replace, soon.
2009-09-16 16:34:49 +00:00
pooka 11281f01a0 Replace a large number of link set based sysctl node creations with
calls from subsystem constructors.  Benefits both future kernel
modules and rump.

no change to sysctl nodes on i386/MONOLITHIC & build tested i386/ALL
2009-09-16 15:23:04 +00:00
pooka 41c00db98c Chop init_sysctl into base nodes (init_sysctl_base.c) and the
kitchen sink (init_sysctl.c).  Further surgery may be needed down
the line.
2009-09-16 15:03:56 +00:00
pooka fbd53556dc Wipe out the last vestiges of POOL_INIT with one swift stroke. In
most cases, use a proper constructor.  For proplib, give a local
equivalent of POOL_INIT for the kernel object implementation.  This
way the code structure can be preserved, and a local link set is
not hazardous anyway (unless proplib is split to several modules,
but that'll be the day).

tested by booting a kernel in qemu and compile-testing i386/ALL
2009-09-13 18:45:10 +00:00
bouyer b21564d63d PR kern/41923: assertion "cur != owner" failed
In the for(;;) loop of turnstile_block(), the lock owner can change while
cur's lock is released (cur's lock is also the tschain_t's mutex).
Remove the KASSERT about owner being invariant and try to deal with the
fact that the owner can change instead.
http://mail-index.netbsd.org/tech-kern/2009/08/24/msg005957.html
and followups.
2009-09-13 14:38:20 +00:00
dyoung c5d5f7697a Make ifconfig(8) set and display preference numbers for IPv6
addresses.  Make the kernel support SIOC[SG]IFADDRPREF for IPv6
interface addresses.

In in6ifa_ifpforlinklocal(), consult preference numbers before
making an otherwise arbitrary choice of in6_ifaddr.  Otherwise,
preference numbers are *not* consulted by the kernel, but that will
be rather easy for somebody with a little bit of free time to fix.

Please note that setting the preference number for a link-local
IPv6 address does not work right, yet, but that ought to be fixed
soon.

In support of the changes above,

1 Add a method to struct domain for "externalizing" a sockaddr, and
  provide an implementation for IPv6.  Expect more work in this area: it
  may be more proper to say that the IPv6 implementation "internalizes"
  a sockaddr.  Add sockaddr_externalize().

2 Add a subroutine, sofamily(), that returns a struct socket's address
  family or AF_UNSPEC.

3 Make a lot of IPv4-specific code generic, and move it from
  sys/netinet/ to sys/net/ for re-use by IPv6 parts of the kernel and
  ifconfig(8).
2009-09-11 22:06:29 +00:00
apb 7ab65de0a9 Expose the kernel's boothowto(9) variable through the sysctl
kern.boothowto variable.

Part of the /etc/rc silent changes requested in PR 41946
and proposed in tech-userlevel.
2009-09-11 18:14:58 +00:00
dyoung 3d4351e682 Delete whitespace at ends of lines. 2009-09-08 18:01:34 +00:00
pooka f926eb58c3 Remove autoconf dependency on vfs and dk:
opendisk() -> kern/subr_disk_open.c
config_handle_wedges -> dev/dkwedge/dk.c
2009-09-06 16:18:55 +00:00
pooka 5e46a7c29a Move configure() and configure2() from subr_autoconf.c to init_main.c,
since they are only peripherially related to the autoconf subsystem
and more related to boot initialization.  Also, apply _KERNEL_OPT
to autoconf where necessary.
2009-09-03 15:20:08 +00:00
jmcneill 56614eff97 In bdev_strategy, return ENXIO instead of panicing if the block device has
disappeared. ok pooka@
2009-09-03 11:42:21 +00:00
elad a162140107 Implement the vnode scope and adapt tmpfs to use it.
Mailing list reference:

	http://mail-index.netbsd.org/tech-kern/2009/07/04/msg005404.html
2009-09-03 04:45:27 +00:00
tls fd671f648a Add a direction argument to socket upcalls, so they can tell why they've
been called when, for example, they're waiting for space to write.  From
Ritesh Agrawal at Coyote Point.
2009-09-02 14:56:57 +00:00
pooka 5523d7f5c9 Initialize devsw (lock) early so that subsystems may play with it. 2009-09-02 08:07:05 +00:00
rmind e24f6c0896 Turn off pipe's direct I/O again, it corrupts the data (although build and
various activity survived while testing this).  Corruptions also happen on
sparc64 where emap is not in effect, therefore bugs are in direct I/O code.
2009-08-31 20:48:14 +00:00
rmind 3a8481feb4 Make pool_head static. 2009-08-29 00:09:02 +00:00
rmind 924c9047ea - Re-enable direct I/O with emap for pipe.
- While not used, #ifdef KVA allocation in emap (so it wont burn the space).
2009-08-29 00:06:43 +00:00
bouyer 389f5178ad In uipc_usrreq(PRU_ACCEPT), grab the unp_streamlock before unp_setpeerlocks().
This fixes a race where, for a short period of time, so->so_lock and
so2->so_lock are not sync. This makes solocked2() and solocked()
unreliable and cause DIAGNOSTIC kernel panics. This also fixes a possible
panic in unp_setaddr() which expects the socket locked.
Should fix kern/38968, fix proposed in
http://mail-index.netbsd.org/tech-kern/2009/08/17/msg005863.html
2009-08-26 22:34:47 +00:00
dyoung 2d89489416 In sysctl_create(), the first character of sysctl_name is
sysctl_name[0], so write that instead of sysctl_name[sz] (where sz
just happened to be set to 0 in the previous line).

Also in sysctl_create(), give the length of the sysctl_name its
own variable, nsz, and reserve sz for expressing the size of the
node's value.

No functional change intended.
2009-08-24 20:53:00 +00:00
manu dd47ec7336 Back out previous change: do not skip the test on rootspec, but make it
a simple attempt instead of an authoritative answer. The failure of the
rootspec test could me machine-dependant. Thanks to martin@ for pointing
that out.
2009-08-23 12:10:50 +00:00
dyoung 210a227e29 In sysctl_realloc(), don't make 'i' act as both an child-array
iterator and the length of the old child array, but introduce a
new variable, 'olen', for the latter purpose.

In sysctl_alloc(), name a constant.

Introduce sysctl_log_print(), a handy debug routine.

No functional changes intended.
2009-08-21 22:51:00 +00:00
dyoung 5a3627a2a6 Make sure that a sysctlnode's child nodes, even nodes that are not
yet in service, have a correct pointer to their parent, sysctl_parent.
This fixes a bug where sysctl_teardown(9) could not clean up a
network interface's sysctl(9) trees when I detached it, because
the wrong log had been recorded.
2009-08-21 22:43:32 +00:00
manu 61a1c8cdd1 When netbooting, rootspec is now "md0a", and it has no chance to match
an interface name, so do not give it a try.
2009-08-21 09:20:47 +00:00
yamt f97310f398 whitespace fixes. no functional changes. 2009-08-18 02:43:49 +00:00
christos a9d1bfd0c5 provide compatibility for the older variant of kern.consdev, which used
a 32 bit dev_t. Reported by mrg.
2009-08-16 20:28:19 +00:00
yamt 273f17a18a kauth_cred_free: add an assertion. 2009-08-16 11:01:12 +00:00
yamt 77d977dcbc assertion 2009-08-16 11:00:20 +00:00
yamt d59302b0e4 struct lwp -> lwp_t for consistency 2009-08-16 10:59:25 +00:00
haad 5f6671a94a Allow undescribed, direct ioctls as used by Unix. This capability was removed in BSD, presumably because nothing used it any more.
Third party system software written for Unix (like ZFS) requires this to work without significant modifications.

Ok supremeleader@
2009-08-13 08:57:43 +00:00
haad 5200b9b492 Add enum uio_seg argument to do_sys_mknod and do_sys_mkdir so these functions
can be called from kernel, too.

Change needed for zfs device node creation, until we have propoer devfs.

Oked by ad@.
2009-08-09 22:49:00 +00:00
dholland f821ac304a Begin splitting lookup() into more tractable pieces too. 2009-08-09 07:27:54 +00:00
dholland 40c09fbf2c Begin splitting up namei into smaller pieces. 2009-08-09 03:28:35 +00:00
dsl 3d8c11d579 ktrace the arguments to script interpreters that come from the script.
Fixes PR/33021
2009-08-06 21:33:54 +00:00
dsl 8b926bc93c Fix ktrace of data from iovec based system calls.
Fixes PR/41819
2009-08-05 19:53:42 +00:00
dsl 8129ef72eb lockf() passes its arguments through to fcntl() but is supposed to
support -ve lengths (lock area before current offset).
Nothing in libc or the kernel allowed for this, so some random part
of the file would get locked (no idea which bits).
Although this could probably be fixed in libc, the stubs for posix file
locks for emulations could easily get into the kernel with -ve lengths.
So fixing in the kernel avoids those problems.
This also fixes PR/41620 (attempting to lock negative offsets) - which
is what I was looking into!
2009-08-05 19:39:50 +00:00
bad 0152c542e8 Add a note to change_root() that the callers need to authorize the operation.
As requested by elad@.
2009-08-02 20:44:55 +00:00
christos f1cd8c73cb Don't return EWOULDBLOCK on an O_NONBLOCK tty file descriptor that has vmin > 0
and vtime > 0. It should be allowed to go to sleep for the sleep interval
indicated in vtime. Reported by der Mouse a long while ago, and this is what
other unixes do.
2009-08-01 23:07:05 +00:00
bad 02bcf17298 As discussed on tech-kern:
Factor out common code of chroot-like syscalls into change_root() and export
that function for use in other parts of the kernel.
Rename change_dir() to chdir_lookup() as the latter describes better what
the function does.  While there, move the namei_data initialisation into
chdir_lookup(), too.  And export chdir_lookup().
2009-08-01 21:17:11 +00:00
mbalmer 9d8b69b23a Do not attach gpiosim(4) at root, but make it a pseudo device.
With help from Matthias Drochner, thanks!
2009-07-27 17:40:57 +00:00
mbalmer 953ebaaf3d Allow gpiosim(4) to attach if configured in the kernel configuration. 2009-07-25 16:23:39 +00:00
christos 47736ab62e check return code from soreserve() (Sean Boudreau) 2009-07-24 01:09:49 +00:00
pooka 39de73aae0 +fhopen, +fhstatvfs1 RUMP 2009-07-21 23:59:00 +00:00
yamt 0436400c70 set LP_RUNNING when starting lwp0 and idle lwps.
add assertions.
2009-07-19 10:11:55 +00:00
rmind db98cd9499 Regen. 2009-07-19 02:54:21 +00:00
rmind 7512d1e720 Make POSIX message queues a kernel module. 2009-07-19 02:50:44 +00:00
rmind b95f99b9f9 Fix previous, so that it actually works, correctly. 2009-07-19 02:26:49 +00:00
ad 5c5bb856e1 Don't send the quiet banner to the log, since the usual noise gets dumped
there anyway.
2009-07-17 23:31:51 +00:00
dyoung b734bafe0e Fix spelling: situatations -> situations. 2009-07-17 22:17:37 +00:00
dyoung b43b2d186c A definition in aic79xxvar.h somehow shadows pci_attach_args (ctags
bug?), so leave  it out of the tags computation for now.
2009-07-16 23:53:10 +00:00
rmind 569aa0de8b Revert previous: disable direct I/O on pipe, it cought a problem with emap. 2009-07-15 21:09:41 +00:00
apb dfcfba79d8 Convert free text inside #ifdef to a proper comment.
Inspired by PR 41255 from Kurt Lidl.
2009-07-14 20:59:00 +00:00
tsutsui 46133c54ef Add a workaround for some traditional ports (amiga and atari):
- Defer callout_setfunc() call after config_init() call in configure().

Fixes silent hang before consinit() at least on atari.

These traditional ports use config(9) structures and
autoconf(9) functions to detect console devices, and
config_init() is called at very early stage at boot
where mutex(9) is not ready.

Actually config_init() has been split out from configure()
for these ports:
http://cvsweb.NetBSD.org/bsdweb.cgi/src/sys/kern/subr_autoconf.c#rev1.74
while x68k has been fixed properly:
http://mail-index.NetBSD.org/source-changes/2009/01/17/msg215673.html

See also:
http://mail-index.NetBSD.org/port-x68k/2008/12/31/msg000006.html
http://mail-index.NetBSD.org/port-atari/2009/07/03/msg000419.html
2009-07-14 13:24:00 +00:00
rmind f80b636295 Re-enable direct I/O for pipe:
- Larger writes (2 or more pages) will use emap.
- Might help to catch rare hang (some very old bug).
2009-07-13 02:49:08 +00:00
rmind 7e069f82fb - Make insertion to message queue O(1) by using bitmap and array. However,
mq_prio_max is dynamic, and sorted list is used for custom setup, when
  user manually sets higher priority range.
- Cache mq->mq_attrib in some places.  Change msg_ptr type to uint8_t.
- Update copyright, misc.
2009-07-13 02:37:12 +00:00
rmind b83b94a98e mq_send/mq_receive: while permission may allow that, return EBADF if sending
to read-only queue, or receiving from write-only queue.

From Stathis Kamperis, thanks!
2009-07-13 00:41:08 +00:00
dyoung 2261ca8c07 In lwp_create(), take a reference to l2's filedesc_t instead of
taking a reference to curlwp's by calling fd_hold().  If lwp_create()
is called from fork1(), then l2 != curlwp, but l2's and not curlwp's
filedesc_t whose reference we should take.

This change stops the problem I describe in
<http://mail-index.netbsd.org/tech-kern/2009/07/09/msg005422.html>,
where /dev/rsd0a is never properly closed after fsck / runs on it.
This change seems to quiet my USB backup drive, sd0 at scsibus0 at
umass0, which had stopped spinning down when it was not in use:
The unit probably stayed open after mount(8) tried (and failed:
errant fstab entry) to mount it.

I am confident that this change is an improvement, but I doubt that
it is the last word on the matter.  I hate to get under the filedesc_t
abstraction by fiddling with fd_refcnt, and there may be something
I have missed, so somebody with greater understanding of the file
descriptors code should have a look.
2009-07-10 23:07:54 +00:00
dyoung bfd7452af9 pmf_event_inject(9) may be called from interrupt context, so we
must not allocate a pmf_event_workitem_t using kmem_alloc(9).  Use
pool_cache(9), instead, because it is safe in interrupt context.
Thanks, rmind@, for catching the problem and suggesting the solution.
2009-07-08 18:53:36 +00:00
joerg 73df1b22f7 Remove unused include. 2009-07-06 12:37:17 +00:00
elad 518bb3e503 Message queues also use genfs_can_access() to control access. Since the
latter might lose its KAUTH_GENERIC_ISSUSER check soon, add an internal
function, mqueue_access(), and call genfs_can_access() from it instead
so we don't pollute the main code path once we need to add a special
kauth(9) check for message queues.

No functional change, error codes preserved.

Related mailing list thread:

	http://mail-index.netbsd.org/tech-kern/2009/06/21/msg005311.html
2009-07-03 21:32:09 +00:00
pooka 1a0b832e88 expose mkdir to in-kernel consumers 2009-07-02 12:53:47 +00:00
martin 53822d1e78 Update fd_freefile when kqueue descriptors are not copied from
parent to child. From Wolfgang Solfrank in PR kern/41651.
Approved by Andrew Doran.
2009-06-30 20:32:49 +00:00
yamt 6d375e715d update a comment 2009-06-29 23:39:00 +00:00
dyoung c53d86bdf2 Fix a typo in last (coda/ exclusion). 2009-06-29 18:03:37 +00:00
dholland effcf1af5c Convert 67 namei call sites to use namei_simple, in these functions:
check_console, veriexecclose, veriexec_delete, veriexec_file_add,
emul_find_root, coff_load_shlib (sh3 version), coff_load_shlib,
compat_20_sys_statfs, compat_20_netbsd32_statfs,
ELFNAME2(netbsd32,probe_noteless), darwin_sys_statfs,
ibcs2_sys_statfs, ibcs2_sys_statvfs, linux_sys_uselib,
osf1_sys_statfs, sunos_sys_statfs, sunos32_sys_statfs,
ultrix_sys_statfs, do_sys_mount, fss_create_files (3 of 4),
adosfs_mount, cd9660_mount, coda_ioctl, coda_mount, ext2fs_mount,
ffs_mount, filecore_mount, hfs_mount, lfs_mount, msdosfs_mount,
ntfs_mount, sysvbfs_mount, udf_mount, union_mount, sys_chflags,
sys_lchflags, sys_chmod, sys_lchmod, sys_chown, sys_lchown,
sys___posix_chown, sys___posix_lchown, sys_link, do_sys_pstatvfs,
sys_quotactl, sys_revoke, sys_truncate, do_sys_utimes, sys_extattrctl,
sys_extattr_set_file, sys_extattr_set_link, sys_extattr_get_file,
sys_extattr_get_link, sys_extattr_delete_file,
sys_extattr_delete_link, sys_extattr_list_file, sys_extattr_list_link,
sys_setxattr, sys_lsetxattr, sys_getxattr, sys_lgetxattr,
sys_listxattr, sys_llistxattr, sys_removexattr, sys_lremovexattr

All have been scrutinized (several times, in fact) and compile-tested,
but not all have been explicitly tested in action.

XXX: While I haven't (intentionally) changed the use or nonuse of
XXX: TRYEMULROOT in any of these places, I'm not convinced all the
XXX: uses are correct; an audit might be desirable.
2009-06-29 05:08:15 +00:00
dholland acfecf55d7 Add namei_simple_kernel and namei_simple_user. These provide the common
case functionality of namei in a simple package with only a couple flags.

A substantial majority of the namei call sites in the kernel can use
this interface; this will isolate those areas from the changes arising
as the internals of namei are fumigated.
2009-06-29 05:00:14 +00:00
rmind fe55ad324c panic: use MI cpu_index(), instead of cpu_number(), which could be sparse. 2009-06-28 15:30:30 +00:00
rmind 5c68e5d0ee Ephemeral mapping (emap) implementation. Concept is based on the idea that
activity of other threads will perform the TLB flush for the processes using
emap as a side effect.  To track that, global and per-CPU generation numbers
are used.  This idea was suggested by Andrew Doran; various improvements to
it by me.  Notes:

- For now, zero-copy on pipe is not yet enabled.
- TCP socket code would likely need more work.
- Additional UVM loaning improvements are needed.

Proposed on <tech-kern>, silence there.
Quickly reviewed by <ad>.
2009-06-28 15:18:50 +00:00
rmind 7b7c187a92 Amend previous. 2009-06-28 14:34:48 +00:00
rmind 39b52425ff - Convert some #ifdefs to KASSERT()s.
- KNF, style, no parameters in function declarations.
- No functional changes.
2009-06-28 14:22:11 +00:00