0.0.26 (Released March 11th, 2024)

These are some of the highlights of drgn 0.0.26. See the GitHub release for the full release notes, including more improvements and bug fixes.

Miscellaneous Helpers

This release added several new Linux kernel helpers with no particular theme:

fsrefs.py Tool

The fsrefs.py tool was added to the tools directory. It prints information about everything that is referencing a file or filesystem. This is similar to fuser(1) and lsof(8), but it can find more since it has access to kernel internals.

$ ./tools/fsrefs.py --inode /dev/urandom
pid 1349 (bluetoothd) fd 16 (struct file *)0xffff8881458cf000
pid 1368 (udisksd) fd 15 (struct file *)0xffff888145c13100
...
$ ./tools/fsrefs.py --super-block /run
mount /run (struct mount *)0xffff8881015cc140
pid 1 (systemd) fd 256 (struct file *)0xffff8881012f3d00 /run/initctl
pid 1 (systemd) fd 380 (struct file *)0xffff88810bf88800 /run/dmeventd-server
pid 1 (systemd) fd 385 (struct file *)0xffff88810bf88f00 /run/dmeventd-client
mount /run (mount namespace 4026532545) (struct mount *)0xffff8881474028c0
pid 2135770 (systemd-journal) vma 0x7f7d94f2a000-0x7f7d94f2b000 (struct file *)0xffff88813925bf00 /run/systemd/journal/kernel-seqnum
pid 2135770 (systemd-journal) vma 0x7f7d94f2b000-0x7f7d94f2c000 (struct file *)0xffff88813925a100 /run/systemd/journal/seqnum
...

fsrefs.py currently checks:

  • File descriptors

  • Task working directories

  • Task root directories

  • Memory mappings

  • Filesystem mounts

  • binfmt_misc

  • loop(4) devices

  • Swap files

  • uprobes

It will be extended to check more as the need arises, so feel free to report anything it missed.

(Note that as opposed to the contrib directory, scripts in the tools directory are regularly maintained and tested.)

DWARF Package Files

drgn now supports split DWARF package (.dwp) files. These are generated by the dwp and llvm-dwp tools.

Linux 6.8 Support

Linux 6.8 changed some filesystem internals in a way that broke a couple of drgn helpers. Here are some errors you might see with older versions of drgn that are fixed in this release.

From path_lookup() or for_each_mount() (fixed by Johannes Thumshirn):

AttributeError: 'struct mnt_namespace' has no member 'list'

From path_lookup():

AttributeError: 'struct dentry' has no member 'd_subdirs'

Python 3.13 Support

Python 3.13, currently in alpha, removed or changed some private APIs (_PyDict_GetItemIdWithError(), _PyDict_SetItemId(), and _PyLong_AsByteArray()) that drgn depended on, which caused build failures. This was fixed by using public APIs instead.