首页 > 其他分享 >crash —— 将flags转换成可读的字符

crash —— 将flags转换成可读的字符

时间:2023-09-24 15:55:21浏览次数:45  
标签:crash 17 pageflags flags PG 可读

将page的flags转换为可读字符串

crash> kmem -g 01fffe00000a001c
FLAGS: 1fffe00000a001c
  PAGE-FLAG       BIT  VALUE
  PG_referenced     2  0000004
  PG_uptodate       3  0000008
  PG_dirty          4  0000010
  PG_reclaim       17  0020000
  PG_unevictable   19  0080000
  PG_savepinned     4  0000010
  PG_isolated      17  0020000

此外,可以用whatis查看pageflags的定义:

crash> whatis pageflags
enum pageflags {
  PG_locked = 0
  PG_error = 1
  PG_referenced = 2
  PG_uptodate = 3
  PG_dirty = 4
  PG_lru = 5
  PG_active = 6
  PG_waiters = 7
  PG_slab = 8
  PG_owner_priv_1 = 9
  PG_arch_1 = 10
  PG_reserved = 11
  PG_private = 12
  PG_private_2 = 13
  PG_writeback = 14
  PG_head = 15
  PG_mappedtodisk = 16
  PG_reclaim = 17
  PG_swapbacked = 18
  PG_unevictable = 19
  PG_mlocked = 20
  PG_uncached = 21
  PG_hwpoison = 22
  PG_young = 23
  PG_idle = 24
  PG_workingset = 25
  __NR_PAGEFLAGS = 26
  PG_checked = 9
  PG_swapcache = 9
  PG_fscache = 13
  PG_pinned = 9
  PG_savepinned = 4
  PG_foreign = 9
  PG_slob_free = 12
  PG_double_map = 13
  PG_isolated = 17
};

上面__NR_PAGEFLAGS表示flags中前26位用于表示page的状态,所以在转换时会忽略标志位的无效位。

将vma的flags转换为可读的字符

crash> vm -f 8000875
8000875: (READ|EXEC|MAYREAD|MAYWRITE|MAYEXEC|DENYWRITE|CAN_NONLINEAR)

标签:crash,17,pageflags,flags,PG,可读
From: https://www.cnblogs.com/pengdonglin137/p/17726083.html

相关文章