Skip to content

Commit

Permalink
Add experimental helpers for calling kernel functions and writing to …
Browse files Browse the repository at this point in the history
…memory

These are highly-requested features that I didn't implement for awhile
because I thought they would be too difficult or hacky. The approach
that I finally came up with is slightly deranged but solid: we manually
generate a kernel module ELF file and machine code to do a function
call. An alternative approach that I tried was generating C source code
for a kernel module and building it, but that relies on having
kernel-devel and a compatible toolchain installed, and it's slow. (Kudos
to Matthew Wilcox for suggesting the kernel module approach last year:
https://lwn.net/Articles/953256/.)

For now, this is under a new drgn.helpers.experimental package, in the
drgn.helpers.experimental.kmodify module, with no stability guarantees,
but we still have tests for it.

Signed-off-by: Omar Sandoval <[email protected]>
  • Loading branch information
osandov committed Sep 18, 2024
1 parent c752b8a commit 1652183
Show file tree
Hide file tree
Showing 4 changed files with 1,867 additions and 0 deletions.
11 changes: 11 additions & 0 deletions drgn/helpers/experimental/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Copyright (c) Meta Platforms, Inc. and affiliates.
# SPDX-License-Identifier: LGPL-2.1-or-later

"""
Experimental
------------
The ``drgn.helpers.experimental`` package contains experimental helpers with no
stability guarantees. They may change, move to another package, or be removed.
They are not automatically imported by the CLI.
"""
Loading

0 comments on commit 1652183

Please sign in to comment.