On Fri, Feb 09, 2024 at 08:44:25PM -0700, Theo de Raadt wrote: > Kenneth Westerback <kwesterb...@gmail.com> wrote: > > > Looks correct to me. The value returned by get_ucomnames() is only > > passed to find_ucom() where it is checked against NULL. > > Alternative diff in the kernel, *in addition* to the other diff. > > On a ucom-supporting kernel, if there are no matching devices the > sysctl returns the empty string. > > The correct value for the sysctl node should be "no ucom translations > information". > > So lack of support should return the empty string, not EINVAL. From > sysctl(2), EINVAL means either of these two conditions: > > [EINVAL] The name array is less than two or greater than > CTL_MAXNAME. > > [EINVAL] A non-null newp pointer is given and its specified > length in newlen is too large or too small. > > Neither of them apply. It's a made-up errno. Maybe some other error > would be more suitable, but empty string works just as well. > > Compile tested on GENERIC and RAMDISK, I did not try more than that.
~ > sysctl hw.ucomnames hw.ucomnames= cu seems to be satisfied.. i can get to my switch now. thanks a lot. -- missing dmesg: OpenBSD 7.4-stable (GTW) #7: Sat Feb 10 08:51:52 CET 2024 aph...@inet4.link:/usr/src/sys/arch/amd64/compile/GTW real mem = 17131495424 (16337MB) avail mem = 16612335616 (15842MB) random: good seed from bootblocks mpath0 at root scsibus0 at mpath0: 256 targets mainbus0 at root bios0 at mainbus0: SMBIOS rev. 2.8 @ 0x7f4ff000 (50 entries) bios0: vendor American Megatrends Inc. version "2.2" date 11/22/2019 bios0: Supermicro A1SAi acpi0 at bios0: ACPI 5.0 acpi0: sleep states S0 S5 acpi0: tables DSDT FACP FPDT FIDT SPMI MCFG WDAT UEFI APIC BDAT HPET SSDT HEST BERT ERST EINJ acpi0: wakeup devices PEX1(S0) PEX2(S0) PEX3(S0) PEX4(S0) EHC1(S0) acpitimer0 at acpi0: 3579545 Hz, 24 bits acpimcfg0 at acpi0 acpimcfg0: addr 0xe0000000, bus 0-255 acpimadt0 at acpi0 addr 0xfee00000: PC-AT compat cpu0 at mainbus0: apid 0 (boot processor) cpu0: Intel(R) Atom(TM) CPU C2550 @ 2.40GHz, 2400.35 MHz, 06-4d-08, patch 0000012d cpu0: FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,D cpu0: 24KB 64b/line 6-way D-cache, 32KB 64b/line 8-way I-cache, 1MB 64b/line 16-way L2 cache cpu0: smt 0, core 0, package 0 mtrr: Pentium Pro MTRR support, 8 var ranges, 88 fixed ranges cpu0: apic clock running at 100MHz cpu0: mwait min=64, max=64, C-substates=0.2.0.0.0.0.3, IBE cpu1 at mainbus0: apid 2 (application processor) cpu1: Intel(R) Atom(TM) CPU C2550 @ 2.40GHz, 2400.66 MHz, 06-4d-08, patch 0000012d cpu1: FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,D cpu1: 24KB 64b/line 6-way D-cache, 32KB 64b/line 8-way I-cache, 1MB 64b/line 16-way L2 cache cpu1: smt 0, core 1, package 0 cpu2 at mainbus0: apid 4 (application processor) cpu2: Intel(R) Atom(TM) CPU C2550 @ 2.40GHz, 2400.66 MHz, 06-4d-08, patch 0000012d cpu2: FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,D cpu2: 24KB 64b/line 6-way D-cache, 32KB 64b/line 8-way I-cache, 1MB 64b/line 16-way L2 cache cpu2: smt 0, core 2, package 0 cpu3 at mainbus0: apid 6 (application processor) cpu3: Intel(R) Atom(TM) CPU C2550 @ 2.40GHz, 2401.02 MHz, 06-4d-08, patch 0000012d cpu3: FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,D cpu3: 24KB 64b/line 6-way D-cache, 32KB 64b/line 8-way I-cache, 1MB 64b/line 16-way L2 cache cpu3: smt 0, core 3, package 0 ioapic0 at mainbus0: apid 2 pa 0xfec00000, version 20, 24 pins acpihpet0 at acpi0: 14318179 Hz acpiprt0 at acpi0: bus 0 (PCI0) acpiprt1 at acpi0: bus 1 (PEX1) acpiprt2 at acpi0: bus 2 (BR04) acpiprt3 at acpi0: bus 3 (PEX2) acpiprt4 at acpi0: bus 4 (PEX3) acpiprt5 at acpi0: bus -1 (PEX4) acpipci0 at acpi0 PCI0: 0x00000010 0x00000011 0x00000000 "PNP0003" at acpi0 not configured acpicmos0 at acpi0 "PNP0501" at acpi0 not configured "PNP0501" at acpi0 not configured "IPI0001" at acpi0 not configured "PNP0C33" at acpi0 not configured acpicpu0 at acpi0: C2(350@41 mwait.3@0x51), C1(1000@1 mwait.1), PSS acpicpu1 at acpi0: C2(350@41 mwait.3@0x51), C1(1000@1 mwait.1), PSS acpicpu2 at acpi0: C2(350@41 mwait.3@0x51), C1(1000@1 mwait.1), PSS acpicpu3 at acpi0: C2(350@41 mwait.3@0x51), C1(1000@1 mwait.1), PSS cpu0: using VERW MDS workaround cpu0: Enhanced SpeedStep 2400 MHz: speeds: 2401, 2400, 2300, 2200, 2100, 2000, 1900, 1800, 1700, 1600, 1500, 1400, 1300, 1200 MHz pci0 at mainbus0 bus 0 pchb0 at pci0 dev 0 function 0 "Intel Atom C2000 Host" rev 0x03 ppb0 at pci0 dev 1 function 0 "Intel Atom C2000 PCIE" rev 0x03: msi pci1 at ppb0 bus 1 ppb1 at pci1 dev 0 function 0 "ASPEED Technology AST1150 PCI" rev 0x03 pci2 at ppb1 bus 2 vga0 at pci2 dev 0 function 0 "ASPEED Technology AST2000" rev 0x30 wsdisplay0 at vga0 mux 1: console (80x25, vt100 emulation) wsdisplay0: screen 1-5 added (80x25, vt100 emulation) ppb2 at pci0 dev 2 function 0 "Intel Atom C2000 PCIE" rev 0x03: msi pci3 at ppb2 bus 3 xhci0 at pci3 dev 0 function 0 "Renesas uPD720201 xHCI" rev 0x03: msix, xHCI 1.0 usb0 at xhci0: USB revision 3.0 uhub0 at usb0 configuration 1 interface 0 "Renesas xHCI root hub" rev 3.00/1.00 addr 1 ppb3 at pci0 dev 3 function 0 "Intel Atom C2000 PCIE" rev 0x03: msi pci4 at ppb3 bus 4 pchb1 at pci0 dev 14 function 0 "Intel Atom C2000 RAS" rev 0x03 "Intel Atom C2000 RCEC" rev 0x03 at pci0 dev 15 function 0 not configured "Intel Atom C2000 SMBus" rev 0x03 at pci0 dev 19 function 0 not configured em0 at pci0 dev 20 function 0 "Intel I354 SGMII" rev 0x03: msi, address 3c:ec:ef:02:f0:18 em1 at pci0 dev 20 function 1 "Intel I354 SGMII" rev 0x03: msi, address 3c:ec:ef:02:f0:19 em2 at pci0 dev 20 function 2 "Intel I354 SGMII" rev 0x03: msi, address 3c:ec:ef:02:f0:1a em3 at pci0 dev 20 function 3 "Intel I354 SGMII" rev 0x03: msi, address 3c:ec:ef:02:f0:1b ehci0 at pci0 dev 22 function 0 "Intel Atom C2000 USB" rev 0x03: apic 2 int 23 usb1 at ehci0: USB revision 2.0 uhub1 at usb1 configuration 1 interface 0 "Intel EHCI root hub" rev 2.00/1.00 addr 1 ahci0 at pci0 dev 24 function 0 "Intel Atom C2000 AHCI" rev 0x03: msi, AHCI 1.3 ahci0: port 0: 6.0Gb/s ahci0: port 1: 6.0Gb/s scsibus1 at ahci0: 32 targets sd0 at scsibus1 targ 0 lun 0: <ATA, Samsung SSD 870, SVT0> naa.5002538f416156b9 sd0: 238475MB, 512 bytes/sector, 488397168 sectors, thin sd1 at scsibus1 targ 1 lun 0: <ATA, Samsung SSD 870, SVT0> naa.5002538f416156ba sd1: 238475MB, 512 bytes/sector, 488397168 sectors, thin pcib0 at pci0 dev 31 function 0 "Intel Atom C2000 PCU" rev 0x03 ichiic0 at pci0 dev 31 function 3 "Intel Atom C2000 PCU SMBus" rev 0x03: apic 2 int 18 iic0 at ichiic0 sdtemp0 at iic0 addr 0x18: mcp98243 sdtemp1 at iic0 addr 0x1a: stts2002 iic0: addr 0x2e 00=41 words 00=4141 01=0000 02=0000 03=0000 04=0000 05=0000 06=0000 07=0000 "eeprom" at iic0 addr 0x50 not configured "eeprom" at iic0 addr 0x52 not configured isa0 at pcib0 isadma0 at isa0 com0 at isa0 port 0x3f8/8 irq 4: ns16550a, 16 byte fifo com1 at isa0 port 0x2f8/8 irq 3: ns16550a, 16 byte fifo pcppi0 at isa0 port 0x61 spkr0 at pcppi0 vmm0 at mainbus0: VMX/EPT (using slow L1TF mitigation) uhub2 at uhub1 port 1 configuration 1 interface 0 "Intel product 0x07db" rev 2.00/0.03 addr 2 uhub3 at uhub2 port 3 configuration 1 interface 0 "ATEN International product 0x7000" rev 2.00/0.00 addr 3 uhidev0 at uhub3 port 1 configuration 1 interface 0 "ATEN International product 0x2419" rev 1.10/1.00 addr 4 uhidev0: iclass 3/1 ukbd0 at uhidev0: 8 variable keys, 6 key codes wskbd0 at ukbd0: console keyboard, using wsdisplay0 uhidev1 at uhub3 port 1 configuration 1 interface 1 "ATEN International product 0x2419" rev 1.10/1.00 addr 4 uhidev1: iclass 3/1 ums0 at uhidev1: 3 buttons, Z dir wsmouse0 at ums0 mux 0 vscsi0 at root scsibus2 at vscsi0: 256 targets softraid0 at root scsibus3 at softraid0: 256 targets sd2 at scsibus3 targ 1 lun 0: <OPENBSD, SR RAID 1, 006> sd2: 238472MB, 512 bytes/sector, 488391473 sectors root on sd2a (a63d0965ad5ad0ac.a) swap on sd2b dump on sd2b > > Index: kern_sysctl.c > =================================================================== > RCS file: /cvs/src/sys/kern/kern_sysctl.c,v > diff -u -p -u -r1.424 kern_sysctl.c > --- kern_sysctl.c 19 Jan 2024 01:43:27 -0000 1.424 > +++ kern_sysctl.c 10 Feb 2024 03:39:16 -0000 > @@ -771,14 +771,13 @@ hw_sysctl(int *name, u_int namelen, void > case HW_ALLOWPOWERDOWN: > return (sysctl_securelevel_int(oldp, oldlenp, newp, newlen, > &allowpowerdown)); > -#if NUCOM > 0 > case HW_UCOMNAMES: { > - const char *str = sysctl_ucominit(); > - if (str == NULL) > - return EINVAL; > + const char *str = ""; > +#if NUCOM > 0 > + str = sysctl_ucominit(); > +#endif /* NUCOM > 0 */ > return (sysctl_rdstring(oldp, oldlenp, newp, str)); > } > -#endif /* NUCOM > 0 */ > #ifdef __HAVE_CPU_TOPOLOGY > case HW_SMT: > return (sysctl_hwsmt(oldp, oldlenp, newp, newlen));