|
| 1 | +0.0.23 (Released June 28th, 2023) |
| 2 | +================================= |
| 3 | + |
| 4 | +These are some of the highlights of drgn 0.0.23. See the `GitHub release |
| 5 | +<https://github.com/osandov/drgn/releases/tag/v0.0.23>`_ for the full release |
| 6 | +notes, including more improvements and bug fixes. |
| 7 | + |
| 8 | +.. highlight:: pycon |
| 9 | + |
| 10 | +Virtual Address Translation Helpers |
| 11 | +----------------------------------- |
| 12 | + |
| 13 | +This release added several Linux kernel helpers for translating virtual |
| 14 | +addresses. |
| 15 | + |
| 16 | +:func:`~drgn.helpers.linux.mm.follow_phys()` translates a virtual address to a |
| 17 | +physical address in a given address space. For example, to get the physical |
| 18 | +address that virtual address 0x7f7fe46a4270 maps to in process 115:: |
| 19 | + |
| 20 | + >>> task = find_task(prog, 115) |
| 21 | + >>> address = 0x7f7fe46a4270 |
| 22 | + >>> print(hex(follow_phys(task.mm, address))) |
| 23 | + 0x4090270 |
| 24 | + |
| 25 | +:func:`~drgn.helpers.linux.mm.follow_page()` translates a virtual address to |
| 26 | +the ``struct page *`` that it maps to:: |
| 27 | + |
| 28 | + >>> follow_page(task.mm, address) |
| 29 | + *(struct page *)0xffffd20ac0102400 = { |
| 30 | + ... |
| 31 | + } |
| 32 | + |
| 33 | +:func:`~drgn.helpers.linux.mm.follow_pfn()` translates a virtual address to the |
| 34 | +page frame number (PFN) of the page that it maps to:: |
| 35 | + |
| 36 | + >>> follow_pfn(task.mm, address) |
| 37 | + (unsigned long)16528 |
| 38 | + |
| 39 | +These can be used to translate arbitrary kernel virtual addresses by passing |
| 40 | +``prog["init_mm"].address_of_()``:: |
| 41 | + |
| 42 | + >>> print(hex(follow_phys(prog["init_mm"].address_of_(), 0xffffffffc0483000))) |
| 43 | + 0x2e4b000 |
| 44 | + |
| 45 | +Vmalloc/Vmap Address Translation Helpers |
| 46 | +---------------------------------------- |
| 47 | + |
| 48 | +:func:`~drgn.helpers.linux.mm.vmalloc_to_page()` is a special case of |
| 49 | +:func:`~drgn.helpers.linux.mm.follow_page()` for vmalloc and vmap addresses:: |
| 50 | + |
| 51 | + >>> vmalloc_to_page(prog, 0xffffffffc0477000) |
| 52 | + *(struct page *)0xffffc902400b8980 = { |
| 53 | + ... |
| 54 | + } |
| 55 | + |
| 56 | +Likewise, :func:`~drgn.helpers.linux.mm.vmalloc_to_pfn()` is a special case of |
| 57 | +:func:`~drgn.helpers.linux.mm.follow_pfn()` for vmalloc and vmap addresses:: |
| 58 | + |
| 59 | + >>> vmalloc_to_pfn(prog, 0xffffffffc0477000) |
| 60 | + (unsigned long)11814 |
| 61 | + |
| 62 | +``contrib`` Directory |
| 63 | +--------------------- |
| 64 | + |
| 65 | +Martin Liška, Boris Burkov, and Johannes Thumshirn added lots of new scripts to |
| 66 | +the ``contrib`` directory: |
| 67 | + |
| 68 | +- :contrib:`btrfs_tree.py`: work-in-progress helpers for Btrfs B-trees |
| 69 | +- :contrib:`btrfs_tree_mod_log.py`: simulator for the Btrfs tree modification log |
| 70 | +- :contrib:`dump_btrfs_bgs.py`: print block groups in a Btrfs filesystem |
| 71 | +- :contrib:`kcore_list.py`: print memory regions from ``/proc/kcore`` |
| 72 | +- :contrib:`kernel_sys.py`: print system information (similar to crash's ``sys`` command) |
| 73 | +- :contrib:`mount.py`: print a filesystem mount table |
| 74 | +- :contrib:`platform_drivers.py`: print registered `platform drivers <https://docs.kernel.org/driver-api/driver-model/platform.html>`_ |
| 75 | +- :contrib:`vmmap.py`: print memory mappings in a process (similar to ``/proc/$pid/maps``) |
| 76 | +- :contrib:`vmstat.py`: print information about kernel memory usage |
| 77 | + |
| 78 | +Embedding Interactive Mode |
| 79 | +-------------------------- |
| 80 | + |
| 81 | +:meth:`drgn.cli.run_interactive()` runs drgn's interactive mode. It can be used |
| 82 | +to embed drgn in another application. For example, you could use it for a |
| 83 | +custom :class:`drgn.Program` that the standard drgn CLI can't set up: |
| 84 | + |
| 85 | +.. code-block:: python3 |
| 86 | +
|
| 87 | + import drgn |
| 88 | + import drgn.cli |
| 89 | +
|
| 90 | + prog = drgn.Program() |
| 91 | + prog.add_type_finder(...) |
| 92 | + prog.add_object_finder(...) |
| 93 | + prog.add_memory_segment(...) |
| 94 | + drgn.cli.run_interactive(prog) |
| 95 | +
|
| 96 | +Full s390x Support |
| 97 | +------------------ |
| 98 | + |
| 99 | +Sven Schnelle contributed s390x virtual address translation support. This is |
| 100 | +the state of architecture support in this release: |
| 101 | + |
| 102 | +.. list-table:: drgn 0.0.23 Architecture Support |
| 103 | + :header-rows: 1 |
| 104 | + |
| 105 | + * - Architecture |
| 106 | + - Linux Kernel Modules |
| 107 | + - Stack Traces |
| 108 | + - Virtual Address Translation |
| 109 | + * - x86-64 |
| 110 | + - ✓ |
| 111 | + - ✓ |
| 112 | + - ✓ |
| 113 | + * - AArch64 |
| 114 | + - ✓ |
| 115 | + - ✓ |
| 116 | + - ✓ |
| 117 | + * - ppc64 |
| 118 | + - ✓ |
| 119 | + - ✓ |
| 120 | + - |
| 121 | + * - s390x |
| 122 | + - ✓ |
| 123 | + - ✓ |
| 124 | + - ✓ |
| 125 | + * - i386 |
| 126 | + - ✓ |
| 127 | + - |
| 128 | + - |
| 129 | + * - Arm |
| 130 | + - ✓ |
| 131 | + - |
| 132 | + - |
| 133 | + * - RISC-V |
| 134 | + - ✓ |
| 135 | + - |
| 136 | + - |
| 137 | + |
| 138 | +Linux 6.3 & 6.4 Support |
| 139 | +----------------------- |
| 140 | + |
| 141 | +Linux 6.3 and 6.4 had an unusual number of breaking changes for drgn. Here are |
| 142 | +some errors you might see with older versions of drgn that are fixed in this |
| 143 | +release. |
| 144 | + |
| 145 | +On startup (fixed by Ido Schimmel):: |
| 146 | + |
| 147 | + warning: could not get debugging information for: |
| 148 | + kernel modules (could not find loaded kernel modules: 'struct module' has no member 'core_size') |
| 149 | + |
| 150 | +From :meth:`drgn.Program.stack_trace()` and :meth:`drgn.Thread.stack_trace()`:: |
| 151 | + |
| 152 | + Exception: unknown ORC entry type 3 |
| 153 | + |
| 154 | +From :func:`~drgn.helpers.linux.mm.compound_order()` and |
| 155 | +:func:`~drgn.helpers.linux.mm.compound_nr()`:: |
| 156 | + |
| 157 | + AttributeError: 'struct page' has no member 'compound_order' |
| 158 | + |
| 159 | +From :func:`~drgn.helpers.linux.block.for_each_disk()` and |
| 160 | +:func:`~drgn.helpers.linux.block.for_each_partition()`:: |
| 161 | + |
| 162 | + AttributeError: 'struct class' has no member 'p' |
| 163 | + |
| 164 | +Python 3.12 Support |
| 165 | +------------------- |
| 166 | + |
| 167 | +Python 3.12, currently in beta, changed an implementation detail that drgn |
| 168 | +depended on, which caused crashes like:: |
| 169 | + |
| 170 | + Py_SIZE: Assertion `ob->ob_type != &PyLong_Type' failed. |
| 171 | + |
| 172 | +Stephen Brennan fixed this. |
0 commit comments