Patch "scripts/gdb: fix 'lx-lsmod' show the wrong size" has been added to the 6.4-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    scripts/gdb: fix 'lx-lsmod' show the wrong size

to the 6.4-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     scripts-gdb-fix-lx-lsmod-show-the-wrong-size.patch
and it can be found in the queue-6.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit fb6225a13d561a17d9b6059671456ae64aff8221
Author: Kuan-Ying Lee <Kuan-Ying.Lee@xxxxxxxxxxxx>
Date:   Mon Jul 10 17:28:46 2023 +0800

    scripts/gdb: fix 'lx-lsmod' show the wrong size
    
    [ Upstream commit fb40b0537342e1acd5c2daf2ff6780c1d0d2883c ]
    
    '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
    
    Link: https://lkml.kernel.org/r/20230710092852.31049-1-Kuan-Ying.Lee@xxxxxxxxxxxx
    Fixes: b4aff7513df3 ("scripts/gdb: use mem instead of core_layout to get the module address")
    Signed-off-by: Kuan-Ying Lee <Kuan-Ying.Lee@xxxxxxxxxxxx>
    Reviewed-by: Pankaj Raghav <p.raghav@xxxxxxxxxxx>
    Cc: AngeloGioacchino Del Regno <angelogioacchino.delregno@xxxxxxxxxxxxx>
    Cc: Chinwen Chang <chinwen.chang@xxxxxxxxxxxx>
    Cc: Jan Kiszka <jan.kiszka@xxxxxxxxxxx>
    Cc: Kieran Bingham <kbingham@xxxxxxxxxx>
    Cc: Luis Chamberlain <mcgrof@xxxxxxxxxx>
    Cc: Matthias Brugger <matthias.bgg@xxxxxxxxx>
    Cc: Qun-Wei Lin <qun-wei.lin@xxxxxxxxxxxx>
    Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/scripts/gdb/linux/constants.py.in b/scripts/gdb/linux/constants.py.in
index 50a92c4e9984e..fab74ca9df6fc 100644
--- a/scripts/gdb/linux/constants.py.in
+++ b/scripts/gdb/linux/constants.py.in
@@ -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)
diff --git a/scripts/gdb/linux/modules.py b/scripts/gdb/linux/modules.py
index 261f28640f4cd..f76a43bfa15fc 100644
--- a/scripts/gdb/linux/modules.py
+++ b/scripts/gdb/linux/modules.py
@@ -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()



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux