Commit Graph

9266 Commits

Author SHA1 Message Date
pgoyette
ceb937987d Fix obvious typo - even though it is inside a #ifdef notyet ... #endif 2015-11-14 03:25:53 +00:00
hannken
fa45966e6d Take the vnode lock before the vnode is marked VI_CHANGING and fed
to vclean().  Prevents a deadlock with two null mounts on the same
physical mount where one thread tries to vclean() a layer node and
another thread tries to vget() a layer node pointing to the same
physical node.

Fixes PR kern/50375 layerfs (nullfs) locking problem leading to livelock
2015-11-12 11:35:42 +00:00
skrll
dea60533fa Drop to spl0 after the pmap_activate call. Should address
PR port-arm/50420: curcpu()->ci_pmap_cur != pm || pm->pm_pai[0].pai_asid == curcpu()->ci_pmap_asid_cur" failed

Discussed with matt@ and rmind@
2015-11-12 10:47:30 +00:00
pgoyette
06e9554d11 Mark kern.posix.semcnt as READONLY - we don't want users changing the
internal value!
2015-11-09 01:55:03 +00:00
pgoyette
7c02a5abd6 Whether or not the semaphore code is loaded as a module or built-in, its
sysctl data belongs with the module code.  Move it from kern/init_sysctl.c
to kern/uipc_sem.c

While here, add a new sysctl variable kern.posix.semcnt (current count of
semaphores) to complement the existing kern.posix.semmax (maximum number
of semaphores).
2015-11-09 01:21:18 +00:00
joerg
8e87830d68 Add the parent device (if present) to the device properties, making it
easier to identify devices in the tree with drvctl(8).
2015-11-08 21:03:00 +00:00
pgoyette
462d797f59 In sysv_sem.c, defer establishment of exithook so we can initialize the
module code from module_init() rather than waiting until after calling
exec_init().  Use a RUN_ONCE routine at entry to each sys_sem* syscall
to establish the exithook, and no longer KASSERT that the hook has
been set before removing it.  (A manually loaded module can be unloaded
before any syscalls have been invoked.)

Remove the conditional calls to the various xxx_init() routines from
init_main.c - we now rely on module_init() to handle initialization.

Let each sub-component's xxx_init() routine handle its own sysctl
sub-tree initialization;  this removes another set of #ifdef ugliness.

Tested both built-in and loadable versions and verified that atf
test kernel/t_sysv passes.
2015-11-06 02:26:42 +00:00
pgoyette
98a4e6195c As long as we still claim to build each subcomponent separately, make
sure we properly define the (sub)set of syscalls we're building.
2015-11-06 01:00:41 +00:00
pgoyette
51126f7011 Now that SYSVSHM is modularized, reattach the linkages from uvm so that
we can correctly clean up on process exit or fork.

Without this, firefox attaches to a shared memory segment but doesn't
detach before exit.  Thus once firefox causes an autoload for sysv_ipc
it cannot be unloaded since the segment still retains references.
2015-11-05 00:10:47 +00:00
pgoyette
3e2029259a Export module flags to userland 2015-11-04 04:28:58 +00:00
pgoyette
54ba967d17 Remove extraneous ')' from previous. 2015-11-03 03:33:43 +00:00
pgoyette
60332beadf Add some additional status messages for kern.module.verbose=TRUE 2015-11-03 02:04:12 +00:00
christos
41dca8aba0 Ignore the ancient 01.01 tag that gnuc used to put in old NetBSD binaries. 2015-11-01 17:44:41 +00:00
christos
4cc78eb1fb Don't overwrite the user iov pointer in sendmmsg. Make the send and receive
code look the same.
2015-11-01 17:23:36 +00:00
christos
f5789f4f44 Add buildid Go note 2015-11-01 15:21:42 +00:00
mrg
1e1a1a8da3 if NUSB == 0, don't look for usbhist. 2015-10-29 18:40:19 +00:00
mrg
679d7c25a6 introduce a new way of handling SYSCALL_DEBUG messages -- send them to
a kernel history, settable via the SCDEBUG_KERNHIST flag.

this requires a fairly significantly different set of messages than the
normal debug as histories are restricted:
	- each message can take one literal format string and upto 4
	  arguments
	- the arguments can not be strings if you want vmstat -u to
	  work (this could be fixed, and i might, as it would be nice
	  if we could print syscall names as well as numbers.)

