首页 > 系统相关 >crash —— 查看进程的mm_struct内容

crash —— 查看进程的mm_struct内容

时间:2023-09-24 18:56:20浏览次数:40  
标签:crash struct mm mmap base bash

方法1

  • 使用ps获取进程的task_struct地址,然后得到mm_struct地址
crash> ps | grep bash
   6666  96253   8  ffff88a07fd42000  IN   0.0   24268   3048  bash
   8288  59636  14  ffff88fdc4678000  IN   0.0   27500   1972  bash
   8581   8580  25  ffff88dda33a0000  IN   0.0   15788   2556  bash
   8597   8596  80  ffff88a08261a000  IN   0.0   15788   2552  bash
   8719   8718  77  ffff888e01d0e000  IN   0.0   17324   3096  bash
   8720   8717  77  ffff88abe8e8c000  IN   0.0   17324   3088  bash
  28340  28274  66  ffff8901a758a000  IN   0.0   26072   3880  bash
  59636  59629  40  ffff88c8d3548000  IN   0.0   27500   3364  bash
crash> task -R mm ffff88a07fd42000
PID: 6666   TASK: ffff88a07fd42000  CPU: 8   COMMAND: "bash"
  mm = 0xffff888b9dbad000,

crash> *mm_struct -x 0xffff888b9dbad000
struct mm_struct {
  {
    mmap = 0xffff893a29b79878,
    mm_rb = {
      rb_node = 0xffff88b7aa6cf240
    },
    vmacache_seqnum = 0x14,
    get_unmapped_area = 0xffffffff8102ac20 <arch_get_unmapped_area_topdown>,
    mmap_base = 0x7f1960ff9000,
    mmap_legacy_base = 0x2b8d491b2000,
    mmap_compat_base = 0xf7fd7000,
    mmap_compat_legacy_base = 0x5557c000,
    task_size = 0x7ffffffff000,
    highest_vm_end = 0x7ffd09bf3000,
    pgd = 0xffff88b733fb6000,
    mm_users = {
      counter = 0x1
    },
    mm_count = {
      counter = 0x1
    },
    pgtables_bytes = {
      counter = 0x17000
    },
    map_count = 0x3a,
...
  • 获取指定进程的mm_struct的值
crash> task -R mm 2085
PID: 2085   TASK: ffff88dcca1fa000  CPU: 61  COMMAND: "supervisor"
  mm = 0xffff88dea7232000,

crash> *mm_struct -x 0xffff88dea7232000
struct mm_struct {
  {
    mmap = 0xffff88dcc9122658,
    mm_rb = {
      rb_node = 0xffff88dcc9123240
    },
    vmacache_seqnum = 0x1,
    get_unmapped_area = 0xffffffff8102ac20 <arch_get_unmapped_area_topdown>,
    mmap_base = 0x7fa1cff0b000,
    mmap_legacy_base = 0x2b04da2a0000,
    mmap_compat_base = 0xf7f72000,
    mmap_compat_legacy_base = 0x555e1000,
    task_size = 0x7ffffffff000,
    highest_vm_end = 0x7ffe1cb05000,
    pgd = 0xffff88ddab4aa000,
...

方法2

直接使用vm命令,这个更加方便。

crash> vm -m 2085
PID: 2085   TASK: ffff88dcca1fa000  CPU: 61  COMMAND: "supervisor"
struct mm_struct {
  {
    mmap = 0xffff88dcc9122658,
    mm_rb = {
      rb_node = 0xffff88dcc9123240
    },
    vmacache_seqnum = 1,
    get_unmapped_area = 0xffffffff8102ac20 <arch_get_unmapped_area_topdown>,
    mmap_base = 140332955119616,
    mmap_legacy_base = 47299840049152,
    mmap_compat_base = 4160167936,
    mmap_compat_legacy_base = 1432227840,
    task_size = 140737488351232,
    highest_vm_end = 140729379737600,
    pgd = 0xffff88ddab4aa000,
    mm_users = {
      counter = 1
    },
    mm_count = {
      counter = 1
    },
    pgtables_bytes = {
      counter = 77824
    },
    map_count = 43,

标签:crash,struct,mm,mmap,base,bash
From: https://www.cnblogs.com/pengdonglin137/p/17726417.html

相关文章

  • crash —— 查看进程的vma结构体
    crash提供了vm命令来输出进程的vma相关的信息。输出当前当进程的vma列表crash>vmPID:3319TASK:ffff889760358000CPU:6COMMAND:"kvm"MMPGDRSSTOTAL_VMffff893ada165000ffff893a8c4e200045772k9535832kVMA......
  • crash —— 获取slub的详细信息
    在linux系统中可以通过/proc/slabinfo获取slab的统计数据,crash提供了kmem来实现这个功能。查看系统每个kmem_cache的概要信息crash>kmem-sCACHEOBJSIZEALLOCATEDTOTALSLABSSSIZENAMEffff888141e12000131072000128......
  • crash —— 将flags转换成可读的字符
    将page的flags转换为可读字符串crash>kmem-g01fffe00000a001cFLAGS:1fffe00000a001cPAGE-FLAGBITVALUEPG_referenced20000004PG_uptodate30000008PG_dirty40000010PG_reclaim170020000PG_unevictable19......
  • 深度学习算法中的遗传编程(Genetic Programming)
    深度学习算法中的遗传编程(GeneticProgramming)引言深度学习算法在近年来取得了巨大的成功,广泛应用于计算机视觉、自然语言处理等领域。然而,深度学习算法仍然面临着一些挑战,例如需要大量的标注数据、模型结构的选择等。为了解决这些问题,研究者们开始探索结合遗传编程(GeneticProgram......
  • crash —— 查看当前系统每个page的信息
    linux中page数据结构可以通过mem_map数组访问,下面的方法可以输出每个page的相关成员。通用版本下面这个命令可以显示每个page的一些关键成员的值。crash>kmem-pPAGEPHYSICALMAPPINGINDEXCNTFLAGSffffea000000000000......
  • crash —— 获取系统NODE、ZONE、SECTION、MEMBLOCK等信息
    crash>kmem-nNODESIZEPGLIST_DATABOOTMEM_DATANODE_ZONES0100925439ffff88e03ffc1000----ffff88e03ffc1000ffff88e03ffc5000......
  • crash —— 获取vmalloc分配信息
    crash>kmem-vVMAP_AREAVM_STRUCTADDRESSRANGESIZEffff88debf51c900ffff88debf53bd00ffffc90000000000-ffffc900000020008192ffff88debf51cf60ffff88debf53bd40ffffc90000002000-ffffc90000004000......
  • crash —— 获取系统内存使用统计数据
    crash>kmem-iPAGESTOTALPERCENTAGETOTALMEM197646761754GB----FREE33983015129.6GB17%ofTOTALMEMUSED163663746624.3GB82%ofTOTALMEMSHARED139137......
  • crash —— 获取物理内存布局信息
    crash>mach-mPHYSICALADDRESSRANGETYPE0000000000000000-0000000000001000E820_RESERVED0000000000001000-000000000006e000E820_RAM000000000006e000-0000000000070000E820_RESERVED0000000000070000-00000000000a0000E820_RAM0......
  • crash —— 获取cpuinfo信息
    crash>mach-cCPU0:structcpuinfo_x86{x86=6'\006',x86_vendor=0'\000',x86_model=85'U',x86_stepping=7'\a',x86_tlbsize=0,x86_virt_bits=48'0',x86_phys_bits=46......