From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 4BB833858434; Tue, 5 Apr 2022 19:07:55 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4BB833858434 From: "wcohen at redhat dot com" To: systemtap@sourceware.org Subject: [Bug translator/29028] New: Linux 5.18.0 kernels changed struct kretprobe_instance member fields and scripts with return probes fail to compile Date: Tue, 05 Apr 2022 19:07:55 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: systemtap X-Bugzilla-Component: translator X-Bugzilla-Version: unspecified X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: wcohen at redhat dot com X-Bugzilla-Status: NEW 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 X-BeenThere: systemtap@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Systemtap mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Apr 2022 19:07:55 -0000 https://sourceware.org/bugzilla/show_bug.cgi?id=3D29028 Bug ID: 29028 Summary: Linux 5.18.0 kernels changed struct kretprobe_instance member fields and scripts with return probes fail to compile Product: systemtap Version: unspecified Status: NEW Severity: normal Priority: P2 Component: translator Assignee: systemtap at sourceware dot org Reporter: wcohen at redhat dot com Target Milestone: --- The following kernel commit 73f9b911faa74ac5107879de05c9489c419f41bb in the linux 5.18.0-rc kernel changed the struct kretprobe_instance members which causes scripts with return kernel probes fail to build: kprobes: Use rethook for kretprobe if possible Use rethook for kretprobe function return hooking if the arch sets CONFIG_HAVE_RETHOOK=3Dy. In this case, CONFIG_KRETPROBE_ON_RETHOOK is set to 'y' automatically, and the kretprobe internal data fields switches to use rethook. If not, it continues to use kretprobe specific function return hooks. Suggested-by: Peter Zijlstra Signed-off-by: Masami Hiramatsu Signed-off-by: Alexei Starovoitov Link: https://lore.kernel.org/bpf/164826162556.2455864.12255833167233452047.stgit= @devnote2 On Fedora 37 (rawhide) running kernel-5.18.0-0.rc0.20220401gite8b767f5e04097a.15.fc37.x86_64 and locally b= uilt systemtap from git checkout can replicate the issue with: $ sudo ../install/bin/stap --example alias_suffixes.stp -T 1 In file included from /home/wcohen/systemtap_write/install/share/systemtap/runtime/linux/../regs.= c:16, from /home/wcohen/systemtap_write/install/share/systemtap/runtime/linux/runtime.= h:270, from /home/wcohen/systemtap_write/install/share/systemtap/runtime/runtime.h:26, from /tmp/stapIaZ5Mo/stap_90ca7a4095946c1447d5febbb2252e46_85937_src.c:21: /tmp/stapIaZ5Mo/stap_90ca7a4095946c1447d5febbb2252e46_85937_src.c: In funct= ion =E2=80=98enter_kretprobe_common=E2=80=99: /tmp/stapIaZ5Mo/stap_90ca7a4095946c1447d5febbb2252e46_85937_src.c:6484:45: error: =E2=80=98struct kretprobe_instance=E2=80=99 has no member named =E2= =80=98ret_addr=E2=80=99 6484 | SET_REG_IP(regs, (unsigned long)inst->ret_addr); | ^~ /home/wcohen/systemtap_write/install/share/systemtap/runtime/linux/../regs.= h:85:44: note: in definition of macro =E2=80=98SET_REG_IP=E2=80=99 85 | #define SET_REG_IP(regs, x) REG_IP(regs) =3D x | ^ make[1]: *** [scripts/Makefile.build:288: /tmp/stapIaZ5Mo/stap_90ca7a4095946c1447d5febbb2252e46_85937_src.o] Error 1 make: *** [Makefile:1848: /tmp/stapIaZ5Mo] Error 2 WARNING: kbuild exited with status: 2 Pass 4: compilation failed. [man error::pass4] There are a number of places in tapsets.cxx directly referencing ret_addr f= ield which is removed from struct kretprobe_instance. Looking at how the kernel handles this there is small inlined helper function to "do the right thing", get_kretprobe_retaddr (https://elixir.bootlin.com/linux/v5.18-rc1/C/ident/get_kretprobe_retaddr).= =20 Looks like systemtap should have a similar __stp_* function to do the same. --=20 You are receiving this mail because: You are the assignee for the bug.=