Commit Graph

8924 Commits

Author SHA1 Message Date
hannken
97834f7ba0 Change vnode operation lookup to return the resulting vnode *vpp unlocked.
Change cache_lookup() to return an unlocked vnode.

Discussed on tech-kern@

Welcome to 6.99.31
2014-02-07 15:29:20 +00:00
hannken
f106eaceb6 Change vnode operation lookup to return the resulting vnode *vpp unlocked.
Change cache_lookup() to return an unlocked vnode.

Discussed on tech-kern@
2014-02-07 15:26:42 +00:00
msaitoh
62342f9d4d s/mesage/message/ 2014-02-07 11:51:00 +00:00
riastradh
6c0ad81464 __HAVE_ATOMIC_AS_MEMBAR is spelled with two leading underscores.
This underscores the need to replace this error-prone cpp API by
unconditionally defined {pre,post}atomic_membar_*.

This change should only remove unnecessary membar_producers on x86.
2014-02-06 03:47:16 +00:00
martin
65095476e3 Cosmetics: return is an operator, not a function: remove (). 2014-02-02 14:50:46 +00:00
martin
2934fa70dc Limit the amount of kernel memory a posix_spawn syscall can use (for handling
the file action list) by limiting the maximum number of file actions to
twice the current file descriptor limit.
Fix a few bugs in the support functions and document the new limit.
From Maxime Villard.
2014-02-02 14:48:57 +00:00
dogcow
437b1ce30d Delete duplicate symbol definition introduced in 1.371. Now builds again. 2014-02-02 08:25:23 +00:00
manu
70aead41ff Add EMUL_NATIVEROOT so that native binaries can be told to search an
"emulation" directory before the real root. This makes easier to test
an amd64 kernel on the top of an i386 root filesystem prior a full
migration.
2014-02-02 04:28:42 +00:00
yamt
57688c9a9e tty_pty: add CTASSERTs to document assumptions 2014-01-29 02:38:48 +00:00
martin
30a98d4423 Mark a diagnostic only variable 2014-01-28 12:50:54 +00:00
christos
9477bafa18 kill the topdown flag only if we succeed. 2014-01-25 23:58:41 +00:00
christos
f5fe8e85e2 fix unused 2014-01-25 21:11:20 +00:00
christos
840bc63029 __USING_TOPDOWN_VM is no more, __USE_TOPDOWN_VM... 2014-01-25 19:44:11 +00:00
christos
cee146c035 Add compat_10, open NULL == open "." 2014-01-25 17:24:45 +00:00
christos
f4956d9c6a a.out binaries can't handle topdown. 2014-01-25 05:15:05 +00:00
christos
1525b564a7 expose do_open 2014-01-25 02:28:31 +00:00
skrll
c92b6b82d2 Pass PCU_LOADED to pcu_state_load in the "this CPU already has our PCU
state loaded" of pcu_load.

ok, gimpy@ and rmind@
2014-01-23 17:32:03 +00:00
hannken
04c776e5c8 Change vnode operations create, mknod, mkdir and symlink to return
the resulting vnode *vpp unlocked.

Discussed on tech-kern@

Welcome to 6.99.30
2014-01-23 10:13:55 +00:00
hannken
ac59f9acc5 Change vnode operations create, mknod, mkdir and symlink to return
the resulting vnode *vpp unlocked.

Discussed on tech-kern@
2014-01-23 10:11:55 +00:00
hannken
0fa0d339bd Change cache_prune() to test for end-of-list before testing for an
invalid entry.  Prevents a lifelock when the end-of-list marker
gets invalid while scanning the list and all entries are recent.
2014-01-20 07:47:22 +00:00
hannken
1139274440 Change vnode operations create, mknod, mkdir and symlink to keep the
directory node dvp locked on return.

Discussed on tech-kern@

Welcome to 6.99.29
2014-01-17 10:55:01 +00:00
hannken
10a361faf8 Change vnode operations create, mknod, mkdir and symlink to keep the
directory node dvp locked on return.

Discussed on tech-kern@
2014-01-17 10:52:36 +00:00
pooka
73822fbe26 Put cprng sysctls into subr_cprng.c. Also, make sysctl_prng static
in subr_cprng and get rid of SYSCTL_PRIVATE namespace leak macro.

Fixes ping(8) when run against a standalone rump kernel due to appearance
of the kern.urandom sysctl node (in case someone was wondering ...)
2014-01-17 02:12:48 +00:00
christos
2b043c75b6 eliminate use of bsd.sys.mk from Makefiles 2014-01-16 01:15:32 +00:00
hannken
29148b903d Support for vnode operation versioning. Allow a new keyword "VERSION"
in the description so "VERSION 2" will change the name of the argument
from vop_XXX_args to vop_XXX_v2_args.
2014-01-13 12:07:55 +00:00
joerg
c9ec0f85a6 Revert, breaks the build due to missing rumpns_delay in librump.so. 2014-01-12 00:29:15 +00:00
christos
71826933a0 Sleep 10 seconds before rebooting due to panic()
To give an opportunity to screencap a panic(), or pause a VM to attach
a debugger.  (Richard Hansen)
2014-01-11 17:07:45 +00:00
christos
b4a250d75c Reorder code to avoid use-after-free on error. From Maxime Villard 2014-01-11 16:31:20 +00:00
dsl
ff2955473b Re-instate the zero length sections in elf core dumps (they probably help
describe the process memory layout).
Fudge the a.out core code to not dump the entire contents.
I'm not sue that anything can read a.out core files - more progress might
  be made on such dumps by converting the a.out file to elf!
2014-01-07 07:59:03 +00:00
dsl
3dacf18540 Fix previous slightly differently.
No need to have an extra variable and to write to the list head.
2014-01-05 09:13:18 +00:00
mrg
dd411234d3 avoid use-after-free in *coredump().
fixes kernel crashes during coredump on sparc64.
2014-01-05 00:53:53 +00:00
dsl
95739e63cd Remove __HAVE_PROCESS_XFPREGS and add the extra parameter for the size
of the fp save area to all the process_read_fpregs() and
  process_write_fpregs() functions.
None of the functions have been modified to use the new parameters.
The size is set for all the writes, but some of the arch-specific reads
  just pass NULL.
The amd64 (and i386) need variable sized fp register save areas in order
  to support AVX and other enhanced register areas.
These functions are rarely called - so the extra argument won't matter.
2014-01-04 00:10:02 +00:00
dsl
4adfd474c1 Fix bug in previous (panic during process core dump).
Change the interface to ELFNAMEEND(coredump_savenote) so that the caller
  doesn't need to know the type of the elf note header.
Simplifies the calling code somewhat.
2014-01-03 21:34:40 +00:00
dsl
825d1920ba There is no need for uvm_coredump_walkmap() to explicity pass the proc_t
pointer to the calller's function.
If the code needs the process its address can be placed in the caller's
  cookie.
2014-01-03 21:12:18 +00:00
dsl
d773820bd9 Instead of generating all the 'note' sections twice (and hoping that the
'fast path' size on the first path matches the actual size on the second)
  save all the notes (mostly the cpu registers for all the LWPs) in
  malloced memory on the first pass.
Sanity check that the number of memory segments matches written matches
  the count obtained earlier. If gcore() is used they could differ.
  (Not sure that returning ENOMEM is ideal, but it is better than a crash.)
2014-01-03 20:52:47 +00:00
christos
87fb4a985c Simplify error path and fix typos. From Maxime Villard and me. 2014-01-03 15:49:49 +00:00
dsl
7a743f3de6 Minor changes to the process coredump code.
- Add some extra comments.
- Add some XXX comments because the process state might not be stable,
- Add uvm_coredump_count_segs() to simplify the calling code.
- uvm code now only returns non-empty sections/segments.
- Put the 'iocookie' into the 'cookie' block passed to uvm_coredump_walkmap()
  instead of passing it through as an additional parameter.
