Bug 258496

Summary: Buildkernel fails with DEBUGNET and without VIMAGE
Product: Base System Reporter: ktullavik
Component: kernAssignee: freebsd-bugs (Nobody) <bugs>
Status: Closed FIXED    
Severity: Affects Only Me CC: markj
Priority: ---    
Version: CURRENT   
Hardware: amd64   
OS: Any   

Description ktullavik 2021-09-14 12:51:17 UTC
I'm on git hash: 29545986bdf6c949671e61fc46ee3f2440b1535b 

Adding VIMAGE to the kernel config (or removing DEBUGNET) fixes the following error.

# make -j1 KERNCONF=VBsd make buildkernel

...
cc -target x86_64-unknown-freebsd14.0 --sysroot=/usr/obj/usr/src/amd64.amd64/tmp -B/usr/obj/usr/src/amd64.amd64/tmp/usr/bin -c -O2 -pipe  -fno-strict-aliasing  -g -nostdinc  -I. -I/usr/src/sys -I/usr/src/sys/contrib/ck/include -I/usr/src/sys/contrib/libfdt -D_KERNEL -DHAVE_KERNEL_OPTION_HEADERS -include opt_global.h -fno-common    -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -MD  -MF.depend.debugnet.o -MTdebugnet.o -fdebug-prefix-map=./machine=/usr/src/sys/amd64/include -fdebug-prefix-map=./x86=/usr/src/sys/x86/include -mcmodel=kernel -mno-red-zone -mno-mmx -mno-sse -msoft-float  -fno-asynchronous-unwind-tables -ffreestanding -fwrapv -fstack-protector -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wcast-qual -Wundef -Wno-pointer-sign -D__printf__=__freebsd_kprintf__ -Wmissing-include-dirs -fdiagnostics-show-option -Wno-unknown-pragmas -Wno-error=tautological-compare -Wno-error=empty-body -Wno-error=parentheses-equality -Wno-error=unused-function -Wno-error=pointer-sign -Wno-error=shift-negative-value -Wno-address-of-packed-member -Wno-format-zero-length   -mno-aes -mno-avx  -std=iso9899:1999 -Werror /usr/src/sys/net/debugnet.c
/usr/src/sys/net/debugnet.c:783:1: error: expected identifier
MTX_SYSINIT(debugnet_hwm_lock, &dn_hwm_lk, "Debugnet HWM lock", MTX_DEF);
^
/usr/src/sys/sys/mutex.h:533:19: note: expanded from macro 'MTX_SYSINIT'
            mtx_sysinit, &name##_args);                                 \
                         ^
