NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

kern/59462: libnv nvlist_get_number_array() broken on big endian 64bit



>Number:         59462
>Category:       kern
>Synopsis:       libnv nvlist_get_number_array() broken on big endian 64bit
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Jun 10 16:45:00 +0000 2025
>Originator:     Martin Husemann
>Release:        NetBSD 10.99.14
>Organization:
The NetBSD Foundation, Inc.
>Environment:
System: NetBSD thirdstage.duskware.de 10.99.14 NetBSD 10.99.14 (MODULAR) #806: Tue Jun 10 08:23:36 CEST 2025 martin%thirdstage.duskware.de@localhost:/home/martin/current/src/sys/arch/sparc64/compile/MODULAR sparc64
Architecture: sparc64
Machine: sparc64
>Description:

On sparc64 one of the NPF test cases fails. It is supposed to add a rule
with uid 1001 and gid 20, but that does not happen.

Thread 1 "" hit Breakpoint 6, npf_rule_setrid (req=0x40963d10, rl=0x40dcaf80, name=0x41834b88 "r_user")
    at /home/martin/current/src/sys/rump/net/lib/libnpf/../../../..//net/npf/npf_ruleset.c:741
741     {
(gdb) n
744             const uint64_t *rid = nvlist_get_number_array(req, name, &nitems);
(gdb) 
745             KASSERT(nitems == 3);
(gdb) 
747             id.id[0] = (uint32_t)rid[0];

(gdb) p rid[0]
$11 = 0
(gdb) p rid[1]
$12 = 0

The same works just fine on a 32bit big endian machine:

Thread 1 "" hit Breakpoint 2, npf_rule_setrid (req=0x697cedc8, rl=0x696ce100, 
    name=0x718c42e0 "r_user")
    at /work/src/sys/rump/net/lib/libnpf/../../../..//net/npf/npf_ruleset.c:744
(gdb) p *rid
$2 = 1001

So something in nvlist_get_number_array() must be broken (or the
storing of the values) - but I can't make my way through the bizare
macro maze and due to the macro-obfuscation it is not debuggable with
gdb.

>How-To-Repeat:
s/a

>Fix:
yes please!



Home | Main Index | Thread Index | Old Index