NetBSD-Bugs archive

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

port-evbmips/60812: UBSan: Undefined Behavior in [sys-src] member access within misaligned address [..] for type '[..]' which requires 128 byte alignment



>Number:         60812
>Category:       port-evbmips
>Synopsis:       UBSan: Undefined Behavior in [sys-src]  member access within misaligned address  [..] for type '[..]' which requires 128 byte alignment
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    port-evbmips-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Sep 27 14:45:01 +0000 2026
>Originator:     Alexander Schreiber
>Release:        HEAD/20260925044118Z snapshot
>Organization:
Not Much
>Environment:
NetBSD 11.99.8 (ERLITE3)
>Description:
Kernel configured with MULTIPROCESSOR disabled and all available diagnosis turned on. On boot during kernel startup, the console gets flooded with hundreds of variants of:

[  20.8144451] UBSan: Undefined Behavior in /usr/build/HEAD_20260925044118Z/usr/src/sys/kern/vfs_vnops.c:441:20, member access within misaligned address 0x980000041fbeae58 for type 'struct vnode' which requires 128 byte alignment
[  20.8447700] UBSan: Undefined Behavior in /usr/build/HEAD_20260925044118Z/usr/src/sys/kern/kern_descrip.c:728:6, member access within misaligned address 0x980000041fcd6038 for type 'struct proc_t' which requires 128 byte alignment

I trawled through the first 1000 lines of output to consolidate the complaints. It complaints about the following:

const struct vnode
struct pool_cache
struct proc
struct proc_t
struct vnode
struct vnode_impl
struct vnode_impl_t
struct vnode_t

Source files mentioned just in those first 1000 lines:
/usr/src/sys/arch/mips/mips/cpu_exec.c
/usr/src/sys/arch/mips/mips/mips_machdep.c
/usr/src/sys/arch/mips/mips/netbsd32_machdep.c
/usr/src/sys/arch/mips/mips/syscall.c
/usr/src/sys/arch/mips/mips/trap.c
/usr/src/sys/arch/mips/mips/vm_machdep.c
/usr/src/sys/dev/dkwedge/dk.c
/usr/src/sys/kern/exec_elf.c
/usr/src/sys/kern/exec_subr.c
/usr/src/sys/kern/init_main.c
/usr/src/sys/kern/kern_auth.c
/usr/src/sys/kern/kern_clock.c
/usr/src/sys/kern/kern_descrip.c
/usr/src/sys/kern/kern_exec.c
/usr/src/sys/kern/kern_fork.c
/usr/src/sys/kern/kern_lwp.c
/usr/src/sys/kern/kern_proc.c
/usr/src/sys/kern/kern_prot.c
/usr/src/sys/kern/kern_ras.c
/usr/src/sys/kern/kern_sig.c
/usr/src/sys/kern/kern_synch.c
/usr/src/sys/kern/kern_syscall.c
/usr/src/sys/kern/kern_time.c
/usr/src/sys/kern/sched_4bsd.c
/usr/src/sys/kern/subr_copy.c
/usr/src/sys/kern/subr_disk_open.c
/usr/src/sys/kern/subr_pool.c
/usr/src/sys/kern/subr_vmem.c
/usr/src/sys/kern/sys_sig.c
/usr/src/sys/kern/vfs_bio.c
/usr/src/sys/kern/vfs_cache.c
/usr/src/sys/kern/vfs_cwd.c
/usr/src/sys/kern/vfs_lookup.c
/usr/src/sys/kern/vfs_mount.c
/usr/src/sys/kern/vfs_subr.c
/usr/src/sys/kern/vfs_syscalls.c
/usr/src/sys/kern/vfs_vnode.c
/usr/src/sys/kern/vfs_vnops.c
/usr/src/sys/kern/vnode_if.c
/usr/src/sys/miscfs/deadfs/dead_vfsops.c
/usr/src/sys/miscfs/genfs/genfs_io.c
/usr/src/sys/miscfs/genfs/genfs_vnops.c
/usr/src/sys/miscfs/procfs/procfs_vfsops.c
/usr/src/sys/miscfs/specfs/spec_vnops.c
/usr/src/sys/sys/proc.h
/usr/src/sys/sys/syscallvar.h
/usr/src/sys/sys/vnode.h
/usr/src/sys/sys/wapbl.h
/usr/src/sys/ufs/ffs/ffs_vfsops.c
/usr/src/sys/ufs/ffs/ffs_vnops.c
/usr/src/sys/ufs/ufs/ufs_bmap.c
/usr/src/sys/ufs/ufs/ufs_dirhash.c
/usr/src/sys/ufs/ufs/ufs_inode.c
/usr/src/sys/ufs/ufs/ufs_lookup.c
/usr/src/sys/ufs/ufs/ufs_readwrite.c
/usr/src/sys/ufs/ufs/ufs_vnops.c
/usr/src/sys/uvm/pmap/pmap.c
/usr/src/sys/uvm/pmap/pmap_segtab.c
/usr/src/sys/uvm/uvm_fault.c
/usr/src/sys/uvm/uvm_glue.c
/usr/src/sys/uvm/uvm_map.c
/usr/src/sys/uvm/uvm_mmap.c
/usr/src/sys/uvm/uvm_page.c
/usr/src/sys/uvm/uvm_unix.c
/usr/src/sys/uvm/uvm_vnode.c

