Commit Graph

7493 Commits

Author SHA1 Message Date
pooka
72a4517ea3 regen: rump syscalls for kern_prot interfaces 2010-08-30 10:34:51 +00:00
pooka
16e1cb0b60 RUMP syscalls for kern_prot.c interfaces 2010-08-30 10:32:54 +00:00
pooka
195f9ac9fd remove trailing empty line. no useful change. 2010-08-30 10:30:01 +00:00
pooka
9a611a11e0 Empty commit to show makesyscalls.sh rev 1.99 didn't change anything (yet). 2010-08-30 10:24:42 +00:00
pooka
5c6beee9f6 Use the generally more useful funcalias for rump syscalls. 2010-08-30 10:24:04 +00:00
pooka
aeb7e802ec I'm not even going to describe this change. I'll just say that
churn creates interesting code.

Fixes open(O_CREAT|O_TRUNC) on at least tmpfs and nfs to not fail
with ENOENT due to a racy removal of the newly created file.

Caught, as most bugs these days are, by a test run.
2010-08-25 13:51:50 +00:00
christos
6a6858c912 Fix issues with stack allocation and pax aslr:
- since the size is unsigned, don't check just that it is > 0, but limit
  it to the MAXSSIZ
- if the stack size is reduced because of aslr, make sure we reduce the
  actual allocation by the same size so that the size does not wrap around.
NB: Must be pulled up to 5.x!
2010-08-23 20:53:08 +00:00
pgoyette
23d5409e7e Update the rest of the kernel to conform to the module subsystem's new
locking protocol.
2010-08-21 13:19:39 +00:00
pgoyette
4a743ad47d Define a set of new kernel locking primitives to implement the recursive
kernconfig_mutex.  Update module subsystem to use this mutex rather than
its own internal (non-recursive) mutex.  Make module_autoload() do its
own locking to be consistent with the rest of the module_xxx() calls.
Update module(9) man page appropriately.

As discussed on tech-kern over the last few weeks.

Welcome to NetBSD 5.99.39 !
2010-08-21 13:17:31 +00:00
joerg
e84862bd9b Allow ELF objects with more than two PT_LOAD sections. Go creates such
binaries by default with separate sections for executable, writeable
data and constants. Use the same heuristic as FreeBSD to match up the
text and data segment assumptions.
2010-08-20 14:59:53 +00:00
hannken
863afee91a Now that ffs on disk inodes get freed in the reclaim routine it is no longer
necessary for vget() to handle VI_INACTNOW as a special case.  Remove this
check and its support in vrelel().

Getting another reference while the freelist is locked is an error.  Replace
the check with a KASSERT.
2010-08-17 13:17:47 +00:00
jruoho
795224299a From jmcneill@: call config_deferred(9) in rescan_with_cfdata(). 2010-08-16 17:29:52 +00:00
pgoyette
bf43b300a1 Keep condvar wmesg within 8 char limit 2010-08-11 12:04:49 +00:00
pgoyette
8be3483a20 Keep condvar wmesg within 8-char limit 2010-08-11 11:46:32 +00:00
jruoho
72795172e5 Like with mqueue(3), create and remove the aio(3) sysctl nodes dynamically. 2010-08-06 18:36:09 +00:00
pooka
5777f63fd9 Remove overzealous KASSERT: the refcount can be non-zero if another
thread attempts to use a non-open file descriptor.  from ad

fixes PR kern/43694
2010-08-04 14:25:16 +00:00
hannken
c84e81cad1 Add vm page flag PG_MARKER and use it to tag dummy marker pages
in genfs_do_putpages() and uao_put().
Use 'v_uobj.uo_npages' to check for an empty memq.
Put some assertions where these marker pages may not appear.

Ok: YAMAMOTO Takashi <yamt@netbsd.org>
2010-07-29 10:54:50 +00:00
jruoho
c28dcae1e0 Get rid of SYSCTL_SETUP.
We want the sysctl variables also when mqueue(3) is loaded as a module.
2010-07-28 20:49:12 +00:00
hannken
3a7edffde9 ext2fs,ffs: free on disk inodes in the reclaim routine.
Remove now unneeded vnode flag VI_FREEING.

Welcome to 5.99.38.

Ok: Andrew Doran <ad@netbsd.org>
2010-07-28 11:03:47 +00:00
hannken
2ac44efee2 Modify vn_lock():
- Take v_interlock before examining v_iflag
- Must always be called without v_interlock taken,
  LK_INTERLOCK flag is no longer allowed.
2010-07-28 09:30:21 +00:00
jakllsch
359dcd7f55 Use 'z' printf format modifier to print size_t in debug code. 2010-07-27 14:25:23 +00:00
hannken
87506b0c16 When both vget() and vrelel() call vn_lock() we know VI_XLOCK is clear.
No need to use LK_INTERLOCK or LK_RETRY here.
The return value of vn_lock() is already examined here.

