bpftrace fun question of the week I’ve been beating my head against for a while now.
Given the following bpftrace
program:
tracepoint:syscalls:sys_enter_open,
tracepoint:syscalls:sys_enter_openat
{
$g = "magic_command_to_exit_trace";
$s = str(args->filename);
printf("%s\n", $s);
if ($s == $g) {
exit();
}
}
I get the lovely warning:
WARNING: Addrspace mismatch
if ($s == $g) {
which I can understand. But what I can’t figure out is how to resolve this (hint, the program works just fine, when opening the “magic” file, the trace exits), as how to turn a literal string into the proper address space that args->filename
is?
I’ve dug into too many bpftrace
git commits to try to figure it out, to no luck. Anyone have a hint?
Oh, and if you want to see where this is used, it’s in this “fun” script: https://github.com/gregkh/gregkh-linux/blob/master/scripts/trace_kernel_build.sh
Warning, realpath
takes a long time when processing millions of files, be patient when running the script.
@brauner @monsieuricon @dakkar better, thanks!
But (you knew there was a but)…
message ids no longer have <> characters: `Message-Id: 2023040228-pastor-evidence-1269@gregkh
Is that intentional and still a valid message id? As @monsieuricon said, email parsing is rough.
@brauner @monsieuricon @dakkar Thanks!
In the never-ending series of things that really don’t matter but are fun, something is still not working. I just tried sending a patch out with this and the gmail server did not like it at all, and rewrote the message id with:
Message-ID: <64293fdb.5d0a0220.58d3f.02e0SMTPIN_ADDED_BROKEN@mx.google.com>
X-Google-Original-Message-ID: <2023040245-stardust-obtain-0b4d@gregkh> usage.
Ah, in typing that out I see why, the original email header was:
Subject: [PATCH] MIPS: vpe-cmp: remove module owner pointer from struct class
usage.
So the perl script changed that to:
Subject: [PATCH] MIPS: vpe-cmp: remove module owner pointer from struct class
Message-Id: <2023040245-stardust-obtain-0b4d@gregkh>
usage.
And then vger promptly ate the message and never delivered it to the mailing list. I’ll hand-edit the subject line to be one line for now to get stuff done, but be aware of this if you use it as-is.