amd64 can still generate core dumps that gdb can read.
2014-01-03 15:15:02 +00:00
dsl
be74e0a9c9 Change the type of the 'cookie' that holds the state of the core dump file
from 'void *' to the actual type 'struct coredump_iostate *'.
In most of the code the contents of the structure are still unknown.
This just stops the wrong type of pointer being passed to the 'void *'
parameter.
I hope I've found everything, amd64 GENERIC and i386 GENERIC & ALL compile.
2014-01-01 18:57:15 +00:00
christos
54a8b0e862 replace strcpy with copystr and remove useless strcpy (Maxime Villard) 2013-12-24 14:47:04 +00:00
skrll
be521dde4c Remove local getsn and use cngetsn. 2013-12-23 15:34:16 +00:00
skrll
04e9e004ed Check interp after reading it. Checking newly allocated memory doesn't
work.

Hi Christos.
2013-12-21 17:44:33 +00:00
christos
39826d358b Consistency checks for the length of the interpreter (the length includes
the trailing NUL): make sure it is not empty and has the proper length.
From Maxime Villard
2013-12-21 14:41:02 +00:00
mlelstv
757ba59472 cpu_infos is a NULL terminated array, not an array followed by a 0 byte. 2013-12-19 23:36:07 +00:00
pgoyette
2b1203b7ab Make the auto-unload timeout configurable via sysctl, and if the timeout
is set to zero, disable all auto-unloads (even those that were "scheduled"
previously).
2013-12-15 21:09:50 +00:00
pgoyette
4a5c98c1a5 Add SYS_compat_60__lwp_park to the list of syscalls that can be resolved by loading kernel modules.
This seems to address my PR kern/48027
2013-12-14 06:27:57 +00:00
pooka
ef738750b7 reregengen 2013-12-11 09:45:01 +00:00
pooka
e69be3f980 create rump kernel wrapper for utrace() too 2013-12-11 09:40:56 +00:00
pooka
4bb2a888c3 regen 2013-12-09 21:13:21 +00:00
pooka
8dd50f0fc0 one newline is enough 2013-12-09 21:12:45 +00:00
pooka
cb1b7ccb56 need string.h now for !_KERNEL 2013-12-09 21:11:15 +00:00
pooka
a32f91a34e regen 2013-12-09 19:19:39 +00:00
pooka
d5af12a417 Initialize the syscall "frame" to 0 before setting parameters.
Otherwise things which treat syscall parameters as register_t (like
ktrace) will encounter garbage for parameters which are of smaller size
than register_t.  Using memset is probably not the most optimal way,
but oh well.
2013-12-09 19:18:52 +00:00
pooka
3d49ec1a72 As long as we're using #ifdef to decide which stubs get generated, might
as well use __strong_alias instead of __weak_alias.  Some toolchains
such as the cygwin pecoff one get weak aliases a bit wrong, so avoiding
unnecessary weak alises helps there.
2013-12-09 18:06:27 +00:00
pooka
2f027c575e regen 2013-12-09 17:15:11 +00:00
pooka
c21ebec4d0 Create rump kernel wrappers for {f,}ktrace 2013-12-09 17:13:17 +00:00
pooka
9737cfdd2b Group more syscall related routines together (kern_subr -> kern_syscall) 2013-12-09 16:49:43 +00:00
pooka
b4e2514736 Put vfs bits of ktrace into kern_ktrace_vfs.c per convention. 2013-12-09 16:45:23 +00:00
pooka
a639bb644d regen 2013-12-09 16:35:12 +00:00
pooka
1aff7d0261 Echo generated file names so that you can just copypaste & cvs ci
without having to resort to the blazingly fast help of cvs diff.
2013-12-09 16:32:06 +00:00
pooka
f5fe7e313f Rump kernels now use sy_invoke(), which initializes the return
value registers, so no need to do it individually in each wrapper.
2013-12-09 16:27:15 +00:00
wiz
d860f590d4 Fix typo ("then" instead of "than") 2013-12-09 09:35:16 +00:00
hannken
fb83ccaa78 When deciding to defer in vrelel():
- No need to always defer layer vnodes, if we get the vnode lock it
  is safe to inactivate.
- Always use VOP_LOCK(), it makes no sense to use vn_lock() here.
- No need to drop v_interlock for VOP_LOCK(... LK_NOWAIT).
2013-12-07 10:03:28 +00:00
christos
8370a84a29 Put back the vnode changes I backed out yesterday; they were not the problem.
I've tested them with 2 -j 20 builds on an 8 cpu box. It crashed reliably
with the pcu changes present before.
2013-12-01 17:29:40 +00:00
christos
2da727a2d8 Revert recent vnode changes per PR/48411, I still have deadlocks with
build -j 20 on an 8 cpu machine.
2013-12-01 00:59:34 +00:00
hannken
51a028aeda Change vrelel() to mark the vnode as changing after it has aquired
the vnode lock but before it calls VOP_INACTIVE().

Should fix the race between layer_node_find() trying to vget(, LK_NOWAIT)
a locked vnode when vrelel() marked it as changing and wants its lock.

PR kern/48411 (repeatable SMP crashes in amd64-current)
2013-11-29 14:58:55 +00:00
christos
bbbabeddfb one more *_END(head) -> NULL 2013-11-27 17:25:46 +00:00
christos
9d605174d9 Change the queue.3 *_END(&head) macros to NULL. Since we don't have CIRCLEQ
anymore, all the macros expand to NULL anyway, so this improves readability.
Requested by rmind@
2013-11-27 17:24:43 +00:00
rmind
34a5533806 Fix previous, use the correct value for softint_establish (SOFTINT_SERIAL). 2013-11-26 21:13:05 +00:00
rmind
2312c4ca30 Switch XC_HIGHPRI to run at IPL_SOFTSERIAL i.e. the highest software level.
Adjust pcu(9) to this xcall(9) change.  This may fix the problems after
x86 FPU was converted to use PCU, since it avoids heavy contention at the
lower levels (particularly, IPL_SOFTNET).  This is a good illustration why
software interrupts should generally avoid any blocking on locks.
2013-11-26 20:29:40 +00:00
christos
6cce1f9fa7 Use the process credentials instead of the lwp credentials because if the
process just did a setuid() call, the lwp might not have had a chance to
refresh l->l_cred (still has LPR_CRMOD), and we don't want to bother spending
time syncing the creds of a dying lwp. Should fix the problem with hald
people have been observing.
2013-11-25 16:29:25 +00:00
rmind
e6379a24ea do_setresuid: add an assert. 2013-11-25 16:28:20 +00:00
rmind
df64447ca6 Remove cpu_queue (and thus eleminate another use of CIRCLEQ) by replacing
its uses with cpu_infos array.  Extra testing by christos@.
2013-11-24 21:58:38 +00:00
christos
cf928d6150 Explain where this will fail. 2013-11-23 22:15:16 +00:00
hannken
df32ec6a1f Replace VI_INACTNOW and VI_INACTREDO with a new flag VI_CHANGING that gets
set while a vnode changes state from active to inactive or from active
or inactive to clean and protects "vclean(); vrelel()" and "vrelel()"
against "vget()".