Ok: Antti Kantee <pooka@netbsd.org>
2010-07-26 15:22:16 +00:00
hannken
1968478248 Add an assertion: it makes no sense to call vget() with LK_RETRY. 2010-07-25 10:23:40 +00:00
hannken
fb62bef947 Make holding v_interlock mandatory for callers of vget().
Announced some time ago on tech-kern.
2010-07-21 17:52:09 +00:00
hannken
1664eae7f3 Using vfinddev() leads to vnode races as it returns an unreferenced
vnode that may disappear before the caller has a chance to reference it.

Reference the vnode while the specfs cache is locked.

Welcome to 5.99.37.

No objections on tech-kern.
2010-07-21 09:06:37 +00:00
hannken
e698a5d246 Using cache_revlookup() leads to vnode races as it returns an unreferenced
vnode that may disappear before the caller has a chance to reference it.

Reference the vnode while the name cache is locked.

No objections on tech-kern.
2010-07-21 09:01:35 +00:00
pooka
7f9f73897e Include <rump/rump_syscalls_compat.h> from rump_syscalls.h. This
file will contain compat defs which are not autogenerated.
2010-07-19 15:25:47 +00:00
pooka
c99c5d9840 Don't leak kernel stack into userspace. 2010-07-13 15:38:15 +00:00
rmind
25ce398524 sel_setevents: fix error - match event-set, as intended.
Spotted by Enami Tsugutomo.
2010-07-12 11:04:25 +00:00
rmind
6269e5af55 Disable direct select for now, since it still brings problems. 2010-07-11 11:17:58 +00:00
rmind
2903a8dcf1 sel_setevents: fix direct injecting of fd bit for select() case. 2010-07-10 17:04:25 +00:00
rmind
21b26eb64e sel_do_scan: do not bother to assert for SEL_SCANNING state before blocking,
as it might also be SEL_BLOCKING due to spurious wake-ups.  That has no harm.
2010-07-08 23:15:23 +00:00
rmind
ce9dfd6a44 Implement direct select/poll support, currently effective for socket and
pipe subsystems.  Avoids overhead of second selscan() on wake-up, and thus
improves performance on certain workloads (especially when polling on many
file-descriptors).  Also, clean-up sys/fd_set.h header and improve macros.

Welcome to 5.99.36!
2010-07-08 12:23:31 +00:00
chs
33fa5ccbbf many changes for COMPAT_LINUX:
- update the linux syscall table for each platform.
 - support new-style (NPTL) linux pthreads on all platforms.
   clone() with CLONE_THREAD uses 1 process with many LWPs
   instead of separate processes.
 - move the contents of sys__lwp_setprivate() into a new
   lwp_setprivate() and use that everywhere.
 - update linux_release[] and linux32_release[] to "2.6.18".
 - adjust placement of emul fork/exec/exit hooks as needed
   and adjust other emul code to match.
 - convert all struct emul definitions to use named initializers.
 - change the pid allocator to allow multiple pids to refer to the same proc.
 - remove a few fields from struct proc that are no longer needed.
 - disable the non-functional "vdso" code in linux32/amd64,
   glibc works fine without it.
 - fix a race in the futex code where we could miss a wakeup after
   a requeue operation.
 - redo futex locking to be a little more efficient.
2010-07-07 01:30:32 +00:00
hannken
245651a23d Remove vlockmgr(). Generic vnode lock operations now use a rwlock located
in the vnode.  All LK_* flags move from sys/lock.h to sys/vnode.h.  Calls
to vlockmgr() in file systems get replaced with VOP_LOCK() or VOP_UNLOCK().

Welcome to 5.99.34.

Discussed on tech-kern.
2010-07-01 13:00:54 +00:00
rmind
3c507045e2 Remove pfind() and pgfind(), fix locking in various broken uses of these.
Rename real routines to proc_find() and pgrp_find(), remove PFIND_* flags
and have consistent behaviour.  Provide proc_find_raw() for special cases.
Fix memory leak in sysctl_proc_corename().

COMPAT_LINUX: rework ptrace() locking, minimise differences between
different versions per-arch.

Note: while this change adds some formal cosmetics for COMPAT_DARWIN and
COMPAT_IRIX - locking there is utterly broken (for ages).

Fixes PR/43176.
2010-07-01 02:38:26 +00:00
pooka
6376b2136c Enable kernel-internal symlink creation with do_sys_symlink().
I did this a while ago already, but can't remember why i didn't
commit it then.
2010-06-30 15:44:54 +00:00
pgoyette
224f73d8d9 1. Add an allocator for 'struct module *' and use it instead of local
allocations.

