>Synopsis: can't getifaddrs(3) when pledged
>Category: documentation
>Environment:
System : OpenBSD 8.0
Details : OpenBSD 8.0-current (GENERIC.MP) #167: Sun Nov 22
17:55:31 CST 2026
[email protected]:/usr/src/sys/arch/amd64/compile/GENERIC.MP
Architecture: OpenBSD.amd64
Machine : amd64
>Description:
The manpage does not make it clear which pledge promise is
required for getifaddrs(3) to work. man 2 pledge lists
getifaddrs(3) under the sysctl(2) calls that are (read only)
allowed. When using getifaddrs() after pledge("stdio", 0), the
program is terminated, with the message:
pledge "", syscall 202
which does not say which promise to add.
>How-To-Repeat:
#include <unistd.h>
#include <ifaddrs.h>
#include <err.h>
#include <stdio.h>
int main(void) {
struct ifaddrs *ifa = NULL;
if (pledge("stdio", ""))
err(1, "pledge");
if (getifaddrs(&ifa))
err(1, "getifaddrs");
printf("%p\n", ifa);
return 0;
}
dmesg:
OpenBSD 8.0-current (GENERIC.MP) #167: Sun Nov 22 17:55:31 CST 2026
[email protected]:/usr/src/sys/arch/amd64/compile/GENERIC.MP
real mem = 17117032448 (16324MB)
avail mem = 16574451712 (15806MB)
random: good seed from bootblocks
mpath0 at root
scsibus0 at mpath0: 256 targets
mainbus0 at root
bios0 at mainbus0: SMBIOS rev. 3.1 @ 0x7fe25040 (22 entries)
bios0: vendor coreboot version "CBET4000 26.06-1311-g070787ff5195-dirty"
date 10/05/2026
bios0: LENOVO 23252CG
acpi0 at bios0: ACPI 6.0
acpi0: sleep states S0 S1 S3 S4 S5
acpi0: tables DSDT FACP SSDT MCFG TCPA APIC DMAR HPET
acpi0: wakeup devices HDEF(S4) EHC1(S4) EHC2(S4) XHC_(S4) SLPB(S3) LID_(S3)
acpitimer0 at acpi0: 3579545 Hz, 24 bits
acpimcfg0 at acpi0
acpimcfg0: addr 0xf0000000, bus 0-63
acpimadt0 at acpi0 addr 0xfee00000: PC-AT compat
cpu0 at mainbus0: apid 0 (boot processor)
cpu0: Intel(R) Core(TM) i5-3320M CPU @ 2.60GHz, 3093.08 MHz, 06-3a-09,
patch 00000021
cpu0: cpuid 1
edx=bfebfbff<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>
ecx=77bae3ff<SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,SMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,x2APIC,POPCNT,DEADLINE,AES,XSAVE,AVX,F16C,RDRAND>
cpu0: cpuid 6 eax=77<SENSOR,ARAT,PTS> ecx=9<EFFFREQ>
cpu0: cpuid 7.0 ebx=281<FSGSBASE,SMEP,ERMS>
edx=9c000400<MD_CLEAR,IBRS,IBPB,STIBP,L1DF,SSBD>
cpu0: cpuid a vers=3, gp=4, gpwidth=48, ff=3, ffwidth=48
cpu0: cpuid d.1 eax=1<XSAVEOPT>
cpu0: cpuid 80000001 edx=28100800<NXE,RDTSCP,LONG> ecx=1<LAHF>
cpu0: cpuid 80000007 edx=100<ITSC>
cpu0: MELTDOWN
cpu0: 32KB 64b/line 8-way D-cache, 32KB 64b/line 8-way I-cache, 256KB
64b/line 8-way L2 cache, 3MB 64b/line 12-way L3 cache
cpu0: smt 0, core 0, package 0, type P
mtrr: Pentium Pro MTRR support, 10 var ranges, 88 fixed ranges
cpu0: apic clock running at 99MHz
cpu0: mwait min=64, max=64, C-substates=0.2.1.1.2, IBE
cpu1 at mainbus0: apid 2 (application processor)
cpu1: Intel(R) Core(TM) i5-3320M CPU @ 2.60GHz, 2784.54 MHz, 06-3a-09,
patch 00000021
cpu1: smt 0, core 1, package 0, type P
cpu2 at mainbus0: apid 1 (application processor)
cpu2: Intel(R) Core(TM) i5-3320M CPU @ 2.60GHz, 2793.83 MHz, 06-3a-09,
patch 00000021
cpu2: smt 1, core 0, package 0, type SP
cpu3 at mainbus0: apid 3 (application processor)
cpu3: Intel(R) Core(TM) i5-3320M CPU @ 2.60GHz, 2793.83 MHz, 06-3a-09,
patch 00000021
cpu3: smt 1, core 1, package 0, type SP
ioapic0 at mainbus0: apid 0 pa 0xfec00000, version 20, 24 pins
acpihpet0 at acpi0: 14318179 Hz
acpiprt0 at acpi0: bus 0 (PCI0)
acpiprt1 at acpi0: bus 1 (RP01)
acpiprt2 at acpi0: bus 2 (RP02)
acpiprt3 at acpi0: bus 3 (RP03)
acpiprt4 at acpi0: bus -1 (RP04)
acpiprt5 at acpi0: bus -1 (RP05)
acpiprt6 at acpi0: bus -1 (RP06)
acpiprt7 at acpi0: bus -1 (RP07)
acpiprt8 at acpi0: bus -1 (RP08)
acpiec0 at acpi0
acpipci0 at acpi0 PCI0: 0x00000000 0x00000011 0x00000001
acpiac0 at acpi0: AC unit offline
acpibat0 at acpi0: BAT0 model "45N1023" serial 9001 type LION oem "SANYO"
acpibat1 at acpi0: BAT1 not present
acpibtn0 at acpi0: SLPB(wakeup)
acpibtn1 at acpi0: LID_(wakeup)
acpithinkpad0 at acpi0: version 1.0
acpicmos0 at acpi0
"PNP0303" at acpi0 not configured
"LEN0020" at acpi0 not configured
tpm0 at acpi0 TPM_ 1.2 (TIS) addr 0xfed40000/0x5000, device 0x0000104a
rev 0x4e
acpicpu0 at acpi0: C3(200@90 mwait.1@0x30), C2(500@63 mwait.1@0x10),
C1(1000@1 mwait.1), PSS
acpicpu1 at acpi0: C3(200@90 mwait.1@0x30), C2(500@63 mwait.1@0x10),
C1(1000@1 mwait.1), PSS
acpicpu2 at acpi0: C3(200@90 mwait.1@0x30), C2(500@63 mwait.1@0x10),
C1(1000@1 mwait.1), PSS
acpicpu3 at acpi0: C3(200@90 mwait.1@0x30), C2(500@63 mwait.1@0x10),
C1(1000@1 mwait.1), PSS
"PNP0C0B" at acpi0 not configured
"BOOT0000" at acpi0 not configured
acpitz0 at acpi0
acpitz0: critical temperature is 100 degC
acpipwrres0 at acpi0: FPWR, resource for FAN_
acpivideo0 at acpi0: GFX0
acpivout0 at acpivideo0: LCD0
cpu0: using VERW MDS workaround (except on vmm entry)
cpu0: Enhanced SpeedStep 3093 MHz: speeds: 2601, 2600, 2400, 2200, 2000,
1800, 1600, 1400, 1200 MHz
pci0 at mainbus0 bus 0
pchb0 at pci0 dev 0 function 0 "Intel Core 3G Host" rev 0x09
inteldrm0 at pci0 dev 2 function 0 "Intel HD Graphics 4000" rev 0x09
drm0 at inteldrm0
inteldrm0: msi, IVYBRIDGE, gen 7
xhci0 at pci0 dev 20 function 0 "Intel 7 Series xHCI" rev 0x04: msi,
xHCI 1.0
usb0 at xhci0: USB revision 3.0
uhub0 at usb0 configuration 1 interface 0 "Intel xHCI root hub" rev
3.00/1.00 addr 1
em0 at pci0 dev 25 function 0 "Intel 82579LM" rev 0x04: msi, address
00:g0:0d:b0:y0:42
ehci0 at pci0 dev 26 function 0 "Intel 7 Series USB" rev 0x04: apic 0 int 19
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
azalia0 at pci0 dev 27 function 0 "Intel 7 Series HD Audio" rev 0x04: msi
azalia0: codecs: Realtek ALC269, Intel/0x2806, using Realtek ALC269
audio0 at azalia0
ppb0 at pci0 dev 28 function 0 "Intel 7 Series PCIE" rev 0xc4: msi
pci1 at ppb0 bus 1
sdhc0 at pci1 dev 0 function 0 "Ricoh 5U823 SD/MMC" rev 0x04: msi
sdhc0: SDHC 3.00, 50 MHz base clock
sdmmc0 at sdhc0: 4-bit, sd high-speed, mmc high-speed, dma
ppb1 at pci0 dev 28 function 1 "Intel 7 Series PCIE" rev 0xc4: msi
pci2 at ppb1 bus 2
iwn0 at pci2 dev 0 function 0 "Intel Centrino Advanced-N 6205" rev 0x34:
msi, MIMO 2T2R, MoW, address 00:ba:dc:ab:1e:00
ppb2 at pci0 dev 28 function 2 "Intel 7 Series PCIE" rev 0xc4: msi
pci3 at ppb2 bus 3
ehci1 at pci0 dev 29 function 0 "Intel 7 Series USB" rev 0x04: apic 0 int 18
usb2 at ehci1: USB revision 2.0
uhub2 at usb2 configuration 1 interface 0 "Intel EHCI root hub" rev
2.00/1.00 addr 1
pcib0 at pci0 dev 31 function 0 "Intel QM77 LPC" rev 0x04
ahci0 at pci0 dev 31 function 2 "Intel 7 Series AHCI" rev 0x04: msi,
AHCI 1.3
ahci0: port 0: 6.0Gb/s
scsibus1 at ahci0: 32 targets
sd0 at scsibus1 targ 0 lun 0: <ATA, SAMSUNG MZ7TD256, DXT0>
naa.5002538500000000
sd0: 244198MB, 512 bytes/sector, 500118192 sectors, thin
ichiic0 at pci0 dev 31 function 3 "Intel 7 Series SMBus" rev 0x04: apic
0 int 16
iic0 at ichiic0
iic0: addr 0x24 03=04 09=23 0a=49 0b=16 0c=02 0d=30 0e=11 0f=26 words
00=00ff 01=00ff 02=00ff 03=04ff 04=00ff 05=00ff 06=00ff 07=00ff
spdmem0 at iic0 addr 0x50: 8GB DDR3 SDRAM PC3-12800 SO-DIMM
spdmem1 at iic0 addr 0x51: 8GB DDR3 SDRAM PC3-12800 SO-DIMM
"Intel 7 Series Thermal" rev 0x04 at pci0 dev 31 function 6 not configured
isa0 at pcib0
isadma0 at isa0
pckbc0 at isa0 port 0x60/5 irq 1 irq 12
pckbd0 at pckbc0 (kbd slot)
wskbd0 at pckbd0: console keyboard
pms0 at pckbc0 (aux slot)
wsmouse0 at pms0 mux 0
wsmouse1 at pms0 mux 0
pms0: Synaptics clickpad, firmware 8.1, 0x1e2b1 0x940300 0x194b40
0xd002a3 0x123800
pcppi0 at isa0 port 0x61
spkr0 at pcppi0
vmm0 at mainbus0: VMX/EPT
efifb at mainbus0 not configured
iwn0: restrict all mbufs to low memory
uhub3 at uhub1 port 1 configuration 1 interface 0 "Intel Rate Matching
Hub" rev 2.00/0.00 addr 2
ugen0 at uhub3 port 3 "Auth Biometric Coprocessor" rev 1.10/0.01 addr 3
ugen1 at uhub3 port 4 "Broadcom Corp BCM20702A0" rev 2.00/1.12 addr 4
uvideo0 at uhub3 port 6 configuration 1 interface 0 "Chicony Electronics
Co., Ltd. Integrated Camera" rev 2.00/5.20 addr 5
video0 at uvideo0
uhub4 at uhub2 port 1 configuration 1 interface 0 "Intel Rate Matching
Hub" rev 2.00/0.00 addr 2
vscsi0 at root
scsibus2 at vscsi0: 256 targets
softraid0 at root
scsibus3 at softraid0: 256 targets
sd1 at scsibus3 targ 1 lun 0: <OPENBSD, SR CRYPTO, 006>
sd1: 244198MB, 512 bytes/sector, 500117600 sectors
root on sd1a (4495d2cf7b3269eb.a) swap on sd1b dump on sd1b
inteldrm0: 1366x768, 32bpp
wsdisplay0 at inteldrm0 mux 1: console (std, vt100 emulation), using wskbd0
wsdisplay0: screen 1-5 added (std, vt100 emulation)