NetBSD Problem Report #61075

From www@netbsd.org  Wed Nov 25 09:56:35 2026
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 "YR1" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 402FD1A923B
	for <gnats-bugs@gnats.NetBSD.org>; Wed, 25 Nov 2026 09:56:35 +0000 (UTC)
Message-Id: <20261125095633.CC7F91A923D@mollari.NetBSD.org>
Date: Wed, 25 Nov 2026 09:56:33 +0000 (UTC)
From: olivier.2.smet@gmail.com
Reply-To: olivier.2.smet@gmail.com
To: gnats-bugs@NetBSD.org
Subject: zs panic during auto configuration on a MVME147 board
X-Send-Pr-Version: www-1.0
X-From4GNATS: "olivier.2.smet@gmail.com via gnats" <gnats-admin@NetBSD.org>

>Number:         61075
>Category:       port-mvme68k
>Synopsis:       zs panic during auto configuration on a MVME147 board
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    thorpej
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Nov 25 10:00:00 +0000 2026
>Last-Modified:  Wed Nov 25 12:12:39 +0000 2026
>Originator:     Olivier De Smet
>Release:        NetBSD 11.1
>Organization:
>Environment:
NetBSD mvme147 11.1 NetBSD 11.1 (GENERIC) #0: Tue Nov 24 08:57:09 CET 2026  olivier@imrryr:/home/olivier/NetBSD/usr/obj/sys/arch/mvme68k/compile/GENERIC mvme68k
>Description:
When making a emulator for a MVME147 board I encounter the following problem.

When initializing the scc, netbsd do the first channel then the second channel. On my system an
interrupt can arise between those 2 initializations, making the system panic.

In the file /src/system/arch/mvme68k/dev/zs.c :
in hard_shared() if the zs chip is half initialized (first channel only) and if an interrupt arise, there is an access on the second channel and a panic occurs (near line 271 272) as it access a NULL structure.


>How-To-Repeat:
Happened only in my emulated environnement, I do not have access to a real board.

But anyway, there is a time slice when initializing a real device, if an interrupt occurs, the same panic will occurs.

Every boot leads to a panic after initialising the first channel.
>Fix:
add a guard against accessing non initialized channels. Anyway NO interrupts should be taken until the chip is fully initialized.
--------------------------
--- zs.c.orig	2026-11-25 08:28:07.903295987 +0100
+++ zs.c	2026-11-25 08:27:49.407359322 +0100
@@ -267,7 +267,10 @@
 	rval = 0;
 	for (unit = 0; unit < zsc_cd.cd_ndevs; unit++) {
 		zsc = device_lookup_private(&zsc_cd, unit);
-		if (zsc != NULL && zsc_intr_hard(zsc)) {
+		if (zsc == NULL ||
+		    zsc->zsc_cs[0] == NULL || zsc->zsc_cs[1] == NULL)
+			continue;
+		if (zsc_intr_hard(zsc)) {			
 			if ((zsc->zsc_cs[0]->cs_softreq) ||
 			    (zsc->zsc_cs[1]->cs_softreq))
 				softint_schedule(zsc->zsc_softintr_cookie);
--------------------------

>Release-Note:

>Audit-Trail:

Responsible-Changed-From-To: port-mvme68k-maintainer->thorpej
Responsible-Changed-By: thorpej@NetBSD.org
Responsible-Changed-When: Wed, 25 Nov 2026 12:12:39 +0000
Responsible-Changed-Why:
Take.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(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.