2. Add a new member mod_flags to the 'struct module *' and define
   MODFLG_MUST_FORCE.  If this flag is set and the entry is on the list
   of builtins, it means that the module has been explicitly unloaded
   and any re-loads will require the MODCTL_LOAD_FORCE flag. Provide a
   module_require_force() method to set this flag;  once set, it should
   never be unset.

3. Rename original module_init2() to module_start_unload_thread() to be
   more descriptive of what it does.

4. Add a new module_builtin_require_force() routine that sets the
   MODFLG_MUST_FORCE flag for any module that has not yet successfully
   been initialized.  Call it after module_init_class(MODULE_CLASS_ANY)
   to disable remaining built-in modules.

This makes built-in versions of the xxxVERBOSE modules work once more,
resolving breakage reported by jruoho@ and njoly@.

Discussed on tech-kern, and comments and suggestions implemented.  No
additional discussion for last week.  Tested only on amd64 systems, but
there's nothing here that should be port- or architecture-specific (no
more specific than existing module implementation) so others should not
break.
2010-06-26 07:23:57 +00:00
tsutsui
7b11ac5304 Rather than referring a global variable rootvnode in autoconf(9),
prepare and use an internal "root_is_mounted" flag for config_mountroot(9).

Should fix annoying dependency problem in librump reported by Paul Goyette
on current-users@:
http://mail-index.NetBSD.org/current-users/2010/06/25/msg013771.html
2010-06-26 06:43:13 +00:00
tsutsui
9aa0a261b5 Add config_mountroot(9), which defers device configuration
after mountroot(), like config_interrupt(9) that defers
configuration after interrupts are enabled.
This will be used for devices that require firmware loaded
from the root file system by firmload(9) to complete device
initialization (getting MAC address etc).

No objection on tech-kern@:
http://mail-index.NetBSD.org/tech-kern/2010/06/18/msg008370.html
and will also fix PR kern/43125.
2010-06-25 15:10:42 +00:00
hannken
1423e65b26 Clean up vnode lock operations pass 2:
VOP_UNLOCK(vp, flags) -> VOP_UNLOCK(vp): Remove the unneeded flags argument.

Welcome to 5.99.32.

Discussed on tech-kern.
2010-06-24 12:58:48 +00:00
hannken
f6c438ba23 Clean up vnode lock operations:
- VOP_LOCK(vp, flags): Limit the set of allowed flags to LK_EXCLUSIVE,
   LK_SHARED and LK_NOWAIT.  LK_INTERLOCK is no longer allowed as it
   makes no sense here.

- VOP_ISLOCKED(vp): Remove the for some time unused return value
  LK_EXCLOTHER.  Mark this operation as "diagnostic only".
  Making a lock decision based on this operation is no longer allowed.

Discussed on tech-kern.
2010-06-24 07:54:46 +00:00
rmind
1840edb963 Implement high priority (XC_HIGHPRI) xcall(9) mechanism - a facility
to execute functions from software interrupt context, at SOFTINT_CLOCK.
Functions must be lightweight.  Will be used for passive serialization.

OK ad@.
2010-06-22 18:29:01 +00:00
hannken
2c090918c7 Remove the concept of recursive vnode locks by eliminating
vn_setrecurse(), vn_restorerecurse() and LK_CANRECURSE.
Welcome to 5.99.31

Discussed on tech-kern.
2010-06-18 16:29:01 +00:00
pooka
5b19556a02 Set kinfo_lwp to 0 before filling it so that if someone removes
variable assignments from here, kernel memory does not leak to
userspace.

Bug found, a little bit suprisingly, by the atf ps test which failed
due to the column width between the -o holdcnt column being too
wide due to the contents displayed being garbage.
2010-06-16 18:49:22 +00:00
hannken
9ddf309cbe When mounting a file system re-lookup and lock the directory we mount on
after the file system is setup by VFS_MOUNT().  This way recursive vnode
locks are no longer needed here and mounts on null mounts no longer fail
as described in PR #43439 (mount_null panic: lockdebug_wantlock: locking
against myself).

Based on a proposal from  and
Reviewed by: David A. Holland <dholland@netbsd.org>
2010-06-15 09:43:36 +00:00
simonb
599c2850cf KNF nit. 2010-06-13 13:43:02 +00:00
yamt
d512e902b3 aio_enqueue_job: don't bother to check curjob.
- it's an undefined behaviour anyway.
- the check sometimes prevent legal reuse of userland aiocb.
  note that the userland can notice the i/o completion and reuse the aiocb
  before the aio_worker kernel thread clears curjob.
2010-06-13 04:45:50 +00:00
yamt
d5dec378f9 increment p_nrlwps in lwp_create rather than letting callers do so
as it's always decremented by lwp_exit.  this fixes error recovery of
eg. aio_procinit.
2010-06-13 04:13:31 +00:00
yamt
ef7d7e9667 update a comment. 2010-06-13 03:34:19 +00:00