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. .. highlight:: pycon Miscellaneous Helpers --------------------- This release added several new Linux kernel helpers with no particular theme: - :func:`~drgn.helpers.linux.printk.print_dmesg()`, a shortcut for printing the kernel log buffer. - :func:`~drgn.helpers.linux.idr.idr_for_each_entry()`, a shortcut for iterating over an IDR and casting its entries to a specific type. - :func:`~drgn.helpers.linux.stackdepot.stack_depot_fetch()` for getting stack traces from the storage used by KASAN and other kernel debugging tools. This was contributed by Peter Collingbourne. - :func:`~drgn.helpers.linux.plist.plist_head_empty()`, :func:`~drgn.helpers.linux.plist.plist_node_empty()`, :func:`~drgn.helpers.linux.plist.plist_first_entry()`, :func:`~drgn.helpers.linux.plist.plist_last_entry()`, :func:`~drgn.helpers.linux.plist.plist_for_each()`, and :func:`~drgn.helpers.linux.plist.plist_for_each_entry()`, helpers for working with the kernel's priority-sorted lists. ``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 :manpage:`fuser(1)` and :manpage:`lsof(8)`, but it can find more since it has access to kernel internals. .. code-block:: console $ ./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 `_ - :manpage:`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 :func:`~drgn.helpers.linux.fs.path_lookup()` or :func:`~drgn.helpers.linux.fs.for_each_mount()` (fixed by Johannes Thumshirn):: AttributeError: 'struct mnt_namespace' has no member 'list' From :func:`~drgn.helpers.linux.fs.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.