Commit Graph

8364 Commits

Author SHA1 Message Date
hannken
312d89f0de Change bread() and breadn() to never return a buffer on
error and modify all callers to not brelse() on error.

Welcome to 6.99.16

PR kern/46282 (6.0_BETA crash: msdosfs_bmap -> pcbmap -> bread -> bio_doread)
2012-12-20 08:03:41 +00:00
dsl
682ac0728a The lwp_id in a process are supposed to be non-zero and unique.
This stops being true once a process has allocated (and freed) 2^32 lwps.
(I've not timed it!)
There is also some code lurking (eg ld.elf_so) that doesn't expect the
  high be be set.
Once the lwp_id wraps, scan the list to find the first free id higher
  than the last one allocated.
Maintain the sort order to make the possible.
Note that if some lwp (but not all) are allocated numbers from the pid
  space it will go horribly wrong.
Tested by setting the limit to 128 and getting firefox to create threads.
2012-12-16 22:21:03 +00:00
pooka
8c45e7bd31 Adjust unmount prints to avoid "boothowto = AB_VERBOSE" from being
cluttered like this:

unmounting file systems...unmounted kernfs on /kern type kernfs
unmounted etcetc.
 done

tested: ~AB_VERBOSE, AB_VERBOSE, -DDEBUG
2012-12-14 18:39:48 +00:00
yamt
38363c022a rw_vector_enter: reload owner in the case of no hand-off.
this fixes crashes in rw_oncpu().
2012-12-12 14:53:01 +00:00
pooka
37ca5a0657 Signed overflow is undefined behavior, and one version of gcc
clearly tells us:

	kern_rate.c:98: warning: assuming signed overflow does not
	occur when assuming that (X + c) > X is always true

Check value against INT_MAX instead.  Also, for good measure throw
in a __predict() to flag the assumed common case.
2012-12-12 11:10:56 +00:00
hannken
e0783eff3d Try to coalesce writes to the journal in MAXPHYS sized and aligned blocks.
Speeds up wapbl_flush() on raid5 by a factor of 3-4.

Discussed on tech-kern.

Needs pullup to NetBSD-6.
2012-12-08 07:24:42 +00:00
chs
11c69f2d20 adapt the cyclic module and profile dtrace provider to netbsd.
for now, just hook the cyclic callback into hardclock().
2012-12-02 01:05:16 +00:00
mbalmer
e3f283b63f Fix misspelling: accommodate is a long enough word to have room for two 'c's
and two 'm's.
2012-12-01 11:41:49 +00:00
njoly
6be7ae0a4a Apply fix from hannken to ensure that VOP_ACCESS() is called on a
locked vnode for fd_nameiat(), fd_nameiat_simple() and do_sys_openat().
Fix both PR/47226 and PR/47255.
2012-11-30 13:26:37 +00:00
christos
610818b251 expose ksem_t for fstat(8), and implement stat for future reference. 2012-11-25 01:05:04 +00:00
christos
4669372c9c - initialize kn_id
- in close, invalidate f_data and f_type early to prevent accidental re-use
- add a DIAGNOSTIC for when we use unsupported fd's and a KASSERT for f_event
  being NULL.
2012-11-24 15:14:32 +00:00
christos
7e72d438b2 Return EOPNOTSUPP for fnullop_kqfilter to prevent registration of unsupported
fds. XXX: We should really fix the fd's to be supported in the future.
Unsupported fd's have a NULL f_event, so registering crashes the kernel with
a NULL function dereference of f_event.
2012-11-24 15:07:44 +00:00
msaitoh
386462fd73 Pass correct wait channel string. 2012-11-20 11:06:27 +00:00
martin
daab85cca7 Use copyout to copy data from kernel out to userland!
Fixes PR kern/47217.
2012-11-19 15:01:17 +00:00
pooka
78b801a3d2 remove unused variable 2012-11-18 18:36:01 +00:00
manu
a76c1cc17f Add most system calls for POSIX extended API set, part 2, with test cases:
faccessat(2), fchmodat(2), fchownat(2), fstatat(2), mkdirat(2), mkfifoat(2),
mknodat(2), linkat(2), readlinkat(2), symlinkat(2), renameat(2), unlinkat(2),
utimensat(2), openat(2).

Also implement O_SEARCH for openat(2)

Still missing:
- some flags for openat(2)
- fexecve(2) implementation
2012-11-18 17:41:51 +00:00
chs
2c889486d3 make ksyms structures not depend on KDTRACE_HOOKS.
always include a CTF section, even though it might be empty.
this fixes savecore's generated kernel symbol table files.
2012-11-18 00:06:56 +00:00
joerg
f611942e77 Unbreak the NOTE_TRACK event of EVFILT_PROC. When attaching to the child
process, proc_find can't be used as the child is still in state SIDL.
2012-11-17 21:55:24 +00:00
hannken
0253e4d99a wapbl_biodone: Release the buffer before reclaiming the log.
wapbl_flush() may wait for the log to become empty and
    all buffers should be unbusy before it returns.
2012-11-17 10:10:17 +00:00
pooka
e51fe9c308 kill some -Wunused-but-set-variable warnings 2012-11-13 20:10:02 +00:00
chs
b88949941d in pmf_system_shutdown(), don't do anything if we're panicing.
this prevents a hang trying to shut down other CPUs on x86,
and in general we could be called in any context from a panic
so it's best to skip unnecessary operations in that case.
2012-11-13 14:08:07 +00:00
hannken
a672ee4873 Bring back Manuel Bouyers patch to resolve races between vget() and vrelel()
resulting in vget() returning dead vnodes.
It is impossible to resolve these races in vn_lock().

Needs pullup to NetBSD-6.
2012-11-12 11:00:07 +00:00
christos
53627aeceb If you are going to dick around with p_stat, remember to put it
back so that spawn processes with attributes don't end up starting
up stopped!
XXX: pullup to 6.
2012-11-08 17:40:46 +00:00
para
ab1daf988f make DEBUG kernels buildable again (typo) 2012-11-05 21:35:28 +00:00
dholland
b496a9dc26 Rename the new ni_startdir (the slot used to hold the starting point
for openat() and friends) to ni_atdir to avoid confusion with a
previously existing (and, alas, still documented) ni_startdir field
that meant something else entirely.
2012-11-05 19:06:26 +00:00
dholland
35ed690545 Excise struct componentname from the namecache.
This uglifies the interface, because several operations need to be
passed the namei flags and cache_lookup also needs for the time being
to be passed cnp->cn_nameiop. Nonetheless, it's a net benefit.

The glop should be able to go away eventually but requires structural
cleanup elsewhere first.

This change requires a kernel bump.
2012-11-05 17:27:37 +00:00
dholland
1617a81dd1 Disentangle the namecache from the internals of namei.
- Move the namecache's hash computation to inside the namecache code,
instead of being spread out all over the place. Remove cn_hash from
struct componentname and delete all uses of it.

 - It is no longer necessary (if it ever was) for cache_lookup and
cache_lookup_raw to clear MAKEENTRY from cnp->cn_flags for the cases
that cache_enter already checks for.

 - Rearrange the interface of cache_lookup (and cache_lookup_raw) to
make it somewhat simpler, to exclude certain nonexistent error
conditions, and (most importantly) to make it not require write access
to cnp->cn_flags.

This change requires a kernel bump.
2012-11-05 17:24:09 +00:00
njoly
1ebbf7b605 Move rusage computation to a new getrusage1() function. Adjust all
compat/emulations to make use of it.
2012-11-03 23:22:21 +00:00
matt
1f0bc47f9c Use kmem_intr_alloc/kmem_intr_free 2012-10-27 17:34:07 +00:00
chs
cbab9cadce split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
2012-10-27 17:17:22 +00:00
tls
9d8dce6eca Fix hardware RNGs -- accept their entropy estimates *rather than* using
timestamps to estimate the entropy of their input.  I'd accidentally
made it so no entropy was ever counted from them at all.
2012-10-27 01:29:02 +00:00
apb
b6366e94c8 Set tp->t_dev to the correct dev_t value in both ptmopen and ptsopen.
Depending on how the pty had been opened, t_dev could previously have
been set to NODEV.  This was probably harmless before, but it caused the
compatibility handler for the COMPAT_60_TIOCPTSNAME ioctl to fail for
ptys that were allocated by screen(1), but only if this was the first
time that the pty had ever been used.
2012-10-20 00:21:10 +00:00
apb
f6297d7676 Add COMPAT_60 versions of the TIOCPTMGET and TIOCPTSNAME ioctls. 2012-10-19 16:55:22 +00:00
riastradh
8db30059ca No, we can't elide the fs-wide rename lock for same-directory rename.
rename("a/b", "a/c") and rename("a/c/x", "a/b/y") will deadlock.

Darn.
2012-10-19 02:07:22 +00:00
para
fc7d559bb7 bring comment up to reality
kmem_map => kmem_arena
2012-10-18 19:33:38 +00:00
drochner
035939be53 put binary compatibility support for the old AMD-only CPU microcode
update API inside COMPAT_60
2012-10-17 20:19:55 +00:00
christos
eac5a1b990 remove KERN_USRSTACK 2012-10-14 20:56:55 +00:00
dholland
ebc30f9e8b Replace hack implementation of NDAT() for "nameiat" with a proper one.
(This change requires a kernel bump.)
2012-10-13 17:46:50 +00:00
christos
c6f0835de6 add KERN_USRSTACK (this is not dynamically defined for FreeBSD compatibility) 2012-10-13 15:35:55 +00:00
rmind
2440dfcd19 Update comment on vnode life-cycle a little. 2012-10-12 21:10:55 +00:00
riastradh
a807072402 Disentangle do_sys_rename.
Elide the fs-wide rename lock for single-directory renames.  This
required changing the order of lookups, so that we know what the
directories are before we lock the nodes.

Clean up error branches, explain why various nonsense happens and
what it does and doesn't do, and note some of what needs to change.
2012-10-12 02:37:20 +00:00
dholland
03f1fbd862 In layer_lookup(), clear *vpp before returning EROFS, as otherwise a
stale value can be returned and this causes a diagnostic panic in
namei.

In relookup(), clear *vpp before calling VOP_LOOKUP, as is done in
lookup_once(), as an additional precautionary measure.

(in theory both of these fixes are not required together)

Should fix PR 47040.
2012-10-10 06:55:25 +00:00
dholland
4fc6b20089 Add namei-level support for openat() and friends. The way you do it is
by calling NDAT(&nd, dirvp) after NDINIT().

Right now the implementation is vile and unspeakable to avoid changing
the kernel ABI; this way we can get openat() and friends into 6.1. I
will rectify the mess and bump the kernel once things are working.
2012-10-08 23:43:33 +00:00
dholland
eee667d033 Tidy up namei internals to allow openat() and friends without getting
tangled in nfsd's special cases.
2012-10-08 23:41:39 +00:00
pooka
e30ea15ccf put all kern socket sysctls in the same place 2012-10-08 19:20:45 +00:00
matt
320d4922ba If the workqueue is using a prio less than PRI_KERNEL, make sure KTHREAD_TS
is used when creating the kthread.
2012-10-07 22:16:21 +00:00
christos
f2a172afbf Avoid crash dereferencing a NULL fp in fd_affix() in unp_externalize
caused by the sequence of passing two fd's with two sendmsg()'s,
then doing a read() and a recvmsg(). The read() calls dom_dispose()
which discards both messages in the mbuf, and sets the fp's in the
array to NULL. Linux dequeues only one message per read() so the
second recvmsg() gets the fd from the second message.  This fix
just avoids the NULL pointer de-reference, making the second
recvmsg() to fail. It is dubious to pass fd's with stream sockets
and expect mixing read() and recvmsg() to work. Plus processing
one control message per read() changes the current semantics and
should be examined before applied. In addition there is a race between
dom_externalize() and dom_dispose(): what happens in a multi-threaded
network stack when one thread disposes where the other externalizes
the same array?

NB: Pullup to 6.
2012-10-06 22:58:08 +00:00
mlelstv
582d3a41a2 Add sanity check to sysctl_kern_maxvnodes. 2012-10-03 07:22:59 +00:00
mlelstv
aac856dfae No longer determine availability of ISO and UDF partitions, we default
to allow access to both. Only use a found ISO header to access the
correct session.
2012-10-03 07:05:51 +00:00
mlelstv
2897603d95 Don't call ureadc() with a spinlock held because ureadc() may fault when
writing to userspace.
2012-10-02 23:10:34 +00:00