Re: CVS commit: src/sys/kern

2010-01-15 Thread Manuel Bouyer
On Fri, Jan 15, 2010 at 01:09:48AM +0200, Antti Kantee wrote:
 On Thu Jan 14 2010 at 22:41:53 +, Manuel Bouyer wrote:
  Module Name:src
  Committed By:   bouyer
  Date:   Thu Jan 14 22:41:53 UTC 2010
  
  Modified Files:
  src/sys/kern: vfs_subr.c
  
  Log Message:
  Remove KASSERT(vp-v_usecount == 1) in getnewvnode() and ungetnewvnode().
  Another process could be vget()ing the vnode and bump v_usecount while
  getcleanvnode() is vclean()ing it (as vclean drops the interlock).
  vget() will then wait for VI_XLOCK or VI_FREEING to clear; and we could test
  this assertion while the other process is still slepping. We could even
  end up in ungetnewvnode() before this other process got a chance to run.
 
 Why doesn't the v_usecount == 1 check in getcleanvnode() work?

You're right; it's not while the first thread is in vclean() that the
second can grab a reference which will cause this issue.

Then it's probably when getcleanvnode() drops the interlock after
vclean(). This means something can add a reference to a clean vnode,
this is bad. The KASSERT() is probably right.

ufs_ihashget() looks safe for this, it drops the ufs_ihash_lock after
getting the interlock.
cache_lookup() also grabs the interlock before releasing ncp-nc_lock,
so it should be OK.
Any other place where a vnode could be cached without holding a
reference count ?

There's also UVM which could be the cause of this as v_usecount is the
uobj's reference count. But this is another can of worm, and I don't know
how to check this.

-- 
Manuel Bouyer bou...@antioche.eu.org
 NetBSD: 26 ans d'experience feront toujours la difference
--


CVS commit: src/tools/compat

2010-01-15 Thread Aleksej Saushev
Module Name:src
Committed By:   asau
Date:   Fri Jan 15 11:26:25 UTC 2010

Modified Files:
src/tools/compat: configure.ac nbtool_config.h.in

Log Message:
Test for sys/endian.h and provide HAVE_SYS_ENDIAN_H.
Fixes FreeBSD hosted builds (PR 42440 and PR 42470).

Approved by dholland.


To generate a diff of this commit:
cvs rdiff -u -r1.70 -r1.71 src/tools/compat/configure.ac
cvs rdiff -u -r1.23 -r1.24 src/tools/compat/nbtool_config.h.in

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/tools/compat

2010-01-15 Thread Aleksej Saushev
Module Name:src
Committed By:   asau
Date:   Fri Jan 15 11:27:01 UTC 2010

Modified Files:
src/tools/compat: configure

Log Message:
Regenerate.


To generate a diff of this commit:
cvs rdiff -u -r1.70 -r1.71 src/tools/compat/configure

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



Re: CVS commit: src/sys/kern

2010-01-15 Thread Manuel Bouyer
On Fri, Jan 15, 2010 at 12:14:56PM +0100, Manuel Bouyer wrote:
   Log Message:
   Remove KASSERT(vp-v_usecount == 1) in getnewvnode() and ungetnewvnode().
   Another process could be vget()ing the vnode and bump v_usecount while
   getcleanvnode() is vclean()ing it (as vclean drops the interlock).
   vget() will then wait for VI_XLOCK or VI_FREEING to clear; and we could 
   test
   this assertion while the other process is still slepping. We could even
   end up in ungetnewvnode() before this other process got a chance to run.
  
  Why doesn't the v_usecount == 1 check in getcleanvnode() work?
 
 You're right; it's not while the first thread is in vclean() that the
 second can grab a reference which will cause this issue.
 
 Then it's probably when getcleanvnode() drops the interlock after
 vclean(). This means something can add a reference to a clean vnode,
 this is bad. The KASSERT() is probably right.
 
 ufs_ihashget() looks safe for this, it drops the ufs_ihash_lock after
 getting the interlock.
 cache_lookup() also grabs the interlock before releasing ncp-nc_lock,
 so it should be OK.
 Any other place where a vnode could be cached without holding a
 reference count ?

There is the mount list. getnewvnode() will remove it from the mount
list after the KASSERT() so it looks like a good candidate.
Maybe the issue is in qsync() and is related to kern/42205 (a DIAGNOSTIC
kernel will panic on the KASSERT, a non-DIAGNOSTIC one would dereference a
NULL pointer in the qsync() thread).
vlean() sets vp-v_tag to VT_NON but doesn't clear v_type. The qsync()
thread could find the vnode in the mount list, think it's valid and vget it
while the getcleanvnode() thread has just released v_interlock and
not set v_type to VNON yet.
The last patch I propose in kern/42205 would fix this as well.

I did a quick check of other 'v_type == VNON', they look safe.