Presented on tech-kern.
2013-11-23 13:46:22 +00:00
christos
0b725b63c7 change the mountlist CIRCLEQ into a TAILQ 2013-11-23 13:35:36 +00:00
christos
471b216b8f convert vmem, signals, powerhooks from CIRCLEQ -> TAILQ. 2013-11-22 21:04:11 +00:00
chs
dc00ea6b1e expose various do_*at() functions for compat_linux. 2013-11-18 01:31:42 +00:00
christos
1a9e8a975e remove trigger happy assertion. in m_adj negative lengths are valid. 2013-11-15 17:48:55 +00:00
christos
b764989391 - add KASSERTS on functions that don't accept M_COPYALL
- compute length for m_copyback0, m_makewritable used from ipf, is using
  M_COPYALL.
2013-11-14 18:54:40 +00:00
martin
153351b36e oops, remove accidently commited debug code 2013-11-14 16:53:51 +00:00
martin
41de4c61e8 As discussed on tech-kern: make TOPDOWN-VM runtime selectable per process
(offer MD code or emulations to override it).
2013-11-14 12:07:11 +00:00
skrll
955298ee4a Deal with M_COPYALL becoming -ve properly in m_copym0.
I can now mount via nfs again.
2013-11-14 09:21:30 +00:00
christos
b89fa8e9d5 change M_COPYALL to be -1 instead of depending on it too be "too large",
so that we check explicitly against it in all places. ok gimpy
2013-11-14 00:50:36 +00:00
martin
2fae30a160 Remove dead code 2013-11-11 15:22:11 +00:00
hannken
21542ebe39 Make vclean static (ride 6.99.2).
DOCLOSE is no longer needed -- remove.
2013-11-07 09:48:34 +00:00
martin
c04325564a Define a new NetBSD specific note to encode the code model used for a binary.
Allow MD code to check these notes in the exec path.
2013-11-05 14:26:19 +00:00
hannken
d54b981232 cleanvnode():
- VC_XLOCK/VC_MASK are not used anymore, remove.
- If we get a reference while cleaning, there is no need to retry as
  these reference and this vnode will disappear soon.
- Make sure we run inside a fstrans transaction to prevent deadlocks
  against vget().

vrecycle():
- don't even try to recycle a vnode currently cleaning.
2013-11-03 08:33:00 +00:00
christos
cb9d7c7e3a PR/48098: Brian Marcotte: panic: kernel diagnostic assertion "cred != NULL":
Fix from Michael van Elst, tcpdrop crashes kernel on ebryonic connections.
2013-11-02 20:09:33 +00:00
joerg
1e90a44d68 Preserve NetBSD version from the ABI tag for compat use. 2013-10-30 23:32:30 +00:00
hannken
65b1f85ab6 Vnode API cleanup pass 1.
- Make these defines and functions private to vfs_vnode.c:

  VC_MASK, VC_LOCK, DOCLOSE, VI_IANCTREDO and VI_INACTNOW
  vclean() and vrelel()

- Remove the long time unused lwp argument from vrecycle().

- Remove vtryget(), it is responsible for ugly hacks and doesn't
  look that effective.

Presented on tech-kern.

Welcome to 6.99.25
2013-10-29 09:53:51 +00:00
rmind
59ff95e71b vttodt_tab: index in C99 way, makes it less error-prone. 2013-10-27 16:19:33 +00:00
martin
33ce426346 Mark diagnostic-only variables 2013-10-25 20:37:17 +00:00
martin
419cac9e69 Mark a diagnostic-only variable 2013-10-25 20:28:33 +00:00
martin
e8d61dfcd2 Eliminat an unused variable and simplify the KASSERT which used to use it 2013-10-25 19:55:22 +00:00
martin
7c79fd6cfc Mark a diagnostic-only variable 2013-10-25 16:23:46 +00:00
martin
dad6303a94 Mark a diagnostic-only variable 2013-10-25 16:09:29 +00:00
martin
f6552d7c17 Mark diagnostic-only variables 2013-10-25 16:08:18 +00:00
martin
652ae4d76b Mark a diagnostic-only variable 2013-10-25 15:51:36 +00:00
martin
6a2419fedf Turn a few __unused into __diagused 2013-10-25 11:35:55 +00:00
mlelstv
3d28892c85 use 64bit arithmetic to compute sectors-per-unit 2013-10-19 22:36:57 +00:00
mrg
923e17fd1b use __USE() where appropriate. 2013-10-19 21:01:39 +00:00
christos
e5d5564a4b remove __unused now that it is used. 2013-10-19 19:22:16 +00:00
martin
8afc72d050 cpu_need_resched(ci, type) might not make use of the type argument - mark
the variable declaration accordingly.
2013-10-19 18:42:05 +00:00
christos
951530b23a initialize a variable, hi gcc again! 2013-10-17 20:57:06 +00:00
njoly
4a806b5236 Regen for mknodat(2) device argument type change. 2013-10-17 18:04:40 +00:00
njoly
349036b521 Change mknodat(2) device argument type from uint32_t to dev_t.
Adds needed extra PAD argument for 64bit alignment, and libc wrapper.
2013-10-17 18:01:11 +00:00
christos
11beb626a3 Pass the device name in, so we can debug what deferred drivers did not work. 2013-10-12 16:49:00 +00:00
christos
c3caf0b851 provide a better printf for the panic message 2013-10-12 16:42:27 +00:00
christos
eaca448335 delete extra m_len initialization. 2013-10-09 20:15:39 +00:00
christos
6427a54f86 - initialize m_len m_pkthgr.len to 0 in constructors, as discussed in tech-net.
- s/MGET/m_get
- s/0/NULL
2013-10-09 20:15:20 +00:00
christos
bbb0e86c6c PR/48292: Justin Cormack: paccept creates sockets that cannot be made blocking
Reset the socket flags not just the file flags for non-blocking I/O.
XXX: pullup 6
2013-10-09 18:55:56 +00:00
christos
f907e085f5 MGET -> m_get 2013-10-08 19:59:49 +00:00
christos
44d32d084d 0 -> NULL
MGET -> m_get
No functional change.
2013-10-08 19:58:25 +00:00
christos
c5f38835d1 Centralize the sockaddr_un allocation code. Set sun_len appropriately so
that the address length returned is correct, not always 106. Note that
we do things slightly differently than linux and explain why. Unit-tests
to come.
2013-10-08 17:21:24 +00:00
christos
c7901c6669 - Instead of having accept(2) return a zero-filled sockaddr for the case
where accept(2) was called on a unix socket that called connect(2) and
  then close(2), before the connection was accepted, return the empty
  sockaddr_un.
- Fix the length of the empty sockaddr_un socket so that it reflects reality.
2013-10-08 15:09:51 +00:00
seanb
b2bc048094 POSIX says getsockopt(s, SOL_SOCKET, SO_ACCEPTCONN,,) needs to work. 2013-10-08 14:54:29 +00:00
njoly
815709f7c7 Note that sysalign checks for dev_t/time_t alignment too. 2013-10-08 11:47:57 +00:00
christos
6499af7dd8 PR/47591: Michael Plass: If the unix socket is closed before accept,
unp->unp_conn will be NULL in PRU_ACCEPT, as called from
sys_accept->so_accept. This will cause the usrreq to return with
no error, leaving the mbuf gotten from m_get() with an uninitialized
length, containing junk from a previous call. Initialize m_len to
be 0 to handle this case. This is yet another reason why Beverly's
idea of setting m_len = 0 in m_get() makes a lot of sense. Arguably
this could be an error, since the data we return now has 0 family
and length.
2013-10-08 00:29:24 +00:00
apb
03780f96b2 Add "/rescue/init" to the end of the initpaths list, which
now contains: { "/sbin/init", "/sbin/oinit", "/sbin/init.bak",
"/rescue/init", NULL }.

XXX: The kernel's use of initpaths is not documented.
2013-10-02 21:38:55 +00:00
hannken
3881f4f3f9 Replace macro v_specmountpoint with two functions spec_node_getmountedfs()
and spec_node_setmountedfs() to manage the file system mounted on a device.
Assert the device is a block device.

