NetBSD Problem Report #58811

From he@smistad.uninett.no  Tue Nov  5 22:38:56 2024
Return-Path: <he@smistad.uninett.no>
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)
	 client-signature RSA-PSS (2048 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 72C4A1A9238
	for <gnats-bugs@gnats.NetBSD.org>; Tue,  5 Nov 2024 22:38:56 +0000 (UTC)
Message-Id: <20241105223850.2E01343F25A@smistad.uninett.no>
Date: Tue,  5 Nov 2024 23:38:50 +0100 (CET)
From: he@NetBSD.org
Reply-To: he@NetBSD.org
To: gnats-bugs@NetBSD.org
Subject: riscv64 cannot run "systat vm"
X-Send-Pr-Version: 3.95

>Number:         58811
>Category:       kern
>Synopsis:       riscv64 cannot run "systat vm"
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Nov 05 22:40:00 +0000 2024
>Last-Modified:  Wed Nov 06 09:15:01 +0000 2024
>Originator:     Havard Eidnes
>Release:        NetBSD 10.99.12 of Sep 7 2024
>Organization:
	I try...
>Environment:
System: NetBSD riscv64 10.99.12 NetBSD 10.99.12 (GENERIC64) #0: Sat Sep  7 14:28:19 UTC 2024  mkrepro@mkrepro.NetBSD.org:/usr/src/sys/arch/riscv/compile/GENERIC64 riscv
Architecture: riscv64
Machine: riscv
>Description:
	The riscv64 port cannot run "systat vm".

	Trying to do so quickly flashes an error message before
	clearing the screen.  Catching it with "script" reveals:

	systat: nlist: can't find following symbols:
	_intrnames
	_eintrnames
	_intrcnt
	_eintrcnt
	_allevents

	Searching for these with "nm -op /netbsd" reveals only

	riscv64: {31} nm -op /netbsd | grep alleve
	/netbsd:ffffffc0008506f8 D allevents
	riscv64: {32} nm -op /netbsd | grep intrna
	riscv64: {33} nm -op /netbsd | grep intrcn
	riscv64: {34} 

	so it is evident that the kernel isn't providing the information
	that systat expects.

	Note that the allevents symbol doesn't have the preceding _ character.

>How-To-Repeat:
	See above.
>Fix:
	Yes, please.
	This is about as essential as "tail -f buildlog" working...

>Audit-Trail:
From: matthew green <mrg@eterna23.net>
To: gnats-bugs@netbsd.org
Cc: kern-bug-people@netbsd.org, gnats-admin@netbsd.org,
    netbsd-bugs@netbsd.org
Subject: re: kern/58811: riscv64 cannot run "systat vm"
Date: Wed, 06 Nov 2024 20:13:45 +1100

 this is really weird.

 i saw the same problem in my risc64 vm.  then i patched the call
 to kvm_nlist() to have the only "necessary" one (allevents) to be
 first in the struct nlist[], and then it worked.  reading the code
 this shouldn't happen, and it should find "allevents"

 then i wrote a tiny test to compare having successful symbols to
 look up in first or second array member, and it worked fine for me
 both ways.  so i removed my patch to systat/vmstat.c and put the
 "_allevents" entry back to the end...and it is still working.  it
 can see the allevents entry in "nm /dev/ksyms" as expected, so i'm
 basically really confused what is happening here, and now i can't
 reproduce the original problem.  (is there a chance it was broken,
 and recently fixed?  i *did* upgrade my VM since i was building
 new -current fixes, so i did change a lot..)


 note, the "_" prefix is related to the original a.out version,
 where those were the actual symbols names in the text.  for ELF,
 we ignore the leading "_" in the lookup.


 .mrg.

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.49 2026/05/14 01:52:41 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.