systemtap:mcermak-pr3040

Last commit made on 2023-10-25
Get this branch:
git clone -b mcermak-pr3040 https://git.launchpad.net/systemtap

Branch merges

Branch information

Name:
mcermak-pr3040
Repository:
lp:systemtap

Recent commits

719e31c... by Martin Cermak <email address hidden>

Add a testcase

f790b1e... by Martin Cermak <email address hidden>

Add an ifdef check to see if the code is really needed.

a784da4... by Martin Cermak <email address hidden>

Wrap long lines

11ef5e0... by Martin Cermak <email address hidden>

First working version

First working version having the dwarf data stored in the context struct.

14fed02... by Martin Cermak <email address hidden>

Declassify context struct within _stp_filename_lookup_5

The _stp_filename_lookup_5 is using local arrays to store data parsed
from dwarf. Needed data storage is big and this leads to problems with
stack size. The specific compile time problem is as follows:

error: the frame size of 10272 bytes is larger than 2048 bytes [-Werror=frame-larger-than=]

As Will Cohen points out, this compiler warning is configured in the
kernel source here:

https://elixir.bootlin.com/linux/v6.6-rc6/source/lib/Kconfig.debug#L434

The point of the warning is to prevent a stack overflow. A possible
solution would be to mark the variables as static, moving them to the
data segment. This however only works in case there is no parallelism.
We can't guarantee that (e.g. two different probes may trigger
and use that underlying function at the same time).

So Frank advised to move the data to the context struct. That is
emitted to the stap_XXXXXX_src.i file within translate.cxx by
s.up->emit_common_header (). Sadly, this happens way after sym.c
is emitted, so in sym.c the context struct is not known.

I was wrapping my head around reordering the emission of the context
struct and runtime.h which is a pretty big beast called "main header
file for Linux" ;) There are nontrivial ties between these two.
I gave up going this way.

Instead, I've separated the function body of _stp_filename_lookup_5()
out to a separate file sym2.c, which gets emitted only after the context
struct is known.

To test this, the _stp_filename_lookup_5() has a debug print at its very
beginning of its function body, showing how the c->probe_type can be
accessed (and shown via _stp_printf() to the user). This approach
appears to be workable:

---------------------------8<--------------------------------------------------
Pass 1: parsed user script and 484 library scripts using 138316virt/107988res/15872shr/91576data kb, in 170usr/40sys/215real ms.
Pass 2: analyzed script: 1 probe, 1 function, 0 embeds, 0 globals using 139768virt/110804res/17024shr/93028data kb, in 10usr/10sys/8real ms.
Pass 3: translated to C into "/tmp/stapku0cxM/stap_342553_src.c" using 140912virt/114568res/19596shr/94172data kb, in 180usr/220sys/409real ms.
Pass 4: compiled C into "stap_342553.ko" in 5320usr/1200sys/5906real ms.
Pass 5: starting run.
XXX CONTEXT: uprobe-yes
 0x40110a : main+0x4/0xe at /root/test/test.c:2 [/root/test/test5]
 0x7fcf6a94e14a : __libc_start_call_main+0x7a/0xb0 [/usr/lib64/libc.so.6]
 0x7fcf6a94e20b : __libc_start_main@GLIBC_2.2.5+0x8b/0x160 [/usr/lib64/libc.so.6]
 0x401045 : _start+0x25/0x30 [/root/test/test5]
Pass 5: run completed in 20usr/50sys/1343real ms.
Keeping temporary directory "/tmp/stapku0cxM"
---------------------------8<--------------------------------------------------

81c43a6... by Martin Cermak <email address hidden>

Situation matching the bz comment #9

6ab4eb3... by Frank Ch. Eigler

buildbot test, ignore

3ecf49e... by William Cohen

PR30401: Address newer s390 kernels that move struct stack_frame

Linux git commit 78c98f907413 moved struct stack_frame
<asm/processor.h> to a newly created <asm/stacktrace.h>. As a result
the struct definition does not get pulled in by the existing
<asm/ptrace.h> include for the newer kernels. Have a autoconf test to
determine whether the <asm/stacktrace.h> exists and uses it if it
avaialble.

3c07dcf... by Frank Ch. Eigler

testsuite: add cve-2023-4911 band-aid

As seen on TV ^W https://access.redhat.com/security/cve/CVE-2023-4911

823fcc4... by Frank Ch. Eigler

testsuite: drop busybox test case

This test case (with an old fixed version of busybox) has been a
problem with respect to compatibility with newer libc/kernels,
with readonly source trees, and doesn't seem to contribute much
to test value. So nuke it all.