Welcome to 6.99.24

Discussed on tech-kern@ some time ago.

Reviewed by: David Holland <dholland@netbsd.org>
2013-09-30 18:57:59 +00:00
hannken
595ec746ec Remove VI_INACTPEND. Last consumer was vcount() which got removed 2010-01-08.
Reviewed by: David Holland <dholland@netbsd.org>
2013-09-30 15:24:14 +00:00
joerg
d572dfc897 Remove redundant declaration of MUTEX_CLEAR_WAITERS without checking if
any of the !__HAVE_SIMPLE_MUTEX architectures need it based on the
assumption that HPPA is the only member of that category.
2013-09-22 14:59:07 +00:00
skrll
a6cc1b9335 Revert previous - it was wrong. hi joerg. 2013-09-22 14:55:07 +00:00
dholland
795a6d5517 In description of a locking mess, add reference to the PR for the bug
the mess is supposed to help with.
2013-09-21 19:51:33 +00:00
christos
2c8afde7d0 mark mbuf as free when we return it to the pool (Beverly Schwartz) 2013-09-20 19:13:39 +00:00
christos
721e82b55a exec modules need to be of the exec kind 2013-09-19 18:50:35 +00:00
martin
db355f514c Fix inverted ktrop() return value - oops!
Noted by Nicolas Joly.
2013-09-16 09:25:56 +00:00
martin
7dbdb14bec Remove unused variable 2013-09-15 15:57:26 +00:00
martin
58c1db511f Avoid unused variable warnings 2013-09-15 15:41:11 +00:00
martin
33f8ac88d7 Remove unused variables 2013-09-15 15:37:27 +00:00
martin
7a86b34811 Remove unused variables 2013-09-15 14:53:03 +00:00
martin
10c5b4d905 Remove unused variable 2013-09-15 14:08:25 +00:00
martin
fd52abfdd4 Remove __CT_LOCAL_.. hack 2013-09-15 13:03:59 +00:00
joerg
28cfffa6f7 Provide a prototype for wapbl_space_free under _KERNEL. 2013-09-15 08:11:33 +00:00
martin
243edbb1dc Nove a CTASSERT to global scope 2013-09-14 20:53:48 +00:00
martin
083fcd5d58 ifdef a variable like its use 2013-09-14 20:52:43 +00:00
martin
d0c00269ee Guard a function local CTASSERT with prologue/epilogue 2013-09-14 20:49:31 +00:00
martin
f6c835fd37 Move a few CTASSERT to global scope 2013-09-14 20:47:48 +00:00
martin
fa588be65c Push/Pop pragma magic to avoid gcc warning aber a less-than NULL comparision 2013-09-14 20:46:27 +00:00
martin
7698187086 Move a CTASSERT to global scope (easiest way to avoid gcc 4.8.1 local unused
typedef warnings)
2013-09-14 20:24:22 +00:00
martin
04162fd193 ktrop() seems to be expected [by it's callers] to return a "bool like"
value, not an errno - make it so.
Remove another unused variable.
2013-09-14 20:20:09 +00:00
martin
97374bea1a Avoid warnings for a local CTASSERT 2013-09-14 13:46:52 +00:00
joerg
106176e34b wapbl_advance and friends are only used in the kernel 2013-09-14 13:19:50 +00:00
joerg
c954523660 MUTEX_CLEAR_WAITERS is only ever used by !__HAVE_SIMPLE_MUTEXES 2013-09-14 13:19:18 +00:00
joerg
072ff8a985 nodebug is only used with LOCKDEBUG 2013-09-14 13:18:31 +00:00
joerg
3314878444 GC various arrays defined and used in kern_proc.c 2013-09-14 13:18:02 +00:00
jnemeth
b8d9c736cd fix compilation error; hi christos! 2013-09-13 07:18:34 +00:00
christos
1ebd07204c Silence some common module load errors and explain why. 2013-09-12 19:02:05 +00:00
christos
2ff1b6b59f What's the point of having a module exec class if exec is not using it? 2013-09-12 19:01:38 +00:00
matt
50bfeb714d Support an optional MARCH ELF tag.
Store the MACHINE_ARCH of the executable in mdproc and override sysctl
so that value returned.
2013-09-10 21:30:21 +00:00
pooka
543084bf66 regen 2013-09-10 17:42:02 +00:00
pooka
cb7f5a8a3d "rumpuser_port.h" -> <rump/rumpuser_port.h> 2013-09-10 17:40:54 +00:00
matt
25fcead210 Change two KASSERTs to KASSERTMSG 2013-09-07 03:34:59 +00:00
pooka
5d36abf618 In fd_abort(), reset ff_exclose to preserve invariants expected by fd_free() 2013-09-05 12:23:07 +00:00
skrll
32d2366deb Typo in comment. 2013-09-04 10:16:16 +00:00
pooka
cee3de56df regen 2013-09-03 21:30:43 +00:00
pooka
d04c1489fc If RUMP_KERNEL_IS_LIBC is defined, alias the rump kernel syscalls to libc
syscall stub symbol names.  This allows running standalone programs in
OS-less environments such as directly on a Xen DomU backed only by a
libc and a rump kernel.
2013-09-03 21:28:24 +00:00
pooka
6d43f1658d Autogenerate rump_syscalls.c into the correct namespace, i.e. it no
longer needs to go through rename in the build.
2013-09-03 20:54:03 +00:00
pooka
31b175eb03 Don't autogenerate the wrapper that is called from the rump kernel
local syscall entry points.  The wrapper is now so big that it doesn't
get inlined (original intent for having it close to the entry points),
and autogenerating a regular function just loses in flexibility.
2013-09-03 19:55:13 +00:00
hannken
1f6a95ec03 Dounmount() violates the locking protocol for member v_mountedhere.
A vnode lock is required to access or modify this field.

Lock/unlock the vnode when clearing v_mountedhere.

Reviewed by: David Holland <dholland@netbsd.org>

Should fix PR  (Bad locking for umount)
2013-08-30 12:58:22 +00:00
pooka
1f2f41bbc5 commit all files when regen'ing 2013-08-30 11:10:34 +00:00
pooka
7efe29ddc3 There is absolutely no way that fexecve() could even theoretically work
in a rump kernel, so don't create a wrapper for that.

recv/sendmmsg(), however, can, so create wrappers for those.
2013-08-30 10:33:10 +00:00
rmind
8088e72932 Remove SS_ISCONFIRMING, it is unused and TP4 will not come back. 2013-08-29 17:49:20 +00:00
tls
f41d33c667 Mix in boot time (wherever we may find it). Helps avoid predictable output
on young systems.
2013-08-29 01:05:29 +00:00
tls
b460f1f7d9 Fix rnd_add_* to conform to manual page: allow addition of entropy
with NULL source.
2013-08-29 01:04:49 +00:00
tls
cee9eabe74 Schedule the softint to run once when it's first registered. 2013-08-28 23:40:43 +00:00
riastradh
5287a42d7a Tighten initialization of rnd softints.
- Do rnd_init_softint as early as possible in main, after configure2,
  and before networking is initialized.

- Initialize the rnd_wakeup softint in rnd_init_softint, not lazily in
  rnd_schedule_wakeup.

ok tls
2013-08-28 12:50:18 +00:00
riastradh
b1574872b8 Back out the recent rnd stop-gap/stop-gap/stop-gap measures.
This reverts

sys/dev/rnd_private.h -> r1.1
sys/kern/init_main.c -> r1.450
sys/kern/kern_rndq.c -> r1.14
sys/kern/kern_rndsink.c -> r1.2

Parts of these changes will be added back, and the rndsource
callbacks will be fixed to avoid the lock recursion bug that
motivated the stop-gaps in the first place.

ok tls
2013-08-27 19:30:10 +00:00
riastradh
9726b00ff6 Schedule wakeups asynchronously in rnd_extract_data.
Otherwise, rndsink_request takes rndsinks_lock and calls
rnd_extract_data, which synchronously calls rndsinks_distribute,
which takes rndsinks_lock -> boom.

This is a stop-gap on a stop-gap on a stop-gap; we really ought to
back out all of these stop-gaps, make bcm2835_rng call rnd_add_data
asynchronously to work around the original symptom, and design a real
solution when we have time to sort this mess out properly.
2013-08-27 14:01:35 +00:00
tls
a92176cb34 Temporary fix for previous: avoid recursion through rnd_wakeup_readers()
when entropy first becomes available.
2013-08-26 23:41:24 +00:00
martin
03ee7892c9 Fix a comment and a few minor optimizations:
* elf_check_header() already ensures eh.e_phnum > MAXPHNUM, so do not
   test it again at the call site
 * is_dyn == true implies a successfull call to elf_check_header(eh, ET_DYN),
   so no need to call elf_check_header(eh, ET_EXEC)

From Maxime Villard.
2013-08-26 12:24:10 +00:00
tls
38648a41ea Attempt to resolve locking issues at kernel startup on platforms with
hardware RNGs using the polling mode of operation:

1) Initialize the rng subsystem soft interrupts as early in kernel startup
   as seems safe (we have no MI guarantee that softints are working at all
   until configure2() returns, AFAICT).

   This should have the rnd subsystem able to process events via softint
   before the network subsystem (a notorious early user of entropy) starts.