-- 
Manuel Bouyer bou...@antioche.eu.org
 NetBSD: 26 ans d'experience feront toujours la difference
--


CVS commit: src/sys/arch/sparc64/include

2010-01-15 Thread Takeshi Nakayama
Module Name:src
Committed By:   nakayama
Date:   Fri Jan 15 15:02:48 UTC 2010

Modified Files:
src/sys/arch/sparc64/include: pte.h

Log Message:
Fix typo in previous.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/sparc64/include/pte.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/sparc64/include

2010-01-15 Thread Takeshi Nakayama
Module Name:src
Committed By:   nakayama
Date:   Fri Jan 15 15:05:02 UTC 2010

Modified Files:
src/sys/arch/sparc64/include: psl.h

Log Message:
Add function names defined by macro in comment for reference.


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/sys/arch/sparc64/include/psl.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/rump/net/rumptest

2010-01-15 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Fri Jan 15 18:38:16 UTC 2010

Modified Files:
src/sys/rump/net/rumptest: rumptest_net.c

Log Message:
print mbuf statistics a few times.  incidentally, can be used to
test percpu.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/rump/net/rumptest/rumptest_net.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/crypto/dist/ipsec-tools/src/setkey

2010-01-15 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Fri Jan 15 19:18:51 UTC 2010

Modified Files:
src/crypto/dist/ipsec-tools/src/setkey: setkey.8

Log Message:
Use .%U instead of .%O for URLs.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/crypto/dist/ipsec-tools/src/setkey/setkey.8

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/faithd

2010-01-15 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Fri Jan 15 19:19:32 UTC 2010

Modified Files:
src/usr.sbin/faithd: faithd.8

Log Message:
Use .%U for URLs instead of .%O.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/usr.sbin/faithd/faithd.8

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/share/man/man4

2010-01-15 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Fri Jan 15 19:23:38 UTC 2010

Modified Files:
src/share/man/man4: gif.4

Log Message:
Use .%U. Give full URL for draft-ietf-ipsec-ecn-02.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/share/man/man4/gif.4

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/share/man/man4

2010-01-15 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Fri Jan 15 19:24:49 UTC 2010

Modified Files:
src/share/man/man4: acpi.4 atw.4 aue.4 awi.4 axe.4 cas.4 cdce.4 faith.4
gem.4 hme.4 ipw.4 iwi.4 re.4 rtw.4 sk.4 slhci.4 udav.4 wi.4 wpi.4
src/share/man/man4/man4.i386: ndis.4

Log Message:
Use .%U instead of .%O for URLs.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/share/man/man4/acpi.4
cvs rdiff -u -r1.11 -r1.12 src/share/man/man4/atw.4
cvs rdiff -u -r1.16 -r1.17 src/share/man/man4/aue.4 src/share/man/man4/iwi.4
cvs rdiff -u -r1.27 -r1.28 src/share/man/man4/awi.4
cvs rdiff -u -r1.5 -r1.6 src/share/man/man4/axe.4 src/share/man/man4/cdce.4 \
src/share/man/man4/ipw.4
cvs rdiff -u -r1.2 -r1.3 src/share/man/man4/cas.4 src/share/man/man4/udav.4
cvs rdiff -u -r1.13 -r1.14 src/share/man/man4/faith.4 src/share/man/man4/sk.4
cvs rdiff -u -r1.9 -r1.10 src/share/man/man4/gem.4
cvs rdiff -u -r1.8 -r1.9 src/share/man/man4/hme.4
cvs rdiff -u -r1.12 -r1.13 src/share/man/man4/re.4 src/share/man/man4/wpi.4
cvs rdiff -u -r1.4 -r1.5 src/share/man/man4/rtw.4
cvs rdiff -u -r1.7 -r1.8 src/share/man/man4/slhci.4
cvs rdiff -u -r1.37 -r1.38 src/share/man/man4/wi.4
cvs rdiff -u -r1.2 -r1.3 src/share/man/man4/man4.i386/ndis.4

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/kern

2010-01-15 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Fri Jan 15 19:28:26 UTC 2010

Modified Files:
src/sys/kern: vfs_subr.c

Log Message:
Revert previous. The KASSERT() is right and my analysis is wrong,
as pointed out by po...@.


To generate a diff of this commit:
cvs rdiff -u -r1.396 -r1.397 src/sys/kern/vfs_subr.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/games/dab

2010-01-15 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Fri Jan 15 19:39:10 UTC 2010

Modified Files:
src/games/dab: dab.6

Log Message:
Use .%U instead of .%O for URLs.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/games/dab/dab.6

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/ufs/ufs

2010-01-15 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Fri Jan 15 19:46:35 UTC 2010

Modified Files:
src/sys/ufs/ufs: ufs_quota.c