introduce SCDEBUG_DEFAULT that is settable in the kernel config.

fix a problem in kernhist_dump_histories() where it would crash when a
history with no allocated entries was found.

extend kernhist_dumpmask() to handle the usbhist and scdebughist.
2015-10-29 00:27:08 +00:00
martin
6ae6da2395 Fix inverted KASSERT 2015-10-28 14:05:04 +00:00
martin
f39ddc9a21 Apease bogus gcc warning. 2015-10-25 09:27:14 +00:00
maxv
ea498aca7e Change do_sys_mount() so that it only takes as argument the type of the
drive instead of its associated vfsops. Makes it more friendly, and allows
compat binaries to autoload VFS modules if needed.

sent on tech-kern@, ok christos@
2015-10-23 19:40:10 +00:00
pgoyette
4d28b6018c Fix typx in comment 2015-10-23 01:58:43 +00:00
christos
c4922ba137 Add console-related ioctls. 2015-10-22 17:36:33 +00:00
maxv
6d1bcdcc10 Reset the PaX flags, make sure ep_emul_arg is NULL, and add a comment. 2015-10-22 11:48:02 +00:00
maxv
856f192f05 Check the error code from es_setup_stack, and correctly free ep_emul_arg if
it fails.

That bug is harmless, since ep_setup_stack never fails.
2015-10-22 11:38:51 +00:00
christos
054ca2c181 add the pty ioctls to pass through. 2015-10-18 15:58:23 +00:00
christos
8c41569f24 handle the hardware layer tty ioctls directly so that we don't need to load
the compat module for normal operations.
2015-10-18 15:14:50 +00:00
jmcneill
abe8031d08 initialize MODULE_CLASS_DRIVER modules before the drivers themselves are loaded during autoconfiguration 2015-10-17 13:52:52 +00:00
rjs
8c2654abca Add core networking support for SCTP. 2015-10-13 21:28:34 +00:00
pgoyette
764be6be1d When delivering a signal, it's possible that the process's state in
p_stat is SACTIVE yet p_sflag is PS_STOPPING (while waiting for other
lwp's to stop).  In that case, we don't want to adjust the parent's
p_nstopchild count.

Found by Robert Elz.

XXX Pullups to: NetBSD-7, -6{,-0,-1}, and -5{,-0,-1,-2}
2015-10-13 07:00:59 +00:00
pgoyette
d3abaa577e Update value of p_stat before we release the proc_lock. Thanks to
Robert Elz.

XXX Pull-ups for -7, -6{,-0,-1} and -5{,-0,-1,-2}
2015-10-13 06:47:21 +00:00
pgoyette
90bf221e1f In spawn_return() we temporarily move the process state to SSTOP, but
without updating its p_waited value or its parent's p_nstopchild
counter.  Later, we restore the original state, again without any
adjustment of the related values.  This leaves a relatively short
window when the values are inconsistent and could interfere with the
proper operation of sys_wait() for the parent (if it manages to be
scheduled;  it's not totally clear what, if anything, prevents
scheduling/execution of the parent).

If during this window, any of the checks being made result in an
error, we call exit1() which will eventually migrate the process's
state to SDEAD (with an intermediate transition to SDYING).  At
this point the other variables get updated, and we finally restore
a consistent state.

This change updates the p_waited and parent's p_nstopchild at each
step to eliminate any windows during which the values could lead to
incorrect decisions.

Fixes PR kern/50330

Pullups will be requested for NetBSD-7, -6, -6-0, and -6-1
2015-10-13 00:29:34 +00:00
pgoyette
b2557f247b For processes marked with PS_STOPEXIT, update the process's p_waited
value, and update its parent's p_nstopchild value when marking the
process's p_stat to SSTOP.  The process needed to be SACTIVE to get
here, so this transition represents an additional process for which
the parent needs to wait.

Fixes PR kern/50308

Pullups will be requested for:

       NetBSD-7, -6, -6-0, -6-1, -5, -5-0, -5-1, and -5-2
2015-10-13 00:28:22 +00:00
pgoyette
ad146809be Currently, if a process is exiting and its parent has indicated no intent
of reaping the process (nor any other children), the process wil get
reparented to init.  Since the state of the exiting process at this point
is SDEAD, proc_reparent() will not update either the old or new parent's
p_nstopchild counters.

This change causes both old and new parents to be properly updated.

Fixes PR kern/50300

Pullups will be requested for:

       NetBSD-7, -6, -6-0, -6-1, -5, -5-0, -5-1, and -5-2
2015-10-13 00:27:19 +00:00
pgoyette
01f3fada24 When clearing out the scheduler queues during system shutdown, we move
all processes to the SSTOP state.  Make sure we update each process's
p_waited and the parents' p_nstopchild counters to maintain consistent
values.  Should not make any real difference this late in the shutdown
process, but we should still be consistent just in case.

Fixes PR kern/50318

Pullups will be requested for:

       NetBSD-7, -6, -6-0, -6-1, -5, -5-0, -5-1, and -5-2
2015-10-13 00:25:51 +00:00
pgoyette
4937211e28 In execve_runproc(), update the p_waited entry for the process being
moved to SSTOP state, not for its parent.  (It is correct to update
the parent's p_nstopchild count.)  If the value is not already zero,
it could prevent its parent from waiting for the process.

Fixes PR kern/50298

Pullups will be requested for:

       NetBSD-7, -6, -6-0, -6-1, -5, -5-0, -5-1, and -5-2
2015-10-13 00:24:35 +00:00
pgoyette
d4c18fb9c6 Regen 2015-10-10 03:30:17 +00:00
pgoyette
b15990a499 Correctly mark syscalls 301, 302, 303 so that they will autoload the
compat_sysv module if not already built-in.
2015-10-10 03:27:30 +00:00
christos
a89334cd83 PR/50312: Robert Elz: Unconditionally include <sys/exec.h> to fix compilation
when PAX_ASLR is not defined.
2015-10-09 02:00:59 +00:00
christos
2210ed24e7 provide curthread for dtrace 2015-10-07 00:32:34 +00:00
christos
8c1b3fd3c9 Expose struct kauth_cred for the benefit of the debugger. I can't convince gcc
to produce debug info for the structure if it does not appear in more than
one source file.
2015-10-06 22:13:39 +00:00
christos
a3c9e9c899 CID/1325753: remove extra return. 2015-10-06 15:03:34 +00:00
christos
3415810083 PR/50295: clock_nanotime() should not set errno, but return the error. 2015-10-02 19:47:08 +00:00
christos
db70f1818e Change SDT (Statically Defined Tracing) probes to use link sets so that it
is easier to add probes. (From FreeBSD)
2015-10-02 16:54:15 +00:00
ozaki-r
05cf8927fd Add _KERNEL_OPT
It's needed for nbmake RUMP_LOCKDEBUG=yes.
2015-09-29 01:44:57 +00:00
maxv
9ed595918a Revamp the way processes are PaX'ed in the kernel. Sent on tech-kern@ two
months ago, but no one reviewed it - probably because it's not a trivial
change.

This change fixes the following bug: when loading a PaX'ed binary, the
kernel updates the PaX flag of the calling process before it makes sure
the new process is actually launched. If the kernel fails to launch the
new process, it does not restore the PaX flag of the calling process,
leaving it in an inconsistent state.

Actually, simply restoring it would be horrible as well, since in the
meantime another thread may have used the flag.

The solution is therefore: modify all the functions used by PaX so that
they take as argument the exec package instead of the lwp, and set the PaX
flag in the process *right before* launching the new process - it cannot
fail in the meantime.
2015-09-26 16:12:24 +00:00
christos
932cdb9b10 regen 2015-09-24 14:34:22 +00:00
christos
25f4925cd9 implementation of KERN_PROC_PATHNAME, some refactoring for KERN_PROC. 2015-09-24 14:33:01 +00:00
christos
a56c5627aa create an array of altsyscallnames, which are the syscall names that the
libc api uses. For example syscallnames[293] = "__sigprocmask14",
altsyscallnames[293] = "sigprocmask". This is so that things like dtrace
can use the system call names everyone uses. The array is sparse; if the
names were the same (or for compat names) they are not copied and the array
has NULL for them.
2015-09-24 14:30:52 +00:00
uebayasi
960ec2b2e8 Handle splash image generation better. 2015-09-14 01:40:03 +00:00
christos
32627ea0ec gcc does not detect initialization correctly on all platforms (hpcsh) 2015-09-12 18:30:46 +00:00