[Bug 278347] pmcstat: crash on image processing

From: <bugzilla-noreply_at_freebsd.org>
Date: Sat, 13 Apr 2024 15:39:49 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=278347

            Bug ID: 278347
           Summary: pmcstat: crash on image processing
           Product: Base System
           Version: CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: bin
          Assignee: bugs@FreeBSD.org
          Reporter: mizhka@FreeBSD.org

Just got crash on CURRENT trying to run:

pmcstat -T -S instructions -w 1 

under load of poudriere (48 cores, 256GiB RAM, 40 processes) with stack trace:

(lldb) bt
* thread #1, name = 'pmcstat', stop reason = signal SIGSEGV
    frame #0: 0x000026a91d2f2e04
pmcstat`pmcstat_string_lookup_hash(s=0x0000000000000000) at
libpmcstat_string.c:120:14
    frame #1: 0x000026a91d2f13e0
pmcstat`pmcstat_image_from_path(internedpath=<unavailable>,
iskernelmodule=<unavailable>, args=<unavailable>, plugins=0x000026a91d2f5d60)
at libpmcstat_image.c:513:9
  * frame #2: 0x000026a91d2f2585
pmcstat`pmcstat_process_elf_exec(pp=0x000047dc37957dd0,
image=0x000047dc35c0fdc0, baseaddr=51616457125888, dynaddr=<unavailable>,
args=0x000026a91d2f6490, plugins=0x000026a91d2f5d60,
pmcstat_stats=0x000026a91d2f6610) at libpmcstat_process.c:117:15
    frame #3: 0x000026a91d2f26dc pmcstat`pmcstat_process_exec(pp=<unavailable>,
path=<unavailable>, baseaddr=<unavailable>, dynaddr=<unavailable>,
args=<unavailable>, plugins=<unavailable>, pmcstat_stats=<no summary
available>) at libpmcstat_process.c:167:3 [artificial]
    frame #4: 0x000026a91d2f1a0c
pmcstat`pmcstat_analyze_log(args=0x000026a91d2f6490,
plugins=0x000026a91d2f5d60, pmcstat_stats=0x000026a91d2f6610,
pmcstat_kernproc=0x000047dc35c31030, pmcstat_mergepmc=1,
pmcstat_npmcs=0x000026a91d2f6644, ps_samples_period=0x000026a91d2f6648) at
libpmcstat_logging.c:352:4
    frame #5: 0x000026a91d2eb48a pmcstat`pmcstat_process_log at
pmcstat_log.c:532:11
    frame #6: 0x000026a91d2eaddf pmcstat`main(argc=<unavailable>,
argv=<unavailable>) at pmcstat.c:1364:16
    frame #7: 0x000026b14534b87a libc.so.7`__libc_start1(argc=6,
argv=0x000026b13df19800, env=0x000026b13df19838, cleanup=<unavailable>,
mainX=(pmcstat`main at pmcstat.c:440)) at libc_start1.c:157:7
    frame #8: 0x000026a91d2e858d pmcstat`_start at crt1_s.S:83

Interesting frame #3 contains image with NULL dynlinkerpath:

(lldb) print *image
(pmcstat_image) {
  pi_next = {
    le_next = NULL
    le_prev = 0x000047dc36a82ec0
  }
  pi_execpath = 0x000047dc36b14ba0
  pi_samplename = 0xa5a5a5a5a5a5a5a5
  pi_fullpath = 0x000047dc36b14ba0
  pi_name = 0x000047dc36b370a0
  pi_type = PMCSTAT_IMAGE_ELF64
  pi_start = 27360
  pi_end = 113441
  pi_entry = 0
  pi_vaddr = 24576
  pi_isdynamic = 1
  pi_iskernelmodule = 0
  pi_dynlinkerpath = 0x0000000000000000
  pi_symbols = 0x000047dc35ce1180
  pi_symcount = 23
  pi_addr2line = NULL
  pi_gmlist = {
    lh_first = 0xa5a5a5a5a5a5a5a5
  }
}

It seems reproducible (at least 3 consecutive tries).

-- 
You are receiving this mail because:
You are the assignee for the bug.