SYNOPSIS: using -pg with cc results in segfault
CATEGORY: system
        System      : OpenBSD 7.4
Details : OpenBSD 7.4-current (GENERIC) #1399: Wed Nov 22 08:12:44 MST 2023

        Architecture: OpenBSD.amd64
        Machine     : amd64
Is gprof and related compiler switches expected to work?

Or, in reading the backtrace, is there an issue with issetugid?

Or, is this some syscall issue (see end of dmesg)?


$ cat m.c
#include <stdio.h>
#include <math.h>

main() {
    printf("m.c PI is %f\n", M_PI);
$ cc -o m.x m.c -lm
$ ./m.x
m.c PI is 3.141593
$ cc -o m.x -pg m.c -lm
$ ./m.x
Segmentation fault

$ egdb -se=m.x
GNU gdb (GDB) 9.2
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-unknown-openbsd7.4".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
Find the GDB manual and other documentation resources online at:

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from m.x...
(gdb) run
Starting program: /home/j/rnums/m.x

Program received signal SIGSEGV, Segmentation fault.
issetugid () at /tmp/-:2
2       /tmp/-: No such file or directory.
(gdb) bt
#0  issetugid () at /tmp/-:2
#1  0xedb40a3fe8c37d01 in ?? ()
#2  0x0000000000217b1c in _libc_preinit (argc=<optimized out>,
argv=<optimized out>, envp=<optimized out>, cb=0x2a1f7bd10 <_dl_cb_cb>)
    at /usr/src/lib/libc/dlfcn/init.c:128
#3  0x00000002a1f77658 in _dl_call_preinit (object=0x23c006000)
    at /usr/src/libexec/
#4 _dl_boot (argv=0x71f26696af68, envp=<optimized out>, dyn_loff=11307266048,
    dl_data=0x71f26696aed0) at /usr/src/libexec/
#5 0x00000002a1f76366 in _dl_start () at /usr/src/libexec/
#6  0x0000000000000000 in ?? ()

OpenBSD 7.4-current (GENERIC) #1399: Wed Nov 22 08:12:44 MST 2023
real mem = 8573091840 (8175MB)
avail mem = 8293748736 (7909MB)
random: good seed from bootblocks
mpath0 at root
scsibus0 at mpath0: 256 targets
mainbus0 at root
bios0 at mainbus0: SMBIOS rev. 2.5 @ 0xe1000 (10 entries)
bios0: vendor innotek GmbH version "VirtualBox" date 12/01/2006
bios0: innotek GmbH VirtualBox
acpi0 at bios0: ACPI 4.0
acpi0: sleep states S0 S5
acpi0: tables DSDT FACP APIC SSDT
acpi0: wakeup devices
acpitimer0 at acpi0: 3579545 Hz, 32 bits
acpimadt0 at acpi0 addr 0xfee00000: PC-AT compat
cpu0 at mainbus0: apid 0 (boot processor)
cpu0: AMD Ryzen 7 PRO 3700 8-Core Processor, 3600.21 MHz, 17-71-00, patch 06000626 cpu0: FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLU
cpu0: 32KB 64b/line 8-way D-cache, 32KB 64b/line 8-way I-cache
cpu0: 512KB 64b/line 8-way L2 cache
cpu0: smt 0, core 0, package 0
mtrr: CPU supports MTRRs but not enabled by BIOS
cpu0: apic clock running at 1000MHz
cpu at mainbus0: not configured
cpu at mainbus0: not configured
cpu at mainbus0: not configured
ioapic0 at mainbus0: apid 4 pa 0xfec00000, version 20, 24 pins, remapped
acpiprt0 at acpi0: bus 0 (PCI0)
acpipci0 at acpi0 PCI0: 0x00000000 0x00000011 0x00000001
acpiac0 at acpi0: AC unit online
acpicpu0 at acpi0: C1(@1 halt!)
acpivideo0 at acpi0: GFX0
pci0 at mainbus0 bus 0
pchb0 at pci0 dev 0 function 0 "Intel 82441FX" rev 0x02
pcib0 at pci0 dev 1 function 0 "Intel 82371SB ISA" rev 0x00
pciide0 at pci0 dev 1 function 1 "Intel 82371AB IDE" rev 0x01: DMA, channel 0 conf
igured to compatibility, channel 1 configured to compatibility
wd0 at pciide0 channel 0 drive 0: <VBOX HARDDISK>
wd0: 128-sector PIO, LBA, 97642MB, 199970816 sectors
wd0(pciide0:0:0): using PIO mode 4, Ultra-DMA mode 2
pciide0: channel 1 disabled (no drives)
vga1 at pci0 dev 2 function 0 "VMware SVGA II" rev 0x00
wsdisplay0 at vga1 mux 1: console (80x25, vt100 emulation)
wsdisplay0: screen 1-5 added (80x25, vt100 emulation)
em0 at pci0 dev 3 function 0 "Intel 82540EM" rev 0x02: apic 4 int 19, address 08:0
"InnoTek Guest Service" rev 0x00 at pci0 dev 4 function 0 not configured
auich0 at pci0 dev 5 function 0 "Intel 82801AA AC97" rev 0x01: apic 4 int 21, ICH ac97: codec id 0x83847600 (SigmaTel STAC9700)
audio0 at auich0
ohci0 at pci0 dev 6 function 0 "Apple Intrepid USB" rev 0x00: apic 4 int 22, versi
on 1.0
piixpm0 at pci0 dev 7 function 0 "Intel 82371AB Power" rev 0x08: apic 4 int 23
iic0 at piixpm0
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, using wsdisplay0
pms0 at pckbc0 (aux slot)
wsmouse0 at pms0 mux 0
pcppi0 at isa0 port 0x61
spkr0 at pcppi0
usb0 at ohci0: USB revision 1.0
uhub0 at usb0 configuration 1 interface 0 "Apple OHCI root hub" rev 1.00/1.00 addr 1
vmm0 at mainbus0: unknown
vscsi0 at root
scsibus1 at vscsi0: 256 targets
softraid0 at root
scsibus2 at softraid0: 256 targets
root on wd0a (5c16da051bcc7251.a) swap on wd0b dump on wd0b
WARNING: /mnt was not properly unmounted
...snip...various bogus syscall complaints for other programs.....
[m.x]52763/119602 pc=21def6 inside 2e068a000-2e0695fff: bogus syscall
[m.x]57870/52895 pc=21def6 inside 2a1f78000-2a1f83fff: bogus syscall
[m.x]37732/225490 pc=21def6 inside 297ed1000-297edcfff: bogus syscall
[m.x]54999/307977 pc=21def6 inside 2a12f6000-2a1301fff: bogus syscall

Reply via email to