NetBSD Problem Report #59650
From www@netbsd.org Fri Sep 12 12:45:34 2025
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256
client-signature RSA-PSS (2048 bits) client-digest SHA256)
(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
by mollari.NetBSD.org (Postfix) with ESMTPS id E0E6F1A923C
for <gnats-bugs@gnats.NetBSD.org>; Fri, 12 Sep 2025 12:45:34 +0000 (UTC)
Message-Id: <20250912124533.60AD41A923E@mollari.NetBSD.org>
Date: Fri, 12 Sep 2025 12:45:33 +0000 (UTC)
From: matthias@d2ux.net
Reply-To: matthias@d2ux.net
To: gnats-bugs@NetBSD.org
Subject: ccdconfig -g shows incorrect date when cgd > 0
X-Send-Pr-Version: www-1.0
>Number: 59650
>Category: kern
>Synopsis: ccdconfig -g shows incorrect date when cgd > 0
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: kern-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Fri Sep 12 12:50:00 +0000 2025
>Originator: Matthias Petermann
>Release: NetBSD/amd64 10.1
>Organization:
>Environment:
NetBSD northstar.lan 10.1_STABLE NetBSD 10.1_STABLE (XEN3_DOM0) #0: Thu Sep 11 04:53:19 CEST 2025 mpeterma@x230.lan:/u/northstar/obj/sys/arch/amd64/compile/XEN3_DOM0 amd64
>Description:
Given the case I have configured more than one ccd device, ccdconfig -g doesn't print out the actual configuration but something like this:
```
northstar# ccdconfig -g
ccd0 0 0x0 429496729600 /dev/wedges/db...
ccd0 0 0x0 429496729600 /dev/wedges/db...
ccd0 0 0x0 429496729600 /dev/wedges/db...
ccd0 0 0x0 429496729600 /dev/wedges/db...
```
While the number of rows reflects the total number of configured rows, but doesn't show up with the correct device number.
>How-To-Repeat:
Configure more than two ccd devices on NetBSD 10.1, call ccdconfig -g
>Fix:
Patch shared by mlestv in IRC: https://cdn.netbsd.org/pub/NetBSD/misc/mlelstv/ccd.c.diff
The patch is for NetBSD current. On NetBSD 10.1 (netbsd-10 branch) I was successful by applying its essential parts:
diff --git a/sys/dev/ccd.c b/sys/dev/ccd.c
index b2397bace496..9aba276be665 100644
--- a/sys/dev/ccd.c
+++ b/sys/dev/ccd.c
@@ -1,4 +1,4 @@
-/* $NetBSD: ccd.c,v 1.189.4.1 2024/04/18 18:24:31 martin Exp $ */
+/* $NetBSD: ccd.c,v 1.192 2025/01/08 08:24:07 andvar Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998, 1999, 2007, 2009 The NetBSD Foundation, Inc.
@@ -1750,17 +1750,17 @@ ccd_units_sysctl(SYSCTLFN_ARGS)
LIST_FOREACH(sc, &ccds, sc_link) {
if (i >= nccd)
break;
- units[i] = sc->sc_unit;
+ units[i++] = sc->sc_unit;
}
+ nccd = i;
mutex_exit(&ccd_lock);
} else {
units = NULL;
- size = 0;
}
node = *rnode;
node.sysctl_data = units;
- node.sysctl_size = size;
+ node.sysctl_size = nccd * sizeof(*units);
error = sysctl_lookup(SYSCTLFN_CALL(&node));
if (units)
(Contact us)
$NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2025
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.