From nobody Tue Jan 10 14:59:49 2023 X-Original-To: bugs@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Nrv9f07J7z2qw3M for ; Tue, 10 Jan 2023 14:59:50 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Nrv9d56LDz3r1y for ; Tue, 10 Jan 2023 14:59:49 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1673362789; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=GFlZy/w445C+O6r1PEHAr+UZxCz3MD3aJRytJtj7VOI=; b=VCowMCIlkberRS2a/n/SDRqlM1k2V1ZX9S3L1c1dXB0/sF0ZoJDaQBAi8azHKaEdcADtYr ZTywQzm+E5PN3nr86BBMZXBsymCBzf0vV+NVoT1MfNn5+y/kQQ5V4oXAXF4u0ZFXwdWxm0 +V9aOBFMPvu61cz2Jb7zskGV2pqI91+i4wdxppyTohe5x/8QmnTIiaycrGvmOtCt4iLJF6 JyR1Vuq3IY8SeTNiSxPRaMSDC/i2agF+2r1nk7d5CCSvEm1ixGvEylfLvWomTQentNNynU 0kYEmfYUqpNc8bqj3d5oR9Noe36KZUkiFGGNRIHuJdJqBjGVHrq/NAyRpYaBGw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1673362789; a=rsa-sha256; cv=none; b=aanHpGMWfuZXuxJL3beAT+pvaAjDycUJaUtZLOwpckuO9lg08/9U85u8PBMe9iXKOQccit oPg4qN1TnivBS51VhIbbVpA0BTBm6poIUzrvVYvqd26Njy8qhxQzXMjzZddm0jOewna3pD 2V+jm1ULJVE5rW5WvjDo8I74yYVh/fV+S4H3Kfyfeyn3qg/iCv7vo2YlPNav0+FXs/fc6T vJYR4Jb3AePjTL3LoER5+6IIUVrd3YsS3g2Sc9yG0IossWhckPhHt9MtPRZD152CjxOfEJ XLBuO/sVnhuoKpd/gKH+5XH3Oa1yGvGlVAr7u+L9E+Srsi4dExyXUi/jlRWeBA== Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Nrv9d49J9z1C4c for ; Tue, 10 Jan 2023 14:59:49 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 30AExnpR040892 for ; Tue, 10 Jan 2023 14:59:49 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 30AExnT2040890 for bugs@FreeBSD.org; Tue, 10 Jan 2023 14:59:49 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 268857] pmcstat crashes on particular event/CPU combination Date: Tue, 10 Jan 2023 14:59:49 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: bin X-Bugzilla-Version: 13.1-STABLE X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: jfc@mit.edu X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Bug reports List-Archive: https://lists.freebsd.org/archives/freebsd-bugs List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-bugs@freebsd.org MIME-Version: 1.0 X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D268857 Bug ID: 268857 Summary: pmcstat crashes on particular event/CPU combination Product: Base System Version: 13.1-STABLE Hardware: amd64 OS: Any Status: New Severity: Affects Only Me Priority: --- Component: bin Assignee: bugs@FreeBSD.org Reporter: jfc@mit.edu The following command crashes on Zen CPUs but not older AMD CPUs: $ pmcstat -P k8-ic-refill-from-l2 echo -n initlog 0x9030000 "AMD_K8" Segmentation fault (core dumped) Perhaps "k8-ic-refill-from-l2" is not a valid event for Zen. That is not easily discoverable and should not crash the program. lldb says * thread #1, name =3D 'pmcstat', stop reason =3D breakpoint 1.1 frame #0: 0x000000720ad83c02 libpmc.so.5`pmc_pmu_event_get_by_idx(cpuid=3D, idx=3D8350) at libpmc_pmu_util.c:293:2 290=20=20 291 if ((pme =3D pmu_events_map_get(cpuid)) =3D=3D NULL) 292 return (NULL); -> 293 assert(pme->table[idx].name); 294 return (pme->table[idx].name); 295 } 296=20=20 (lldb) p pme (const pmu_events_map *) $2 =3D 0x000000720af7f9f0 (lldb) p *pme (const pmu_events_map) $3 =3D { cpuid =3D 0x000000720abe6054 "AuthenticAMD-23-[[:xdigit:]]+" version =3D 0x000000720ad0c2ad "v1" type =3D 0x000000720ad18386 "core" table =3D 0x000000720af70890 } Array index idx=3D8350 is out of bounds and looking up pme->table[idx].name causes a segfault. I would suggest a bounds check, but I don't see any arr= ay size field to compare against. More specifically, pmcstat crashes on CPU: AMD EPYC 7402P 24-Core Processor (2794.84-MHz K8-class = CPU) Origin=3D"AuthenticAMD" Id=3D0x830f10 Family=3D0x17 Model=3D0x31 Step= ping=3D0 CPU: AMD Ryzen 5 PRO 2400GE w/ Radeon Vega Graphics (3194.22-MHz K8-class = CPU) Origin=3D"AuthenticAMD" Id=3D0x810f10 Family=3D0x17 Model=3D0x11 Step= ping=3D0 but pmcstat does not crash on CPU: AMD Opteron(tm) X3421 APU (2096.10-MHz K8-class = CPU) Origin=3D"AuthenticAMD" Id=3D0x660f01 Family=3D0x15 Model=3D0x60 Step= ping=3D1 I am reporting against 13.1-STABLE. The bug is also present in CURRENT as = of last summer. --=20 You are receiving this mail because: You are the assignee for the bug.=