NetBSD Problem Report #6227
Received: (qmail 14897 invoked from network); 2 Oct 1998 00:24:01 -0000
Message-Id: <3.0.3.32.19981001172913.00698d88@idiom.com>
Date: Thu, 01 Oct 1998 17:29:13 -0700
From: Hwa-Jin Bae <hjb@PSO.COM>
To: gnats-bugs@gnats.netbsd.org
Subject: ccd.c bug in ccdbuffer()
>Number: 6227
>Category: kern
>Synopsis: ccd.c ccdbuffer() has problem with supporting concatenation
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: kern-bug-people
>State: closed
>Class: change-request
>Submitter-Id: net
>Arrival-Date: Thu Oct 01 17:35:01 +0000 1998
>Closed-Date: Sun Apr 23 08:37:19 +0000 2000
>Last-Modified: Sun Apr 23 08:37:19 +0000 2000
>Originator: Hwa Jin Bae
>Release: NetBSD-current
>Organization:
PSO Systems Inc
Oakland, CA
>Environment:
ARM32, CATS, NetBSD
System: NetBSD cats 1.3F NetBSD 1.3F (CATSHJB) #21: Thu Oct 1 16:21:36 BST
1998 hjb@cats:/usr/src/sys/arch/arm32/compile/CATSHJB arm32
>Description:
If you use fairly large disk drives and try to concatenate
using zero interleave (simple concatenation) via ccd.c
you will notice that the kernel panics during reading of
disklabel. This is due to a error in signed comparision
of block count in ccdbuffer().
The line
if (cbp->cb_buf.b_bcount > bcount) <-----
cbp->cb_buf.b_bcount = bcount;
10 or so lines after the comment block
/*
* Fill in the component buf structure
*/
in ccdbuffer() function should be changed to
if ((unsigned long)cbp->cb_buf.b_bcount > (unsigned long)bcount)<-----
cbp->cb_buf.b_bcount = bcount;
This seemingly harmless code crashes the kernel during
the boot if you specify zero as interleave factor in
/etc/ccd.conf and ccdconfig is run as part of boot sequence.
It may not happen when you use small disks.
In addition, and this is unrelated to the problem above,
but if you are not careful and leave enough space
in the partition map for ccd stuff the disklabel for
ccd can overwrite the component disk's disklabel.
I noticed FreeBSD code now has offset of 16 to
get rid of this problem. I've imported this change
in my version of ccd.c and it works well. This is
not an elegant fix but it helps a lot in real life use.
>How-To-Repeat:
See above
>Fix:
See above
Hwa-Jin Bae
PSO Systems Inc.
mailto:hjb@pso.com
http://www.pso.com
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->feedback
State-Changed-By: bouyer
State-Changed-When: Fri Dec 4 05:20:51 PST 1998
State-Changed-Why:
This code has changed, there is now a comparison between a 64bit quantitie and
a long. Could you confirm you still have the problem ?
If so, mayby the long should be changed to a int64 too. But I
would be surprised, as this holds block addr, a signed 32bit can hold a
8192Gb partition. Was your ccd bigger than that ?
Responsible-Changed-From-To: gnats-admin->kern-bug-people
Responsible-Changed-By: fair
Responsible-Changed-When: Mon Dec 28 12:50:26 PST 1998
Responsible-Changed-Why:
This PR is the responsibility of the kern-bug-people,
not the GNATS database administrator.
State-Changed-From-To: feedback->closed
State-Changed-By: fair
State-Changed-When: Sun Apr 23 01:36:36 PDT 2000
State-Changed-Why:
Problem is asserted not to exist any more (code changed), and with no
response from the PR submitter in over a year, this PR can be closed.
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.