Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support module BTF and lots of log improvements #60

Merged
merged 10 commits into from
Feb 14, 2024
Merged

Conversation

anakryiko
Copy link
Owner

No description provided.

Store `struct btf *`for each function explicitly. This opens up ability
to have module BTF as a source of BTF information for some functions.

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Refactor how retsnoop collects kprobe information. Apply glob rules
early on so that resulting set of attachable kprobes are small. We'll
use this to figure out all kernel modules that are relevant when loading
module BTFs.

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Now that we know minimal set of module BTFs we need, try to fetch them,
and if successful, use BTF information to augment kprobe information.

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
We already emit this information from retsnoop.c, no need to duplicate
code and pollute output.

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Add NAME_MOD() macro that formats glob or function spec as either
'<name>' if it's not module-specific or '<name> [<module>]' if it is
module-specific. Normalize all the output code to use this approach and
not have to do ad-hoc work arounds to minimize conditional logic just to
output this information consistently.

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Extract internal API for working with a set of allow/deny globs.

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
This allows to keep reporting and stats counting separate from the (now
reusable) logic of matching a given set of allow/deny globs.

There are 4 possible outcomes for any given glob set. It could allow
(match) or deny (mismatch), and do it either explicitly (there is
a matching allow/deny glob) or implicitly (no glob matched, but match or
mismatch is implicit, depending on whether there is an explicit
GLOB_ALLOW glob).

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
… is set

Mass attacher adds a few extra globs to prevent attaching to dangerous
functions. Don't report their stats unless debug-extra verboseness is set.

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Emit a set of function flags as symbolic names to ease validation and
debugging.

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Instead of logging every BTF FUNC record that doesn't match globs *or*
doesn't have a corresponding attachable kprobes, filter out all the
records that don't satisfy globs first, so that we can log high signal
message about functions that are not attachable, but were requested by
user through globs.

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
@anakryiko anakryiko merged commit 2d730d4 into master Feb 14, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant