David Holland | 6 Jul 11:58 2015


It has been brought to my attention that the logic in
mount_checkdirs() both (a) races with fork and (b) is probably
compromised by the *at() syscalls.

The purpose of the code is to update all processes' current dirs and
root dirs that have just been mounted over, so nobody ends up sitting
on an intermediate vnode in the middle of a mount stack.

However, in fork we first copy the parent's cwd structure and then
assign the copy, during which time the copy is invisible to
mount_checkdirs; so in theory some process's current dir (or root dir,
too) could be skipped.

Also, since you can't chdir (even fchdir) to the middle of a mount
stack, this logic was sufficient to avoid using the middle of a mount
stack as the starting point for a path lookup, even if someone had an
fd open. But the *at() system calls break this invariant wide open.

So the question is: does it matter? Do we actually care? It seems to
me that no great harm arises (other than perhaps some confusion) if
one is sitting in the middle of a mount stack, and in fact it might
even be desirable if the mount stack is a union mount.

Also it's occasionally useful to mount over things and leave a process
underneath, which this logic seems to complicate.

The logic was added to 4.4 by Kirk McKusick but without much in the
way of rationale:

(Continue reading)

Maxime Villard | 4 Jul 17:23 2015

Brainy: bozohttpd memory leak

not a kernel issue, but

----------------------- libexec/httpd/lua-bozo.c -----------------------

321		asprintf(&file, "/%s", uri);
	if (file == NULL) {
		return 0;

	if (request->hr_query && strlen(request->hr_query))
		query = bozostrdup(httpd, request->hr_query);
		query = NULL;

	p = strchr(prefix, '/');
	if (p == NULL){
		return 0;


'file' and 'query' are leaked.

Found by Brainy.

(Continue reading)

Ryota Ozaki | 4 Jul 14:52 2015

Improving use of rt_refcnt


I'm trying to improve use of rt_refcnt: reducing
abuse of it, e.g., rt_refcnt++/rt_refcnt-- outside
route.c and extending it to treat referencing
during packet processing (IOW, references from
local variables) -- currently it handles only
references between routes. The latter is needed for
MP-safe networking.

Here is a patch:

The patch passes all ATF tests and an additional test
specific to refcnt that is not committed yet due
to lack of refcnt outputs in netstat -r (See PR#50027).

Note that the patch isn't ready for MP-safe yet;
we need atomicity of refcnt operations somehow
(locking is an easy solution for it). This work
will be solved in another patch.

Any comments or suggestions are welcome.


Edgar Fuß | 2 Jul 12:04 2015

Choice of SAS controller

I would like to try a SAS controller other than the MPT one I currently use.
I'm using RAIDframe, but I would consider a RAID controller in JBOD mode.
What controllers are people here using in production?

tlaronde | 2 Jul 11:07 2015

USB, NetBSD 6.1.5/amd64: freezes when 2 umass connected


On an NetBSD 6.1.5/amd64, when I connect a second USB connected disk to
the machine, NetBSD freezes. Unable to connect remotely; hard reboot


1) The machine has two usb ports, with uhub0 and uhub1 first attached
resp. to these ones; the uhub2 cascading from uhub0 and uhub3 from
uhub2 has 6 ports removable;
uhub3 has 8 ports removable;
Since in /dev/ there are only 8 devices (from usb0 to usb7) could this
be the problem? (6 + 8 = 14, even if I have only one USB device---first
disk---and the second disk is only the second device; but how are the
device nodes assigned to one USB port?)

2) The two USB disks are from the same vendor (Western Digital) but not
exactly the same model (not the same capacity). Could the USB driver be
confused by two similar devices connected to the same(?) USB tree?

3) Physically, on the machine, there are USB ports on the rear, and USB
ports on the front. Does somebody know if front ports could be
"duplicating" rear ports, that is slots on the front be in fact
connected to the same ports as the rear ones causing conflict?

I'm trying to find what is causing this misbehavior. And a freeze is
rather annoying for a node that is mainly supposed to be administrated
from remote...
(Continue reading)

Edgar Fuß | 1 Jul 15:22 2015

RAIDframe-on-mpt(4) write performance

I'm trying to track down abysmally low (15-30MB/s) write performance on a 
file system on a RAIDFframe level 1 RAID on mpt(4) SAS discs.

On a file system on one of the component devices, write performance is 

On the RAID's raw device, I can write 110MB/s when using 64k blocks.
When I INcrease the block size (like dd bs=128k), the write performance 
DROPs: 48MB/s at 128k, 20MB/s at 256k, 17 at 512, 15 at 1024.

I can't make any sense out of this. Running iostat -x during the tests 
shows 64k (i.e. MAXPHYS) writes on the RAID, 8k (16 SpSU) on the components,
no reads, all as expected. CPUs are close to idle.

On a similar RAIDframe setup, but on SATA discs at on-board controllers, 
write throughput exceeds 100MB/s.

All file systems are 16k fsbsize FFSv2 (i.e newfs -O 2 -b 16k) mounted -o log.

What SAS controllers do other people use? Is mpii(4) ready for production? 
What about SAS hardware RAID controllers in JBOD mode?

Edgar Fuß | 1 Jul 15:19 2015

rm(1) CPU hog

I just noticed a rm(1) of a 6.4G file (WAPBL 16k FFSv2) taking 35 seconds.
The astonishing fact was the undelying disc being idle (according to iostat) 
and rm being CPU-bound.

Emmanuel Dreyfus | 1 Jul 10:01 2015

x96 cannot build without MULTIPROCESSOR


In -current, x86 seems to be unable to build withotu MUTLIPROCESSOR:
src/sys/kern/kern_stub.c:195:5: error: #error __HAVE_PREEMPTION requires MULTIPROCESSOR

__HAVE_PREEMPTION is defined uncondtionaly in src/sys/x86/include/intr.h

Disabling SMP can be useful, sometime you get a computer model where 
it crashes. The only workaround I see is to build with 


Emmanuel Dreyfus
manu <at> netbsd.org

Martin Husemann | 29 Jun 21:20 2015

Re: Guidelines for choosing MACHINE & MACHINE_ARCH?

On Mon, Jun 29, 2015 at 03:05:07PM -0400, Andrew Cagney wrote:
> - allow finer grained "machines" or platforms so I can have
> "./build.sh -m rpi" do the right thing

It allows aliases, so this would probaly a one line change (though
you'd still get more build than only the RPI kernel).

Allowing the aliases to additionally override KERNEL_SETS/BUILD_KERNELS
is probably also easy, and may be worth for the evb* architectures
(whatever they'll be called in the future).


Martin Husemann | 29 Jun 11:55 2015

Current has issues with unmount?

A -current as of earlier this morning has issues with running the
kernel/t_umount tests for me - seems to be race, and when we loose,
the unmount process hangs unkillable (with some locked vnode, i.e. you
better do not try to run df(1) when it hangs).


Maxime Villard | 29 Jun 10:27 2015

Brainy: Same Runtime Branches in arm


---------------------- sys/arch/arm/arm/cpufunc.c ----------------------
	} else if ((fault_instruction & 0x0e000000) == 0x0c000000) {


	} else if ((fault_instruction & 0x0e000000) == 0x0c000000)


Found by Brainy.