/usr/src/sys/net/debugnet.c:783:1: error: type specifier missing, defaults to 'int' [-Werror,-Wimplicit-int]
/usr/src/sys/sys/mutex.h:532:2: note: expanded from macro 'MTX_SYSINIT'
        SYSINIT(name##_mtx_sysinit, SI_SUB_LOCK, SI_ORDER_MIDDLE,       \
        ^
/usr/src/sys/net/debugnet.c:783:1: error: this function declaration is not a prototype [-Werror,-Wstrict-prototypes]
/usr/src/sys/sys/mutex.h:532:9: note: expanded from macro 'MTX_SYSINIT'
        SYSINIT(name##_mtx_sysinit, SI_SUB_LOCK, SI_ORDER_MIDDLE,       \
               ^
/usr/src/sys/net/debugnet.c:783:1: error: expected identifier
/usr/src/sys/sys/mutex.h:535:20: note: expanded from macro 'MTX_SYSINIT'
            _mtx_destroy, __DEVOLATILE(void *, &(mtx)->mtx_lock))
                          ^
/usr/src/sys/sys/cdefs.h:627:33: note: expanded from macro '__DEVOLATILE'
#define __DEVOLATILE(type, var) ((type)(__uintptr_t)(volatile void *)(var))
                                ^
/usr/src/sys/net/debugnet.c:783:1: error: type specifier missing, defaults to 'int' [-Werror,-Wimplicit-int]
/usr/src/sys/sys/mutex.h:534:2: note: expanded from macro 'MTX_SYSINIT'
        SYSUNINIT(name##_mtx_sysuninit, SI_SUB_LOCK, SI_ORDER_MIDDLE,   \
        ^
/usr/src/sys/net/debugnet.c:783:1: error: this function declaration is not a prototype [-Werror,-Wstrict-prototypes]
/usr/src/sys/sys/mutex.h:534:11: note: expanded from macro 'MTX_SYSINIT'
        SYSUNINIT(name##_mtx_sysuninit, SI_SUB_LOCK, SI_ORDER_MIDDLE,   \
                 ^
/usr/src/sys/net/debugnet.c:873:42: error: expected ')'
SYSINIT(dn_evh_init, SI_SUB_EVENTHANDLER + 1, SI_ORDER_ANY, dn_evh_init, NULL);
                                         ^
/usr/src/sys/net/debugnet.c:873:8: note: to match this '('
SYSINIT(dn_evh_init, SI_SUB_EVENTHANDLER + 1, SI_ORDER_ANY, dn_evh_init, NULL);
       ^
/usr/src/sys/net/debugnet.c:873:1: error: type specifier missing, defaults to 'int' [-Werror,-Wimplicit-int]
SYSINIT(dn_evh_init, SI_SUB_EVENTHANDLER + 1, SI_ORDER_ANY, dn_evh_init, NULL);
^
/usr/src/sys/net/debugnet.c:873:9: error: a parameter list without types is only allowed in a function definition
SYSINIT(dn_evh_init, SI_SUB_EVENTHANDLER + 1, SI_ORDER_ANY, dn_evh_init, NULL);
        ^
9 errors generated.
*** [debugnet.o] Error code 1

make[2]: stopped in /usr/obj/usr/src/amd64.amd64/sys/VBsd
1 error

make[2]: stopped in /usr/obj/usr/src/amd64.amd64/sys/VBsd
     1205.97 real       784.44 user       412.24 sys

make[1]: stopped in /usr/src

make: stopped in /usr/src



KERNCONF:

cpu		HAMMER
ident		GENERIC

makeoptions	DEBUG=-g		# Build kernel with gdb(1) debug symbols
makeoptions	WITH_CTF=1		# Run ctfconvert(1) for DTrace support

options 	SCHED_ULE		# ULE scheduler
options 	NUMA			# Non-Uniform Memory Architecture support
options 	PREEMPTION		# Enable kernel thread preemption
#options         VIMAGE
options 	INET			# InterNETworking
options         INET6
options		FIB_ALGO		# Modular fib lookups
options 	TCP_OFFLOAD		# TCP offload
options 	TCP_BLACKBOX		# Enhanced TCP event logging
options 	TCP_HHOOK		# hhook(9) framework for TCP
options		TCP_RFC7413		# TCP Fast Open
options		KERN_TLS		# TLS transmit & receive offload
options 	FFS			# Berkeley Fast Filesystem
options 	SOFTUPDATES		# Enable FFS soft updates support
options 	UFS_DIRHASH		# Improve performance on big directories
options 	UFS_GJOURNAL		# Enable gjournal-based UFS journaling
options 	NFSCL			# Network Filesystem Client
options 	NFSD			# Network Filesystem Server
options 	NFSLOCKD		# Network Lock Manager
options 	MSDOSFS			# MSDOS Filesystem
options 	CD9660			# ISO 9660 Filesystem
options 	PROCFS			# Process filesystem (requires PSEUDOFS)
options 	PSEUDOFS		# Pseudo-filesystem framework
options 	TMPFS			# Efficient memory filesystem
options 	GEOM_RAID		# Soft RAID functionality.
options 	GEOM_LABEL		# Provides labelization
options 	EFIRT			# EFI Runtime Services support
options 	COMPAT_FREEBSD32	# Compatible with i386 binaries
options 	COMPAT_FREEBSD10	# Compatible with FreeBSD10
options 	COMPAT_FREEBSD11	# Compatible with FreeBSD11
options 	COMPAT_FREEBSD12	# Compatible with FreeBSD12
options 	SCSI_DELAY=5000		# Delay (in ms) before probing SCSI
options 	KTRACE			# ktrace(1) support
options 	STACK			# stack(9) support
options 	SYSVSHM			# SYSV-style shared memory
options 	SYSVMSG			# SYSV-style message queues
options 	SYSVSEM			# SYSV-style semaphores
options 	_KPOSIX_PRIORITY_SCHEDULING # POSIX P1003_1B real-time extensions
options 	PRINTF_BUFR_SIZE=128	# Prevent printf output being interspersed.
options 	KBD_INSTALL_CDEV	# install a CDEV entry in /dev
options 	HWPMC_HOOKS		# Necessary kernel hooks for hwpmc(4)
options 	AUDIT			# Security event auditing
options 	CAPABILITY_MODE		# Capsicum capability mode
options 	CAPABILITIES		# Capsicum capabilities
options 	KDTRACE_FRAME		# Ensure frames are compiled in
options 	KDTRACE_HOOKS		# Kernel DTrace hooks
options 	DDB_CTF			# Kernel ELF linker loads CTF data

# Debugging support.  Always need this:
options 	KDB			# Enable kernel debugger support.
options 	KDB_TRACE		# Print a stack trace for a panic.

# Kernel dump features.
options 	EKCD			# Support for encrypted kernel dumps
options 	ZSTDIO			# zstd-compressed kernel and user dumps
options 	DEBUGNET		# debugnet networking
options 	NETDUMP			# netdump(4) client support
options 	NETGDB			# netgdb(4) client support

# Make an SMP-capable kernel by default
options 	SMP			# Symmetric MultiProcessor Kernel
options 	EARLY_AP_STARTUP

# CPU frequency control
device		cpufreq

# Bus support.
device		acpi
device		smbios
options 	IOMMU
device		pci
options 	PCI_HP			# PCI-Express native HotPlug
options		PCI_IOV			# PCI SR-IOV support

# ATA controllers
device		ahci			# AHCI-compatible SATA controllers

# ATA/SCSI peripherals
device		scbus			# SCSI bus (required for ATA/SCSI)
device		ch			# SCSI media changers
device		da			# Direct Access (disks)
device		sa			# Sequential Access (tape etc)
device		cd			# CD
device		pass			# Passthrough device (direct ATA/SCSI access)

# NVM Express (NVMe) support
device		nvme			# base NVMe driver
device		nvd			# expose NVMe namespaces as disks, depends on nvme

# atkbdc0 controls both the keyboard and the PS/2 mouse
device		atkbdc			# AT keyboard controller
device		atkbd			# AT keyboard
device		psm			# PS/2 mouse
device		kbdmux			# keyboard multiplexer

device		vga			# VGA video card driver
options 	VESA			# Add support for VESA BIOS Extensions (VBE)

device		splash			# Splash screen and screen saver support

# syscons is the default console driver, resembling an SCO console
device		sc
options 	SC_PIXEL_MODE		# add support for the raster text mode

# vt is the new video console driver
device		vt
device		vt_vga
device		vt_efifb
device		vt_vbefb

# Serial (COM) ports
device		uart			# Generic UART driver

# PCI/PCI-X/PCIe Ethernet NICs that use iflib infrastructure
device		iflib
device		em			# Intel PRO/1000 Gigabit Ethernet Family

# Pseudo devices.
device		crypto			# core crypto support
device		aesni			# AES-NI OpenCrypto module
device		loop			# Network loopback
device		rdrand_rng		# Intel Bull Mountain RNG
device		ether			# Ethernet support
device		vlan			# 802.1Q VLAN support
device		tuntap			# Packet tunnel.
device		md			# Memory "disks"
device		gif			# IPv6 and IPv4 tunneling
device		firmware		# firmware assist module
device		xz			# lzma decompression
device		bpf			# Berkeley packet filter

# USB support
options 	USB_DEBUG		# enable debug msgs
device		uhci			# UHCI PCI->USB interface
device		ohci			# OHCI PCI->USB interface
device		ehci			# EHCI PCI->USB interface (USB 2.0)
device		xhci			# XHCI PCI->USB interface (USB 3.0)
device		usb			# USB Bus (required)
device		ukbd			# Keyboard
device		umass			# Disks/Mass storage - Requires scbus and da

# Sound support
device		sound			# Generic sound driver (required)
device		snd_hda			# Intel High Definition Audio
device		snd_ich			# Intel, NVidia and other ICH AC'97 Audio

# VirtIO support
device		virtio			# Generic VirtIO bus (required)
device		virtio_pci		# VirtIO PCI device
device		vtnet			# VirtIO Ethernet device
device		virtio_blk		# VirtIO Block device
device		virtio_scsi		# VirtIO SCSI device
device		virtio_balloon		# VirtIO Memory Balloon device

# Linux KVM paravirtualization support
device		kvm_clock		# KVM paravirtual clock driver

# evdev interface
options 	EVDEV_SUPPORT		# evdev support in legacy drivers
device		evdev			# input event device support
device		uinput			# install /dev/uinput cdev

# HID support
options 	HID_DEBUG		# enable debug msgs
device		hid			# Generic HID support
options 	IICHID_SAMPLING		# Workaround missing GPIO INTR support
Comment 1 commit-hook freebsd_committer freebsd_triage 2021-09-14 15:04:58 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=b1746faad6d690e43ac78ba3a9bca96c767ea729

commit b1746faad6d690e43ac78ba3a9bca96c767ea729
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2021-09-14 14:53:15 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2021-09-14 15:02:45 +0000

    debugnet: Include some required headers

    Don't depend on pollution from net/vnet.h.

    PR:             258496
    MFC after:      1 week
    Sponsored by:   The FreeBSD Foundation

 sys/net/debugnet.c | 4 ++++
 1 file changed, 4 insertions(+)
Comment 2 Mark Johnston freebsd_committer freebsd_triage 2021-09-14 15:05:06 UTC
I could not reproduce this with GENERIC with "options VIMAGE" removed.  But the commit will hopefully fix it.
Comment 3 ktullavik 2021-09-14 15:37:39 UTC
Thanks! Works for me now.
Comment 4 commit-hook freebsd_committer freebsd_triage 2021-09-21 13:48:58 UTC
A commit in branch stable/13 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=76985729102cf137b81ca57b1b0dbe61ee41e66d

commit 76985729102cf137b81ca57b1b0dbe61ee41e66d
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2021-09-14 14:53:15 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2021-09-21 13:37:42 +0000

    debugnet: Include some required headers

    Don't depend on pollution from net/vnet.h.

    PR:             258496
    Sponsored by:   The FreeBSD Foundation

    (cherry picked from commit b1746faad6d690e43ac78ba3a9bca96c767ea729)

 sys/net/debugnet.c | 4 ++++
 1 file changed, 4 insertions(+)
Comment 5 Mark Johnston freebsd_committer freebsd_triage 2021-09-21 13:50:58 UTC
Thanks for the report.