Actual code locations mentions after uniq(1): 823, so I'm not including those right now, but can dig them up if needed.
>How-To-Repeat:
Grab HEAD/20260925044118Z daily snapshot of source from https://nycdn.netbsd.org/pub/NetBSD-daily/HEAD/

Apply the following diff to get from the included OCTEON to the ERLITE3 config used for this test:

--- src/sys/arch/evbmips/conf/OCTEON    2026-07-07 08:14:15.000000000 +0000
+++ src/sys/arch/evbmips/conf/ERLITE3   2026-09-27 14:40:37.840915141 +0000
@@ -1,17 +1,42 @@
-#      $NetBSD: OCTEON,v 1.19 2026/07/07 08:14:15 kbowling Exp $
+#      $NetBSD: OCTEON,v 1.14 2024/01/29 18:27:11 christos Exp $
 
 include        "arch/mips/conf/std.octeon"
 include        "arch/evbmips/conf/files.octeon"
 
 #options       INCLUDE_CONFIG_FILE     # embed config file in kernel binary
 
-#ident                 "OCTEON-$Revision: 1.19 $"
+#ident                 "OCTEON-$Revision: 1.14 $"
 
 maxusers       32
 
 options        FDT
 options        FDT_DEFAULT_STDOUT_PATH="\"uart0:115200n8\""
 
+
+
+# MP
+# options      MULTIPROCESSOR
+
+# Kernel Undefined Behavior Sanitizer (kUBSan).
+options        KUBSAN                  # mandatory
+# options        UBSAN_ALWAYS_FATAL      # optional: panic on all kUBSan reports
+
+# Kernel Code Coverage Driver.
+makeoptions    KCOV=1
+options        KCOV
+
+# Heartbeat checks
+options         HEARTBEAT
+options         HEARTBEAT_MAX_PERIOD_DEFAULT=15
+
+
+
+
+
+
+# config
+options                INCLUDE_CONFIG_FILE
+
 # Options for necessary to use MD
 #options       MEMORY_DISK_HOOKS
 #options       MEMORY_DISK_IS_ROOT     # force root on memory disk
@@ -34,10 +59,10 @@
 
 # Debugging options
 options        DIAGNOSTIC      # extra kernel sanity checking
-#options       DEBUG           # extra kernel debugging support
+options        DEBUG           # extra kernel debugging support
+options         LOCKDEBUG       # expensive locking checks/support
 #options       USERCONF        # userconf(4) support
-#options       SYSCTL_INCLUDE_DESCR    # Include sysctl descriptions in kernel
-#options       PMAP_DEBUG
+options        SYSCTL_INCLUDE_DESCR    # Include sysctl descriptions in kernel
 options        DDB             # kernel dynamic debugger
 options        DDB_HISTORY_SIZE=100 # enable history editing in DDB
 makeoptions    DEBUG="-g"      # compile full symbol table

>Fix:




Home | Main Index | Thread Index | Old Index