2) Remove the shortcut calls to rnd_process_events() from
   rnd_schedule_process(), with the result that until the softint is installed
   rnd_process_events() is a NOP.

3) Directly call rnd_process_events() in rnd_extract_data(),
   rnd_maybe_extract(), and rnd_init_softint().  This should suck up any
   samples actually collected as early as possible.
2013-08-25 21:12:56 +00:00
drochner
69aeb16c07 -extend the pcu(9) API by a function which saves all context on the
current CPU, and use it if a CPU is taken offline
-add a bool argument to pcu_discard which tells whether the internal
 "LWP has used the coprocessor" flag should be set or reset. The flag
 is reported by pcu_used_p(). If set, future accesses should use the
 state stored in the PCB. If reset, it should be reset to default.
 The former case is useful for setmcontext().
 With that, it should not be necessary anymore to manage the "FPU used"
 state by an additional MD variable.

approved by matt
2013-08-22 19:50:54 +00:00
pooka
1eb5f70661 type compat header list doesn't need to be autogenerated 2013-08-15 21:16:12 +00:00
matt
a95f2fdeea Ignore REL/RELA if they aren't against a PROGBIT section.
(this causes EXIDX sections to be ignored for ARM).
2013-08-09 05:10:14 +00:00
spz
e124ae9088 Fix an inversion in checking for authorization to drop TCP connections
found (and the obvious fix suggested) by Sander Bos.
2013-08-02 20:00:33 +00:00
drochner
3b7fa5ee7c In unp_externalize, don't do anything if an SCM_RIGHTS control message
was sent with zero file descriptors in it. Otherwise, a zero-length
temporary storage would be allocated which triggers panic on DIAGNOSTIC
kernels (but is harmless for release kernels).
reviewed by Taylor R Campbell
2013-08-01 19:33:21 +00:00
skrll
283149fa94 Fix KASSERT to avoid assumptions about ipl order.
XXX Temporary measure?
2013-07-27 11:19:09 +00:00
skrll
0c66710506 Fix debug code to not use uninitialised variables. 2013-07-23 07:03:16 +00:00
alnsn
cb7134ee1a Revert the previous commit. 2013-07-22 19:43:54 +00:00
njoly
8d578817f8 Remove, in do_sys_renameat(), wrong KASSERTs that check for non NULL
from/to arguments. Such values are correctly handled by later
pathbuf_maybe_copyin() calls, that will fail with EFAULT.

