Skip to contentSkip to conversation

scripts-gdb-fix-lx-lsmod-show-the-wrong-size.patch removed from -mm tree

merged mm-nonmm-stable Andrew Morton 1 participant 1 message Aug 12, 2023

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: scripts/gdb: fix 'lx-lsmod' show the wrong size
has been removed from the -mm tree. Its filename was
scripts-gdb-fix-lx-lsmod-show-the-wrong-size.patch

This patch was dropped because it was merged into the mm-nonmm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

------------------------------------------------------
From: Kuan-Ying Lee <[email protected]>
Subject: scripts/gdb: fix 'lx-lsmod' show the wrong size
Date: Mon, 10 Jul 2023 17:28:46 +0800

'lsmod' shows total core layout size, so we need to sum up all the sections in core layout in gdb scripts.

/ # lsmod
kasan_test 200704 0 - Live 0xffff80007f640000

Before patch:
(gdb) lx-lsmod
Address Module Size Used by
0xffff80007f640000 kasan_test 36864 0

After patch:
(gdb) lx-lsmod
Address Module Size Used by
0xffff80007f640000 kasan_test 200704 0

Fixes b4aff7513df3 ("scripts/gdb: use mem instead of core_layout to get the module address")
Cc AngeloGioacchino Del Regno <[email protected]>
Cc Chinwen Chang <[email protected]>
Cc Jan Kiszka <[email protected]>
Cc Kieran Bingham <[email protected]>
Cc Luis Chamberlain <[email protected]>
Cc Matthias Brugger <[email protected]>
Cc Qun-Wei Lin <[email protected]>

---

 scripts/gdb/linux/constants.py.in |    3 +++
 scripts/gdb/linux/modules.py      |   12 +++++++++---
 2 files changed, 12 insertions(+), 3 deletions(-)
scripts/gdb/linux/constants.py.in renamed from scripts/gdb/linux/constants.py.in~scripts-gdb-fix-lx-lsmod-show-the-wrong-size +3 -0
@@ -64,6 +64,9 @@ LX_GDBPARSED(IRQ_HIDDEN)
 
 /* linux/module.h */
 LX_GDBPARSED(MOD_TEXT)
+LX_GDBPARSED(MOD_DATA)
+LX_GDBPARSED(MOD_RODATA)
+LX_GDBPARSED(MOD_RO_AFTER_INIT)
 
 /* linux/mount.h */
 LX_VALUE(MNT_NOSUID)
scripts/gdb/linux/modules.py renamed from scripts/gdb/linux/modules.py~scripts-gdb-fix-lx-lsmod-show-the-wrong-size +9 -3
@@ -73,11 +73,17 @@ class LxLsmod(gdb.Command):
                 "        " if utils.get_long_type().sizeof == 8 else ""))
 
         for module in module_list():
-            layout = module['mem'][constants.LX_MOD_TEXT]
+            text = module['mem'][constants.LX_MOD_TEXT]
+            text_addr = str(text['base']).split()[0]
+            total_size = 0
+
+            for i in range(constants.LX_MOD_TEXT, constants.LX_MOD_RO_AFTER_INIT + 1):
+                total_size += module['mem'][i]['size']
+
             gdb.write("{address} {name:<19} {size:>8}  {ref}".format(
-                address=str(layout['base']).split()[0],
+                address=text_addr,
                 name=module['name'].string(),
-                size=str(layout['size']),
+                size=str(total_size),
                 ref=str(module['refcnt']['counter'] - 1)))
 
             t = self._module_use_type.get_type().pointer()

_

Patches currently in -mm which might be from [email protected] are

scripts-gdb-symbols-add-specific-ko-module-load-command.patch scripts-gdb-modules-add-get-module-text-support.patch scripts-gdb-utils-add-common-type-usage.patch scripts-gdb-aarch64-add-aarch64-page-operation-helper-commands-and-configs.patch scripts-gdb-stackdepot-add-stackdepot-support.patch scripts-gdb-page_owner-add-page-owner-support.patch scripts-gdb-slab-add-slab-support.patch scripts-gdb-vmalloc-add-vmallocinfo-support.patch