Skip to content

drgn 0.0.28

Compare
Choose a tag to compare
@osandov osandov released this 07 Oct 23:32
· 30 commits to main since this release

New features:

  • The drgn.helpers.experimental.kmodify module was added. It provides helpers for modifying the running kernel, including calling arbitrary functions (call_function()) and writing to memory (write_memory(), write_object()).
  • Virtual address translation and stack trace support for 32-bit Arm were added.
  • The drgn.implicit_convert() function was added. It converts an object to a type using C's implicit conversion rules (i.e., the rules used when assigning to a variable without an explicit cast).
  • The drgn.alignof() function was added. It returns the alignment requirement of a type.
  • The drgn.helpers.linux.module module was added. It provides helpers for looking up and inspecting Linux kernel modules: address_to_module(), find_module(), for_each_module(), module_address_regions(), and module_percpu_region(). Contributed by Stephen Brennan.
  • The drgn.helpers.linux.sched.task_thread_info() helper was added. It returns the struct thread_info * for a given struct task_struct *.
  • The drgn.helpers.linux.fs.d_path() helper can now return an absolute path given only a dentry. Contributed by Stephen Brennan.
  • drgn.Thread now has a name attribute. Contributed by Ryan Wilson.
  • tools/fsrefs.py gained a new mode for finding what is using the filesystem on a given block device.
  • Linux 6.11 and 6.12 are now supported.
    • tools/fsrefs.py was updated to handle changes to uprobes in Linux 6.12.
  • Virtual address translation on AArch64 now supports Armv8.7 FEAT_LPA2 (52-bit virtual addresses with 4k or 16k pages, added in Linux 6.9).
  • Absent objects with void type can now be printed instead of raising a TypeError.

Bug fixes:

  • The drgn.cast() function was fixed to allow casting anything to a void type.
  • The drgn.cast() function's handling of casting to bool was fixed to convert to 0 or 1 instead of truncating to 8 bits.
  • The bool() operator was fixed to return False for array objects with address 0 (which is possible with weak symbols).
  • The bool() operator was fixed to allow passing a function object instead of raising a TypeError.
  • Functions that have both out-of-line and inline instances now have their address properly reported instead of being returned as absent objects.
  • Virtual address translation support on s390x was fixed to handle the virtual/physical address split in Linux 6.10.
  • Virtual address translation support on AArch64 was fixed to handle the fallback from 52- to 48- or 47-bit virtual addresses with 4k or 16k pages if the hardware doesn't support FEAT_LPA2.
  • The drgn.helpers.common.memory.identify_address() helper was fixed to not fail on kernels using the SLOB allocator. Contributed by Stephen Brennan.
  • The drgn.helpers.common.memory.identify_address() helper was fixed to properly identify vmap allocations on kernels not using vmap stacks.
  • The type annotation for drgn.Object.from_bytes_() was fixed to accept buffer types other than bytes.
  • A build script was fixed to work on POSIX (non-Bash) shells. Contributed by Sam James.

API changes:

  • The struct, union, class, and enum keywords are now omitted when formatting a C++ type name.
  • The bit_offset and bit_field_size parameters of drgn.Object.from_bytes_() were fixed to be keyword-only as intended. They were previously annotated as keyword-only but were accepted positionally at runtime.

Documentation:

  • Gentoo installation instructions were added. Contributed by Sam James.
  • Positional-only parameters are now documented (using the standard / syntax).
  • Helpers that depend on virtual address translation support now document that dependency, including the ways it can fail.
  • Stale documentation referring to complex types, which are not implemented, was removed.

contrib directory:

  • contrib/bpf_inspect.py can now show maps and subprograms used by a BPF program. Contributed by Leon Hwang.
  • contrib/bpf_inspect.py was fixed to work on Python < 3.12. Contributed by Stephen Brennan.
  • contrib/slabinfo.py was added. It dumps slab allocator statistics similar to /proc/slabinfo. Contributed by Kuan-Ying Lee.
  • contrib/vmallocinfo.py was added. It dumps vmalloc information similar to /proc/vmallocinfo. Contributed by Kuan-Ying Lee.
  • contrib/btrfs_print_fs_uuids_cache.py was added. It prints Btrfs's internal list of filesystem UUIDs. Contributed by Srivathsa Dara.
  • contrib/dm_crypt_key.py was updated to handle Linux < 6.7.

Internal:

  • Some code was moved to a new, top-level Python package, _drgn_util.