If we need access to a privileged file in /proc or /sys we need to get
that through sysprofd. This implements basic checking of paths to see
if we need to get a /proc file from there.
We can't use the GetProfFD variant because that may still cause errors
when reading back due to how selinux and other LSMs may restrict read()
to get kallsyms.
This requires recent API additions in libdex.
If we are trying to get the file bytes and they are compressed, we may need
to transparently decompress those bytes. That way if the API requested
"/proc/cpuinfo" but really got "/proc/cpuinfo.gz" it still gets the same
bytes to consume.
If we want /proc/kallsyms and we discover /proc/kallsyms.gz, then use the
/proc/kallsyms.gz instead and transparently decompress it. Also, list the
file in sysprof_document_list_files() as /proc/kallsyms instead of
/proc/kallsyms.gz as that is really the intention (but mark the compressed
bit for decoding the chunks).
This doesn't start reading from the input stream, but does get things into
place until we actually start processing the recording. When we get a
record vfunc, we will do the input processing.
Also, I no longer wish to try to maintain support for no-polkit. If there
is truly a system where that is something we want to support, we can bring
back the shims as a compile time alternative.
Being able to manage asynchronous operations with libdex will drastically
simplify how we implement the profiler and instruments. We may eventually
do the same with libsysprof-analyze to parallelize some operations.
The idea here is that we stop having instruments do their own policy
checking and instead do the policy checking as a set from the recording
as part of prepare/etc.
The goal here is to have a fairly small exposed API surface for profiling
similar to libsysprof-analyze where implementation details are hidden.
SysprofProfiler - Where you setup your recording
SysprofInstrument - What you add to a profiler to extract data
SysprofRecording - Represents an active recording w/ instruments
We have a lot of twisted options, and could really use some cleanup to
make that all more manageable. I don't know anywhere we care about not
checking for a C++ compiler, so just always check for that so we can use
the demangler.
I want to move a bunch of this "contrib" style sources into their own
area so we can statically link them but keep them separate from main
sysprof code.
We need to do what binfile was doing and make the address relative to the
text_offset. We also need to ignore the text offset of the debuglink files
and pass it the text_offset of the original ELF.
This fixes a bunch of symbolization in the callgraph.
This just serves as a prototyping ground so that we can have a callgraph
view widget in the future based on these principles. It also shows some
areas that still need work, such as sorting within the tree and fixing the
text offset calculation for ELF symbols.
If our entire stack was in kernel address context, inject the
"- - Kernel - -" symbol at the top of the stack trace so that accounting
gets properly assigned to the kernel. This is typical with kernel processes
such as kworker.