vmcoreinfo.rst 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596
  1. ==========
  2. VMCOREINFO
  3. ==========
  4. What is it?
  5. ===========
  6. VMCOREINFO is a special ELF note section. It contains various
  7. information from the kernel like structure size, page size, symbol
  8. values, field offsets, etc. These data are packed into an ELF note
  9. section and used by user-space tools like crash and makedumpfile to
  10. analyze a kernel's memory layout.
  11. Common variables
  12. ================
  13. init_uts_ns.name.release
  14. ------------------------
  15. The version of the Linux kernel. Used to find the corresponding source
  16. code from which the kernel has been built. For example, crash uses it to
  17. find the corresponding vmlinux in order to process vmcore.
  18. PAGE_SIZE
  19. ---------
  20. The size of a page. It is the smallest unit of data used by the memory
  21. management facilities. It is usually 4096 bytes of size and a page is
  22. aligned on 4096 bytes. Used for computing page addresses.
  23. init_uts_ns
  24. -----------
  25. The UTS namespace which is used to isolate two specific elements of the
  26. system that relate to the uname(2) system call. It is named after the
  27. data structure used to store information returned by the uname(2) system
  28. call.
  29. User-space tools can get the kernel name, host name, kernel release
  30. number, kernel version, architecture name and OS type from it.
  31. (uts_namespace, name)
  32. ---------------------
  33. Offset of the name's member. Crash Utility and Makedumpfile get
  34. the start address of the init_uts_ns.name from this.
  35. node_online_map
  36. ---------------
  37. An array node_states[N_ONLINE] which represents the set of online nodes
  38. in a system, one bit position per node number. Used to keep track of
  39. which nodes are in the system and online.
  40. swapper_pg_dir
  41. --------------
  42. The global page directory pointer of the kernel. Used to translate
  43. virtual to physical addresses.
  44. _stext
  45. ------
  46. Defines the beginning of the text section. In general, _stext indicates
  47. the kernel start address. Used to convert a virtual address from the
  48. direct kernel map to a physical address.
  49. VMALLOC_START
  50. -------------
  51. Stores the base address of vmalloc area. makedumpfile gets this value
  52. since is necessary for vmalloc translation.
  53. mem_map
  54. -------
  55. Physical addresses are translated to struct pages by treating them as
  56. an index into the mem_map array. Right-shifting a physical address
  57. PAGE_SHIFT bits converts it into a page frame number which is an index
  58. into that mem_map array.
  59. Used to map an address to the corresponding struct page.
  60. contig_page_data
  61. ----------------
  62. Makedumpfile gets the pglist_data structure from this symbol, which is
  63. used to describe the memory layout.
  64. User-space tools use this to exclude free pages when dumping memory.
  65. mem_section|(mem_section, NR_SECTION_ROOTS)|(mem_section, section_mem_map)
  66. --------------------------------------------------------------------------
  67. The address of the mem_section array, its length, structure size, and
  68. the section_mem_map offset.
  69. It exists in the sparse memory mapping model, and it is also somewhat
  70. similar to the mem_map variable, both of them are used to translate an
  71. address.
  72. MAX_PHYSMEM_BITS
  73. ----------------
  74. Defines the maximum supported physical address space memory.
  75. page
  76. ----
  77. The size of a page structure. struct page is an important data structure
  78. and it is widely used to compute contiguous memory.
  79. pglist_data
  80. -----------
  81. The size of a pglist_data structure. This value is used to check if the
  82. pglist_data structure is valid. It is also used for checking the memory
  83. type.
  84. zone
  85. ----
  86. The size of a zone structure. This value is used to check if the zone
  87. structure has been found. It is also used for excluding free pages.
  88. free_area
  89. ---------
  90. The size of a free_area structure. It indicates whether the free_area
  91. structure is valid or not. Useful when excluding free pages.
  92. list_head
  93. ---------
  94. The size of a list_head structure. Used when iterating lists in a
  95. post-mortem analysis session.
  96. nodemask_t
  97. ----------
  98. The size of a nodemask_t type. Used to compute the number of online
  99. nodes.
  100. (page, flags|_refcount|mapping|lru|_mapcount|private|compound_order|compound_head)
  101. ----------------------------------------------------------------------------------
  102. User-space tools compute their values based on the offset of these
  103. variables. The variables are used when excluding unnecessary pages.
  104. (pglist_data, node_zones|nr_zones|node_mem_map|node_start_pfn|node_spanned_pages|node_id)
  105. -----------------------------------------------------------------------------------------
  106. On NUMA machines, each NUMA node has a pg_data_t to describe its memory
  107. layout. On UMA machines there is a single pglist_data which describes the
  108. whole memory.
  109. These values are used to check the memory type and to compute the
  110. virtual address for memory map.
  111. (zone, free_area|vm_stat|spanned_pages)
  112. ---------------------------------------
  113. Each node is divided into a number of blocks called zones which
  114. represent ranges within memory. A zone is described by a structure zone.
  115. User-space tools compute required values based on the offset of these
  116. variables.
  117. (free_area, free_list)
  118. ----------------------
  119. Offset of the free_list's member. This value is used to compute the number
  120. of free pages.
  121. Each zone has a free_area structure array called free_area[NR_PAGE_ORDERS].
  122. The free_list represents a linked list of free page blocks.
  123. (list_head, next|prev)
  124. ----------------------
  125. Offsets of the list_head's members. list_head is used to define a
  126. circular linked list. User-space tools need these in order to traverse
  127. lists.
  128. (vmap_area, va_start|list)
  129. --------------------------
  130. Offsets of the vmap_area's members. They carry vmalloc-specific
  131. information. Makedumpfile gets the start address of the vmalloc region
  132. from this.
  133. (zone.free_area, NR_PAGE_ORDERS)
  134. --------------------------------
  135. Free areas descriptor. User-space tools use this value to iterate the
  136. free_area ranges. NR_PAGE_ORDERS is used by the zone buddy allocator.
  137. prb
  138. ---
  139. A pointer to the printk ringbuffer (struct printk_ringbuffer). This
  140. may be pointing to the static boot ringbuffer or the dynamically
  141. allocated ringbuffer, depending on when the core dump occurred.
  142. Used by user-space tools to read the active kernel log buffer.
  143. printk_rb_static
  144. ----------------
  145. A pointer to the static boot printk ringbuffer. If @prb has a
  146. different value, this is useful for viewing the initial boot messages,
  147. which may have been overwritten in the dynamically allocated
  148. ringbuffer.
  149. clear_seq
  150. ---------
  151. The sequence number of the printk() record after the last clear
  152. command. It indicates the first record after the last
  153. SYSLOG_ACTION_CLEAR, like issued by 'dmesg -c'. Used by user-space
  154. tools to dump a subset of the dmesg log.
  155. printk_ringbuffer
  156. -----------------
  157. The size of a printk_ringbuffer structure. This structure contains all
  158. information required for accessing the various components of the
  159. kernel log buffer.
  160. (printk_ringbuffer, desc_ring|text_data_ring|dict_data_ring|fail)
  161. -----------------------------------------------------------------
  162. Offsets for the various components of the printk ringbuffer. Used by
  163. user-space tools to view the kernel log buffer without requiring the
  164. declaration of the structure.
  165. prb_desc_ring
  166. -------------
  167. The size of the prb_desc_ring structure. This structure contains
  168. information about the set of record descriptors.
  169. (prb_desc_ring, count_bits|descs|head_id|tail_id)
  170. -------------------------------------------------
  171. Offsets for the fields describing the set of record descriptors. Used
  172. by user-space tools to be able to traverse the descriptors without
  173. requiring the declaration of the structure.
  174. prb_desc
  175. --------
  176. The size of the prb_desc structure. This structure contains
  177. information about a single record descriptor.
  178. (prb_desc, info|state_var|text_blk_lpos|dict_blk_lpos)
  179. ------------------------------------------------------
  180. Offsets for the fields describing a record descriptors. Used by
  181. user-space tools to be able to read descriptors without requiring
  182. the declaration of the structure.
  183. prb_data_blk_lpos
  184. -----------------
  185. The size of the prb_data_blk_lpos structure. This structure contains
  186. information about where the text or dictionary data (data block) is
  187. located within the respective data ring.
  188. (prb_data_blk_lpos, begin|next)
  189. -------------------------------
  190. Offsets for the fields describing the location of a data block. Used
  191. by user-space tools to be able to locate data blocks without
  192. requiring the declaration of the structure.
  193. printk_info
  194. -----------
  195. The size of the printk_info structure. This structure contains all
  196. the meta-data for a record.
  197. (printk_info, seq|ts_nsec|text_len|dict_len|caller_id)
  198. ------------------------------------------------------
  199. Offsets for the fields providing the meta-data for a record. Used by
  200. user-space tools to be able to read the information without requiring
  201. the declaration of the structure.
  202. prb_data_ring
  203. -------------
  204. The size of the prb_data_ring structure. This structure contains
  205. information about a set of data blocks.
  206. (prb_data_ring, size_bits|data|head_lpos|tail_lpos)
  207. ---------------------------------------------------
  208. Offsets for the fields describing a set of data blocks. Used by
  209. user-space tools to be able to access the data blocks without
  210. requiring the declaration of the structure.
  211. atomic_long_t
  212. -------------
  213. The size of the atomic_long_t structure. Used by user-space tools to
  214. be able to copy the full structure, regardless of its
  215. architecture-specific implementation.
  216. (atomic_long_t, counter)
  217. ------------------------
  218. Offset for the long value of an atomic_long_t variable. Used by
  219. user-space tools to access the long value without requiring the
  220. architecture-specific declaration.
  221. (free_area.free_list, MIGRATE_TYPES)
  222. ------------------------------------
  223. The number of migrate types for pages. The free_list is described by the
  224. array. Used by tools to compute the number of free pages.
  225. NR_FREE_PAGES
  226. -------------
  227. On linux-2.6.21 or later, the number of free pages is in
  228. vm_stat[NR_FREE_PAGES]. Used to get the number of free pages.
  229. PG_lru|PG_private|PG_swapcache|PG_swapbacked|PG_slab|PG_hwpoision|PG_head_mask|PG_hugetlb
  230. -----------------------------------------------------------------------------------------
  231. Page attributes. These flags are used to filter various unnecessary for
  232. dumping pages.
  233. PAGE_BUDDY_MAPCOUNT_VALUE(~PG_buddy)|PAGE_OFFLINE_MAPCOUNT_VALUE(~PG_offline)
  234. -----------------------------------------------------------------------------
  235. More page attributes. These flags are used to filter various unnecessary for
  236. dumping pages.
  237. x86_64
  238. ======
  239. phys_base
  240. ---------
  241. Used to convert the virtual address of an exported kernel symbol to its
  242. corresponding physical address.
  243. init_top_pgt
  244. ------------
  245. Used to walk through the whole page table and convert virtual addresses
  246. to physical addresses. The init_top_pgt is somewhat similar to
  247. swapper_pg_dir, but it is only used in x86_64.
  248. pgtable_l5_enabled
  249. ------------------
  250. User-space tools need to know whether the crash kernel was in 5-level
  251. paging mode.
  252. node_data
  253. ---------
  254. This is a struct pglist_data array and stores all NUMA nodes
  255. information. Makedumpfile gets the pglist_data structure from it.
  256. (node_data, MAX_NUMNODES)
  257. -------------------------
  258. The maximum number of nodes in system.
  259. KERNELOFFSET
  260. ------------
  261. The kernel randomization offset. Used to compute the page offset. If
  262. KASLR is disabled, this value is zero.
  263. KERNEL_IMAGE_SIZE
  264. -----------------
  265. Currently unused by Makedumpfile. Used to compute the module virtual
  266. address by Crash.
  267. sme_mask
  268. --------
  269. AMD-specific with SME support: it indicates the secure memory encryption
  270. mask. Makedumpfile tools need to know whether the crash kernel was
  271. encrypted. If SME is enabled in the first kernel, the crash kernel's
  272. page table entries (pgd/pud/pmd/pte) contain the memory encryption
  273. mask. This is used to remove the SME mask and obtain the true physical
  274. address.
  275. Currently, sme_mask stores the value of the C-bit position. If needed,
  276. additional SME-relevant info can be placed in that variable.
  277. For example::
  278. [ misc ][ enc bit ][ other misc SME info ]
  279. 0000_0000_0000_0000_1000_0000_0000_0000_0000_0000_..._0000
  280. 63 59 55 51 47 43 39 35 31 27 ... 3
  281. x86_32
  282. ======
  283. X86_PAE
  284. -------
  285. Denotes whether physical address extensions are enabled. It has the cost
  286. of a higher page table lookup overhead, and also consumes more page
  287. table space per process. Used to check whether PAE was enabled in the
  288. crash kernel when converting virtual addresses to physical addresses.
  289. ARM64
  290. =====
  291. VA_BITS
  292. -------
  293. The maximum number of bits for virtual addresses. Used to compute the
  294. virtual memory ranges.
  295. kimage_voffset
  296. --------------
  297. The offset between the kernel virtual and physical mappings. Used to
  298. translate virtual to physical addresses.
  299. PHYS_OFFSET
  300. -----------
  301. Indicates the physical address of the start of memory. Similar to
  302. kimage_voffset, which is used to translate virtual to physical
  303. addresses.
  304. KERNELOFFSET
  305. ------------
  306. The kernel randomization offset. Used to compute the page offset. If
  307. KASLR is disabled, this value is zero.
  308. KERNELPACMASK
  309. -------------
  310. The mask to extract the Pointer Authentication Code from a kernel virtual
  311. address.
  312. TCR_EL1.T1SZ
  313. ------------
  314. Indicates the size offset of the memory region addressed by TTBR1_EL1.
  315. The region size is 2^(64-T1SZ) bytes.
  316. TTBR1_EL1 is the table base address register specified by ARMv8-A
  317. architecture which is used to lookup the page-tables for the Virtual
  318. addresses in the higher VA range (refer to ARMv8 ARM document for
  319. more details).
  320. MODULES_VADDR|MODULES_END|VMALLOC_START|VMALLOC_END|VMEMMAP_START|VMEMMAP_END
  321. -----------------------------------------------------------------------------
  322. Used to get the correct ranges:
  323. MODULES_VADDR ~ MODULES_END-1 : Kernel module space.
  324. VMALLOC_START ~ VMALLOC_END-1 : vmalloc() / ioremap() space.
  325. VMEMMAP_START ~ VMEMMAP_END-1 : vmemmap region, used for struct page array.
  326. arm
  327. ===
  328. ARM_LPAE
  329. --------
  330. It indicates whether the crash kernel supports large physical address
  331. extensions. Used to translate virtual to physical addresses.
  332. s390
  333. ====
  334. lowcore_ptr
  335. -----------
  336. An array with a pointer to the lowcore of every CPU. Used to print the
  337. psw and all registers information.
  338. high_memory
  339. -----------
  340. Used to get the vmalloc_start address from the high_memory symbol.
  341. (lowcore_ptr, NR_CPUS)
  342. ----------------------
  343. The maximum number of CPUs.
  344. powerpc
  345. =======
  346. node_data|(node_data, MAX_NUMNODES)
  347. -----------------------------------
  348. See above.
  349. contig_page_data
  350. ----------------
  351. See above.
  352. vmemmap_list
  353. ------------
  354. The vmemmap_list maintains the entire vmemmap physical mapping. Used
  355. to get vmemmap list count and populated vmemmap regions info. If the
  356. vmemmap address translation information is stored in the crash kernel,
  357. it is used to translate vmemmap kernel virtual addresses.
  358. mmu_vmemmap_psize
  359. -----------------
  360. The size of a page. Used to translate virtual to physical addresses.
  361. mmu_psize_defs
  362. --------------
  363. Page size definitions, i.e. 4k, 64k, or 16M.
  364. Used to make vtop translations.
  365. vmemmap_backing|(vmemmap_backing, list)|(vmemmap_backing, phys)|(vmemmap_backing, virt_addr)
  366. --------------------------------------------------------------------------------------------
  367. The vmemmap virtual address space management does not have a traditional
  368. page table to track which virtual struct pages are backed by a physical
  369. mapping. The virtual to physical mappings are tracked in a simple linked
  370. list format.
  371. User-space tools need to know the offset of list, phys and virt_addr
  372. when computing the count of vmemmap regions.
  373. mmu_psize_def|(mmu_psize_def, shift)
  374. ------------------------------------
  375. The size of a struct mmu_psize_def and the offset of mmu_psize_def's
  376. member.
  377. Used in vtop translations.
  378. sh
  379. ==
  380. node_data|(node_data, MAX_NUMNODES)
  381. -----------------------------------
  382. See above.
  383. X2TLB
  384. -----
  385. Indicates whether the crashed kernel enabled SH extended mode.
  386. RISCV64
  387. =======
  388. VA_BITS
  389. -------
  390. The maximum number of bits for virtual addresses. Used to compute the
  391. virtual memory ranges.
  392. PAGE_OFFSET
  393. -----------
  394. Indicates the virtual kernel start address of the direct-mapped RAM region.
  395. phys_ram_base
  396. -------------
  397. Indicates the start physical RAM address.
  398. MODULES_VADDR|MODULES_END|VMALLOC_START|VMALLOC_END|VMEMMAP_START|VMEMMAP_END|KERNEL_LINK_ADDR
  399. ----------------------------------------------------------------------------------------------
  400. Used to get the correct ranges:
  401. * MODULES_VADDR ~ MODULES_END : Kernel module space.
  402. * VMALLOC_START ~ VMALLOC_END : vmalloc() / ioremap() space.
  403. * VMEMMAP_START ~ VMEMMAP_END : vmemmap space, used for struct page array.
  404. * KERNEL_LINK_ADDR : start address of Kernel link and BPF
  405. va_kernel_pa_offset
  406. -------------------
  407. Indicates the offset between the kernel virtual and physical mappings.
  408. Used to translate virtual to physical addresses.