ok from dholland@.
2013-07-20 15:55:57 +00:00
alnsn
f346ebebc0 Always terminate qc_name with NUL because pool_init(9) uses
strcmp(3) to compare wchans.
2013-07-18 19:39:49 +00:00
matt
ca47ca8a7a Make do_sys_utimensat public 2013-07-18 14:06:27 +00:00
matt
c537c2aa1b export do_sys_statat for netbsd32 2013-07-18 13:41:08 +00:00
matt
6e660710b6 Some constification.
Add kcpuset_clone, kcpuset_insersection, kcpuset_remove,
kcpuset_ffs, kcpuset_ffs_intersecting,
kcpuset_atomicly_merge, kcpuset_atomicly_intersect, kcpuset_atomicly_remove
2013-07-17 22:36:26 +00:00
pooka
b666f4df76 regen 2013-07-17 21:21:34 +00:00
pooka
e4ca638e55 Additionally translate daddr_t to int64_t in the rumpvnode interface.
The type daddr_t is not available for all systems (e.g. Linux systems with
musl libc), and exposing it will just cause an unnecessary compilation
failure even if the type is not used.
2013-07-17 21:20:53 +00:00
reinoud
8fd5b25064 Extend generic dirhash to include an empty directory checker based on
the knowledge the dirhash has. This is done by keeping a count of the current
hash entries.
2013-07-07 19:31:26 +00:00
riastradh
a7f90b2fd2 Fix races in /dev/u?random initialization and accounting.
- Push /dev/random `information-theoretic' accounting into cprng(9).
- Use percpu(9) for the per-CPU CPRNGs.
- Use atomics with correct memory barriers for lazy CPRNG creation.
- Remove /dev/random file kmem grovelling from fstat(1).
2013-07-01 15:22:00 +00:00
christos
348fd11f73 remove useless initialization
http://m00nbsd.net/ae123a9bae03f7dde5c6d654412daf5a.html
2013-06-28 15:34:21 +00:00
christos
9a402121dd delete useless initialization
http://m00nbsd.net/ae123a9bae03f7dde5c6d654412daf5a.html
2013-06-28 15:33:40 +00:00
christos
ed4feda3aa don't store random values in retval
http://m00nbsd.net/ae123a9bae03f7dde5c6d654412daf5a.html
2013-06-28 15:32:20 +00:00
matt
6fb884f892 Make sbdrop panic more verbose 2013-06-28 01:23:38 +00:00
matt
a8c0b1a9f4 Make m_copydata panics more verbose 2013-06-28 01:23:05 +00:00
matt
a905a9f307 Convert a KASSERT to a KASSERTMSG 2013-06-28 01:21:45 +00:00
matt
8e19601507 Make page loaning in pipes color aware. 2013-06-28 01:21:06 +00:00
christos
4c8669e4d6 use sbcreatecontrol1() and m_add() instead of open-coding everything, and
getting it slightly wrong.
2013-06-27 18:54:31 +00:00
christos
931cb652f6 Introduce a more general method of sbcreatecontrol, sbcreatecontrol1 that
can take flags (M_WAITOK), and allocate large messages if needed. It also
returns the allocated pointer instead of copying the data to the passed
pointer. Implement sbcreatecontrol() using that.
2013-06-27 18:53:17 +00:00
christos
45ab582ccf - add m_add() that puts an mbuf to end of a chain
- m_append() and m_align() with their family
- remove parameters from prototypes
2013-06-27 17:47:18 +00:00
matt
1b47c955dd If the MBR is a protective MBR, don't bother looking at it. 2013-06-26 18:47:26 +00:00
riastradh
82db4b9858 Replace consttime_bcmp/explicit_bzero by consttime_memequal/explicit_memset.
consttime_memequal is the same as the old consttime_bcmp.
explicit_memset is to memset as explicit_bzero was to bcmp.

Passes amd64 release and i386/ALL, but I'm sure I missed some spots,
so please let me know.
2013-06-24 04:21:19 +00:00
riastradh
5fa1ffb5de Include <sys/lwp.h> for curlwp. 2013-06-24 00:56:21 +00:00
riastradh
6290b0987e Rework rndsink(9) abstraction and adapt arc4random(9) and cprng(9).
rndsink(9):
- Simplify API.
- Simplify locking scheme.
- Add a man page.
- Avoid races in destruction.
- Avoid races in requesting entropy now and scheduling entropy later.

Periodic distribution of entropy to sinks reduces the need for the
last one, but this way we don't need to rely on periodic distribution
(e.g., in a future tickless NetBSD).

rndsinks_lock should probably eventually merge with the rndpool lock,
but we'll put that off for now.

cprng(9):
- Make struct cprng_strong opaque.
- Move rndpseudo.c parts that futz with cprng guts to subr_cprng.c.
- Fix kevent locking.  (Is kevent locking documented anywhere?)
- Stub out rump cprng further until we can rumpify rndsink instead.
- Strip code to grovel through struct cprng_strong in fstat.
2013-06-23 02:35:23 +00:00
christos
816452912b Initialize the rnd softint explicitly via a function late in main. Avoids
LOCKDEBUG panic since softint_establish() was called via wdcintr -> wddone
from an interrupt context and tried to acquire a non-spin mutex.
2013-06-20 23:21:41 +00:00
tls
a5fd1fb2d3 Correct use of entropy estimate when data are extracted from the pool.
The "threshold" value was being inappropriately used to limit how many
bytes could be output even after the estimator said enough bytes had
been put in to meet our minimum security guarantee.

This fixes a panic observed with the automatic test harness and by
msaitoh, where it was not possible to extract the full estimate's worth
of bytes even holding the pool lock across the estimate and extract
calls.
2013-06-13 19:18:00 +00:00
tls
a93435648b Correct misunderstanding in previous: a mutex is not required to protect
the soft interrupt dispatches.
2013-06-13 01:37:03 +00:00
tls
5819ac2839 Convert the entropy pool framework from pseudo-callout-driven to
soft interrupt driven operation.

Add a polling mode of operation -- now we can ask hardware random number
generators to top us up just when we need it (bcm2835_rng and amdpm
converted as examples).

Fix a stall noticed with repeated reads from /dev/random while testing.
2013-06-13 00:55:01 +00:00
pooka
59edb642f4 g/c unused static variable 2013-06-10 14:53:52 +00:00
dholland
9daf003ef2 Stick UFS_ in front of these symbols:
DIRBLKSIZ
   DIRECTSIZ
   DIRSIZ
   OLDDIRFMT
   NEWDIRFMT

Part of PR 47909.

(two stragglers in this commit; oops)
2013-06-09 18:29:25 +00:00
riz
c02fb3c915 Add another field to the SDT_PROBE_DEFINE macro, so our DTrace probes
can named the same as those on other platforms.

For example, proc:::exec-success, not proc:::exec_success.

Implementation follows the same basic principle as FreeBSD's; add
another field to the SDT_PROBE_DEFINE macro which is the name
as exposed to userland.
2013-06-09 01:13:47 +00:00
christos
27fe772ddc IPSEC has not come in two speeds for a long time now (IPSEC == kame,
FAST_IPSEC). Make everything refer to IPSEC to avoid confusion.
2013-06-05 19:01:26 +00:00
christos
850cc78403 use the proper name for kdump pretty-printing. 2013-06-03 23:45:31 +00:00
christos
7b845fa9dc phase 1 of disk geometry cleanup:
- centralize the geometry -> plist code so that we don't have
	  n useless copies of it.
2013-05-29 00:47:48 +00:00
kardel
effe57d37e Extend kernel PPS api with pps_ref_event().
pps_ref_event() allows capturing PPS time stamps
that are not generated at precisely 1Hz (e. g.
by reading a precision clock via callout()).

This extension allows clock drivers to supply PPS
time-stamps and drive the kernel NTP PLL
without the overhead of interrupt-handling and
-processing.
2013-05-26 18:07:42 +00:00
christos
39d23ee140 Make ts2timo(9) always return the absolute start time if the start argument
is present, and handle the TIMER_ABSTIME case in nanosleep1(9).
2013-05-22 16:00:52 +00:00
bouyer
5e3e8c4055 ts2timo(): if TIMER_ABSTIME is set and start is not NULL, initialize
it to 0. Some callers (e.g. nanosleep1()) expect *start to always be
initialized and would use random values from stack otherwise.
While there, remove an always-true conditionnal.
2013-05-21 16:25:55 +00:00
njoly
1f01deacdd Redo case where buf_map is not yet mapped when buf_memcalc() is called
early from pmap_bootstrap(). Makes alpha, and probably others, boot
again.
2013-05-19 11:02:12 +00:00
skrll
08f384533b KNF 2013-05-11 15:44:46 +00:00
pooka
1fddf4baef print more diagnostic info in panic message 2013-05-08 11:08:45 +00:00
mlelstv
220e532cc2 fix locking order mountlist_lock -> mnt_unmounting.
Set IMNT_GONE early to protect against concurrent dounmount()
and vfs_busy() before the mountpoint is removed from
mount list.
2013-04-28 21:34:31 +00:00
christos
8c31c1cdbd fix warning 2013-04-27 20:13:16 +00:00
christos
28b4efbeda turn off debugging 2013-04-27 18:17:37 +00:00
christos
d4724c689e Add debugging info. 2013-04-27 17:13:50 +00:00
mlelstv
060c06be14 Revert change that allowed rw_tryenter(&lock, RW_READER) to recurse
for vfs_busy(). This is no longer necessary.
2013-04-27 08:12:34 +00:00
mlelstv
df5cf9d7a4 Correct umount semantics to return EBUSY when a filesystem is busy
instead of failing filesystem operations with EBUSY when attempting
an umount.
This fixes kern/38141.
2013-04-26 22:27:16 +00:00
msaitoh
50699a2b3c Fix memory leak on the following cases when device attached or detached:
- No one open drvctl.
 - kmem_alloc() failed in devmon_insert().

XXX pullup to both netbsd-5 and netbsd-6.
2013-04-26 09:04:43 +00:00
yamt
c7784f4d97 - make debug size check more strict
- add comments about debug features
2013-04-22 13:22:25 +00:00
yamt
470409eadf whitespace 2013-04-22 13:13:20 +00:00
uebayasi
38d7d2cac5 Whitespace. 2013-04-21 02:44:15 +00:00
christos
ea4869ad3c revert previous, you can run on mips 64 bit binaries with a 32 bit kernel. 2013-04-20 22:28:58 +00:00
christos
c91b1193e7 don't attempt to load elf64 on 32 bit machines 2013-04-20 18:04:41 +00:00
para
9c44086af0 addresses PR/47512
properly return NULL for failed allocations not 0x8 with size checks enabled.
2013-04-16 21:13:38 +00:00
skrll
38fd17d91a Fix PAX build. 2013-04-09 07:39:01 +00:00
skrll
94a59cc1db Remove some set but unused variables 2013-04-08 21:12:33 +00:00
chs
3f6811bc27 don't overwrite the CTF info with the symbol table. 2013-04-07 00:49:45 +00:00
rmind
2540bef8df xc_highpri: fix assert. 2013-04-07 00:31:40 +00:00
martin
9d0957eba7 Provide binary compatibility for architectures that (erroneously) had
a larger MAXPARTITIONS value (and thus larger struct disklabel).
2013-04-04 12:51:39 +00:00
christos
11c04fdfa0 undo previous and move the test to the timeout function since 0,0 means
disable timer/interval.
2013-04-01 16:37:22 +00:00
christos
7f7fe0a2eb do the timeout test centrally. 2013-04-01 15:46:46 +00:00
martin
cf1df18e92 ts2timo: return ETIMEDOUT instead of failing an assertion when the
calculated difference to the target time is zero.
2013-04-01 12:31:34 +00:00
christos
2c8702f59e instead of doing the tests twice fix the *fix() routines to return ETIMEDOUT
if seconds are negative. Accorting to TOG, this is not an error as linux
claims. Also make an assert stricter.
2013-03-31 16:46:29 +00:00
christos
463c93b4e7 always return immediately on error, and if we passed negative seconds,
return with 0.
2013-03-31 16:45:06 +00:00
martin
573f2396f8 Move clock_gettime1() to subr_time.c (which is included in rump kernels) 2013-03-29 10:34:12 +00:00
christos
698e9d4d95 regen 2013-03-29 01:10:13 +00:00
christos
4cec95f0ea Centralize the computation of struct timespec to the int timo.
Make lwp_park take the regular arguments for specifying what kind
of timeout we supply like clock_nanosleep(), namely clockid_t and flags.
2013-03-29 01:08:17 +00:00
tls
88ad351cb1 Re-fix 'fix' for SA-2013-003. Because the original fix evaluated a flag
backwards, in low-entropy conditions there was a time interval in which
/dev/urandom could still output bits on an unacceptably short key.  Output
from /dev/random was *NOT* impacted.

Eliminate the flag in question -- it's safest to always fill the requested
key buffer with output from the entropy-pool, even if we let the caller
know we couldn't provide bytes with the full entropy it requested.

Advisory will be updated soon with a full worst-case analysis of the
/dev/urandom output path in the presence of either variant of the
SA-2013-003 bug.  Fortunately, because a large amount of other input
is mixed in before users can obtain any output, it doesn't look as dangerous
in practice as I'd feared it might be.
2013-03-28 18:06:48 +00:00
christos
fd5d831f1e downgrade an error to debug. 2013-03-24 22:06:37 +00:00
plunky
5ec364d4d9 C99 section 6.7.2.3 (Tags) Note 3 states that:
A type specifier of the form

	enum identifier

  without an enumerator list shall only appear after the type it
  specifies is complete.

which means that we cannot pass an "enum vtype" argument to
kauth_access_action() without fully specifying the type first.
Unfortunately there is a complicated include file loop which
makes that difficult, so convert this minimal function into a
macro (and capitalize it).

(ok elad@)
2013-03-18 19:35:35 +00:00
para
82aa1e7edd calculate vnode cache size based on the resource it gets allocated from
this stops setting kern.maxvnodes to high so it exhausts available space in kmem

http://mail-index.netbsd.org/tech-kern/2013/03/08/msg015095.html
2013-03-18 13:36:21 +00:00
gdt
de83e1acfd Add comment questioning lock asymmetry. 2013-03-14 19:13:17 +00:00
yamt
37fc08318c revert rev.1.37 for now.
PR/47634 from Ryo ONODERA.
while i have no idea how this change can break bge,
i don't have hardware and/or time to investigate right now.
2013-03-12 23:16:31 +00:00
pooka
83a2a556bf In pool_cache_put_slow(), pool_get() can block (it does mutex_enter()),
so we need to retry if curlwp took a context switch during the call.
Otherwise, CPU-local invariants can get screwed up:

    panic: kernel diagnostic assertion "cur->pcg_avail == cur->pcg_size" failed

This is (was) very easy to reproduce by just running:

  while : ; do RUMP_NCPU=32 ./a.out ; done

where a.out only calls rump_init().  But, any situation there's contention
and a pool doesn't have emptygroups would do.
2013-03-11 21:37:54 +00:00
pooka
55246528e8 At least pretend to not leak memory in sysctl initialization.
This commit message would be longer if it included opinions about
sysctllog vs. CTLFLAG_PERMANENT ...
2013-03-10 17:55:42 +00:00
christos
38cec6f03a more detailed/consistent error messages. 2013-03-10 04:25:06 +00:00
apb
f92c0e46b0 Properly differentiate between infinite timeout and zero timeout.
Local variable timo = -1 is used for zero timeout (non blocking mode).

Fixes PR 47625 from anthony.mallet
2013-03-08 09:32:59 +00:00
apb
7c5d63e1c6 In the timeout passed to sigtimedwait, NULL means an infinite timeout,
and {.tv_sec = 0, .tv_nsec=0} means do not block at all.  Add a comment
saying so.  The code incorrectly treats them both as an infinite timeout,
and that is not fixed by this commit.
2013-03-08 08:48:38 +00:00
apb
90c6b7a188 also comment on the meaning of timo=0 for cv_timedwait_sig. 2013-03-08 08:36:37 +00:00
apb
e6dad85522 Add comments saying that a cv_timedwait and sleepq_block interpret
timo = 0 as an infinite timeout.  This is already documented in the
cv_timedwait(9) man page, and there is no sleeq_block(9) man page.
2013-03-08 08:35:09 +00:00
pooka
1578b4b049 make rump kernel syscalls through curproc->p_emul instead of rump_sysent 2013-03-07 19:17:46 +00:00
matt
17f82b93c2 Add a kern.configname sysctl object. 2013-03-07 18:02:54 +00:00
yamt
69f842b1d9 - use scaled calculations for avgcount
- sched_balance: account lwp which is currently running
- sched_balance: skip cpus w/o migratable lwps
2013-03-06 11:25:01 +00:00
yamt
0f92d1cdeb update comments 2013-03-06 11:20:10 +00:00
christos
e5a1aef5b9 remove extra chatty messages 2013-03-05 03:04:00 +00:00
christos
2a0d04a751 more debugging 2013-03-03 16:55:26 +00:00
pgoyette
e8ac3e27f9 Move boottime50 and its associated sysctl into the compat module. As
noted on tech-kern.  Should fix PR/47579.

OK christos@

Will request pull-up to 6.0 in a few days.
2013-02-21 01:39:54 +00:00
martin
b6d45f2118 Stopgap fix to make rump cooperate with pserialize, may be revisited later.
Patch from pooka, ok: rmind. No related regressions in a complete atf test
run (which works again with this, even on non x86 SMP machines).
2013-02-19 11:20:17 +00:00
christos
58523baaac PR/47569: Valery Ushakov: SOCK_NONBLOCK does not work because it does not
set SS_NBIO.
XXX: there are too many flags that mean the same thing in too many places,
and too many flags that mean the same thing and are different.
2013-02-14 21:57:58 +00:00
riastradh
322ad729b3 Fix some screw cases in cmsg file descriptor passing.
- Don't leave garbage in the control buffer if allocating file
descriptors fails in unp_externalize.

- Scrub the space between CMSG_LEN and CMSG_SPACE to avoid kernel
memory disclosure in unp_externalize.

- Don't read past cmsg_len when closing file descriptors that
couldn't get delivered, in free_rights.

ok christos
2013-02-14 01:00:07 +00:00
hannken
9f9ac3cb83 Make the spec_node table implementation private to spec_vnops.c.
To retrieve a spec_node, two new lookup functions (by device or by mount)
are implemented.  Both return a referenced vnode, for an opened block device
the opened vnode is returned so further diagnostic checks "vp == ... sd_bdevvp"
will not fire.  Otherwise any vnode matching the criteria gets returned.

No objections on tech-kern.

Welcome to 6.99.17
2013-02-13 14:03:48 +00:00
christos
0c9d7240de Can you please tell us the module name that had the wrong version? Thanks. 2013-02-12 19:14:50 +00:00
apb
bb0eb3bd82 Move the DDB-specific part of vpanic() to a new db_panic() function,
defined in ddb/db_panic.c and declared in ddb/ddbvar.h.  No functional
change.

The copyright years in db_panic.c are the years in which changes were
made to the code that has now been moved to db_panic.c.  No pre-NetBSD
copyright notice is needed because revision 1.12 of subr_prf.c had only
the trivial "#ifdef DDB \\ Debugger(); \\ #endif"
2013-02-10 11:04:19 +00:00
njoly
5fb876b9e0 Fix LOCKDEBUG build. 2013-02-09 11:04:32 +00:00
christos
4a90750c00 CID/980000: missing va_end() 2013-02-09 01:20:08 +00:00
christos
752baf2503 why didn't gcc find the formatting error? 2013-02-09 00:32:12 +00:00
christos
a67c3c8971 printflike maintenance. 2013-02-09 00:31:21 +00:00
skrll
8668323de3 Fix release of vmem_btag_lock (don't release twice in error path) 2013-02-08 09:30:01 +00:00
rmind
8ba0fc0dab - pserialize_switchpoint: check for passing twice, not more than needed.
- pserialize_perform: avoid a possible race with softint handler.
Reported by hannken@.
2013-02-07 23:37:58 +00:00
matt
06924b3fe7 Make the inclusion of <sys/cprng.h> a private matter for sysctl. No reason
to expose the rest of the kernel to it.
2013-02-02 14:02:09 +00:00
joerg
8f31aaa01e Add sockaddr_format to ease debugging code dealing with socket
addresses.
2013-01-31 14:30:47 +00:00
para
8e65446416 fix the sysctl_setup_func typedef 2013-01-29 23:00:31 +00:00
para
19d40baab3 make vmem(9) ready to be used early during bootstrap to replace extent(9)
pass memory for vmem structs into the initialization function and
do away with the static pool of vmem structs.
remove special bootstrapping of the quantum cache pools of the kmem_va_arena
as memory for pool_caches is allocated via pool_allocator_meta which is
fully operational at this point.
2013-01-29 21:26:24 +00:00
christos
a5d450d94b remove useless cast (Richard Hansen) 2013-01-29 19:56:43 +00:00
tls
f974bd2506 Tweak the previous a little: don't be so hasty to declare sources "fast"
and process them in bulk, but, always declare hardware RNGs and VM system
sources as "fast" since in these cases efficiency is important and data
will be abundant.
2013-01-26 22:22:07 +00:00
riastradh
80ae1f3144 Assert equality, not assignment, in selrecord.
Code inspection suggests that this fix is not likely to reveal any
latent problems.
2013-01-26 19:38:17 +00:00
tls
d391d2bf9a Rather than holding samples from each source until we have 64 at a time to
process, process them ASAP for low-rate sources, and for all sources if we
have not yet acquired initial entropy.
2013-01-26 19:05:11 +00:00
tls
b4e58a0a00 Fix a security issue: when we are reseeding a PRNG seeded early in boot
before we had ever had any entropy, if something else has consumed the
entropy that triggered the immediate reseed, we can reseed with as little
as sizeof(int) bytes of entropy.
2013-01-26 16:05:34 +00:00
para
39dafdefa9 revert previous commit not yet fully functional, sorry 2013-01-26 15:18:00 +00:00
para
cca299e0a3 make vmem(9) ready to be used early during bootstrap to replace extent(9).
pass memory for vmem structs into the initialization functions and
do away with the static pools for this.
factor out the vmem internal structures into a private header.
remove special bootstrapping of the kmem_va_arena as all necessary memory
comes from pool_allocator_meta wich is fully operational at this point.
2013-01-26 13:50:33 +00:00
riastradh
a4e65a34a6 Assert equality, not assignment, in rnd_hwrng_test.
Not tested, but by inspection, the only caller, rnd_process_events,
clearly guarantees the condition.
2013-01-24 14:23:45 +00:00
christos
131cc4df10 It is useless to check for sigcontext_vec and compat module loading for
PK_32 processes. The correct modules are already loaded, otherwise how
is the process running?
2013-01-22 01:45:59 +00:00
hannken
037fec6e9b Replace the rwlock based implementation with passive serialization
from pserialize(9) and mutex / condvar.

The fast paths (fstrans_start/fstrans_done on a file system not
suspended or suspending and fscow_run with no change pending) now
run without locks or other atomic operations.  Suspension and cow
handler insertion and removal is done with mutex / condvars.

The API remains unchanged.
2013-01-21 09:14:01 +00:00
rmind
d797bd3dba - physmap_map, physmap_map_fini: pmap_update() must be performed before
freeing the VA; otherwise there is a window when it can be re-used while
  stale TLB entries may be present.
- physmap_fill: use MIN() instead of min(), since vsize_t is used.
- Add RCS ID comment while here and prevent physmap.h inclusion in userland.
2013-01-19 01:04:51 +00:00
rmind
d3cb55ca37 Add m_ensure_contig() routine, which is equivalent to m_pullup, but does not
destroy the mbuf chain on failure (it is kept valid).
2013-01-19 00:51:52 +00:00
matt
beae54ff5a Contain support routines used to create and destroy lists of physical pages
from lists of pages or ranges of virtual address.  By using these physical
maps, the kernel can avoid mapping physical I/O in the kernel's address space
in most cases.
2013-01-18 06:42:16 +00:00
pooka
6f7f25db9f Include rumpuser_port.h in rump_syscalls.c when compiled for librumpclient 2013-01-17 21:30:30 +00:00
matt
4ffdc4bda5 Add a separate bool to indicate a symbol table has been loaded.
ksym_initted indicates whether the kmutex has been initted or not.
Add __cacheline_aligned to the kmutex.
2013-01-17 14:36:36 +00:00
msaitoh
394ebb1bff Set resource limit. The rnd_process_events() function is called every tick
and process the sample queue. Without limitation, if a lot of rnd_add_*()
are called, all kernel memory may be eaten up.
2013-01-16 06:45:24 +00:00
dholland
ab137c90f7 Revert defective O_SEARCH implementation committed by manu@ along with
the *at system calls on November 18th of last year. Reasons to revert
it include:
   - it is incorrect in a whole variety of ways (but fortunately, one
     of them is that the missing and improper permission checks have
     no net effect);
   - it was committed without review or discussion;
   - core ruled that all the new O_* flags pertaining to the *at calls
     needed to wait until their semantics could be clarified.

manu was asked to revert it on these grounds but has ignored the request.

I have left O_SEARCH defined and visible and made open() explicitly
ignore it. This way, most code that tries to use it will continue to
build and run. I've also arranged lib/libc/c063/t_o_search.c so that
the tests that make use of the O_SEARCH semantics will disappear until
O_SEARCH comes back, and fixed some mistakes and/or incorrect hacks
that were causing some of these to succeed despite the broken O_SEARCH
implementation.
2013-01-13 08:15:02 +00:00
mlelstv
20911e3ae3 Also report attachment of pseudo-devices to userland. 2013-01-10 10:15:59 +00:00
rmind
ef8a266f76 - softint_dispatch: perform pserialize(9) switchpoint when softintr processing
finishes (without blocking).  Problem reported by hannken@, thanks!
- pserialize_read_enter: use splsoftserial(), not splsoftclock().
- pserialize_perform: add xcall(9) barrier as interrupts may be coalesced.
2013-01-07 23:21:31 +00:00