Log Message:
vclean() actually sets v_tag to VT_NON but doesn't touch v_type.
getcleanvnode() sets v_type to VNON after releasing v_interlock.
So the thread doing quotaon(), quotaoff() or qsync() could vget()
a vnode which is being recycled in getcleanvnode(), after is has
been cleaned and v_interlock released, but before v_type has been
reset, leading to KASSERT(vp-v_usecount == 1) firing in
getnewvnode(), or qsync() dereferending a NULL pointer as in
PR kern/42205.
Fix by using the same tests as other ffs function traversing the mount
list: also check for VTOI(vp) == NULL, and VI_XLOCK in addition
to VI_CLEAN.


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 src/sys/ufs/ufs/ufs_quota.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/ic

2010-01-15 Thread Matthew Jacob
Module Name:src
Committed By:   mjacob
Date:   Fri Jan 15 20:09:09 UTC 2010

Modified Files:
src/sys/dev/ic: isp.c

Log Message:
Amazingly, we've been freeing a handle and then using that which it referred
to for years. Bad.


To generate a diff of this commit:
cvs rdiff -u -r1.119 -r1.120 src/sys/dev/ic/isp.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/rump/librump/rumpkern

2010-01-15 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Fri Jan 15 20:39:46 UTC 2010

Modified Files:
src/sys/rump/librump/rumpkern: rump.c

Log Message:
Accomplish messy stack with slightly less messy code.


To generate a diff of this commit:
cvs rdiff -u -r1.150 -r1.151 src/sys/rump/librump/rumpkern/rump.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/ofppc/ofppc

2010-01-15 Thread Frank Wille
Module Name:src
Committed By:   phx
Date:   Fri Jan 15 20:57:25 UTC 2010

Modified Files:
src/sys/arch/ofppc/ofppc: mainbus.c

Log Message:
Fixed crash, when /rtas was not found: OF_finddevice() returns -1 when
the device is not found.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/ofppc/ofppc/mainbus.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/doc

2010-01-15 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Fri Jan 15 20:59:00 UTC 2010

Modified Files:
src/doc: CHANGES

Log Message:
Note sparc apc(4).


To generate a diff of this commit:
cvs rdiff -u -r1.1342 -r1.1343 src/doc/CHANGES

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/amiga/dev

2010-01-15 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Fri Jan 15 23:49:22 UTC 2010

Modified Files:
src/sys/arch/amiga/dev: fd.c

Log Message:
Use __arraycount().


To generate a diff of this commit:
cvs rdiff -u -r1.83 -r1.84 src/sys/arch/amiga/dev/fd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/sparc64/include

2010-01-15 Thread Takeshi Nakayama
Module Name:src
Committed By:   nakayama
Date:   Fri Jan 15 23:55:55 UTC 2010

Modified Files:
src/sys/arch/sparc64/include: psl.h

Log Message:
Add processor implementation codes, from OpenBSD.


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/sys/arch/sparc64/include/psl.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/sparc64/sparc64

2010-01-15 Thread Takeshi Nakayama
Module Name:src
Committed By:   nakayama
Date:   Fri Jan 15 23:57:07 UTC 2010

Modified Files:
src/sys/arch/sparc64/sparc64: ipifuncs.c

Log Message:
UltraSPARC-IIIi CPUs select the BUSY/NACK pair in the interrupt
vector dispatch status register based on the lower two bits of the
ITID.

From OpenBSD and details are described in the section 10.4.3 of
UltraSPARC IIIi Processor User's Manual.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/sparc64/sparc64/ipifuncs.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/hppa/hppa

2010-01-15 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Jan 16 07:37:21 UTC 2010

Modified Files:
src/sys/arch/hppa/hppa: trap.c

Log Message:
Rename type_raw to trapnum and use in a couple more places.

Reduces diff to OpenBSD.


To generate a diff of this commit:
cvs rdiff -u -r1.66 -r1.67 src/sys/arch/hppa/hppa/trap.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/hp700/hp700

2010-01-15 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Jan 16 07:38:56 UTC 2010

Modified Files:
src/sys/arch/hp700/hp700: intr.c

Log Message:
Count interrupts in uvmexp.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/hp700/hp700/intr.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/hppa/hppa

2010-01-15 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Jan 16 07:45:53 UTC 2010

Modified Files:
src/sys/arch/hppa/hppa: trap.c

Log Message:
Add a comment.


To generate a diff of this commit:
cvs rdiff -u -r1.67 -r1.68 src/sys/arch/hppa/hppa/trap.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/hppa/hppa

2010-01-15 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Jan 16 07:56:16 UTC 2010

Modified Files:
src/sys/arch/hppa/hppa: trap.c

Log Message:
Check cpl level has returned to entry value when leaving trap/syscall.

From OpenBSD.


To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.69 src/sys/arch/hppa/hppa/trap.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.