From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 24D383858D28; Sun, 30 Apr 2023 06:28:36 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 24D383858D28 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1682836116; bh=HWAJr+0/oe3TSBWmhhhd3nskDkQyrGS3GEt1tLlx12o=; h=From:To:Subject:Date:From; b=IEn0olwEjUCBm4abHvD6RFgu8JpHXlPtIjxoSV62foBZZj4RLaJHfFnnK7o7XvDcA 5uXmigb3Mm0JMbiFy0aSCjjQXia8HuxzIsFzbyxWWmhz3PggWepa9xOlkIEsp/JUsS IWTzzJoy6CTIKuSksn70F7Ov4epTVQo7yQVWtm+s= From: "agentzh at gmail dot com" To: systemtap@sourceware.org Subject: [Bug runtime/30408] New: Always fail to read userland memory (read faults) inside perf event probes with 6.2 kernels Date: Sun, 30 Apr 2023 06:28:35 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: systemtap X-Bugzilla-Component: runtime X-Bugzilla-Version: unspecified X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: agentzh at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: systemtap at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://sourceware.org/bugzilla/show_bug.cgi?id=3D30408 Bug ID: 30408 Summary: Always fail to read userland memory (read faults) inside perf event probes with 6.2 kernels Product: systemtap Version: unspecified Status: UNCONFIRMED Severity: normal Priority: P2 Component: runtime Assignee: systemtap at sourceware dot org Reporter: agentzh at gmail dot com Target Milestone: --- I've noted a regression of stap when using Fedora 36 x86_64's latest 6.2.12 kernel. It always fails to read userland memory inside a perf event probe handler. It can be demonstrated by the following minimal example. First prepare a small C program as the tracing target: ``` #include unsigned long a =3D 0; void foo (void) { FILE *f =3D fopen("/dev/null", "w"); fputs("hello world!\n", f); fclose(f); } int main (void) { while (1) { a++; for (int i =3D 0; i < 100; i++) { foo(); foo(); } } return 0; } ``` Then we compile it with debug symbols: ``` gcc -g a.c ``` And we copy the resulting `./a.out` program file to `/tmp/`: ``` cp a.out /tmp/ ``` Now we prepare a small stap script file named c.stp: ``` global fails =3D 0; probe perf.type(1).config(0).sample(1000000) { if (execname() =3D=3D "a.out") { ok =3D 1; val =3D 0; try { val =3D @var("a", "/tmp/a.out"); } catch { ok =3D 0; fails++; } if (ok) { printf("a =3D %d\n", val); exit(); } } } probe begin { warn("Start tracing..."); } probe timer.s(2) { printf("failed %ld times\n", fails); } ``` And we run it like this: ``` /opt/stap/bin/stap -c /tmp/a.out c.stp WARNING: Start tracing... failed 3927 times failed 7854 times failed 11769 times failed 15741 times failed 19705 times failed 23671 times failed 27668 times failed 31639 times failed 35613 times failed 39563 times failed 43491 times failed 47463 times failed 51465 times ... ``` No matter how long we wait, it always fails to read anything from `@var()`. For comparison, I also ran this example on an older kernel (5.0.16) of an o= lder Fedora system and it works fine: ``` $ /opt/stap/bin/stap -c ./a.out c.stp WARNING: Start tracing... a =3D 150746 ``` So it's definitely a behavior regression with the new kernel. --=20 You are receiving this mail because: You are the assignee for the bug.=