Skip to content

Commit

Permalink
meminfo: fix VMALLOC_END with 5-level paging
Browse files Browse the repository at this point in the history
When 5-level paging is enabled, VMALLOC_SIZE_TB is much larger (see
pgtable_64_types.h as cited in the code). This fixes test failures with
CTF on live kernels (since this is the only way that we can compare
against the real /proc/meminfo).

Sadly, Gitlab is not currently running live CTF tests, so I only found
this during RPM release prep for drgn. CTF testing is definitely
possible for the heavy VM tests, all that is necessary is to get it up
and running. This helps reveal the need for it.

Signed-off-by: Stephen Brennan <[email protected]>
  • Loading branch information
brenns10 committed Apr 2, 2024
1 parent 3a08bca commit 1954caf
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drgn_tools/meminfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from drgn import Object
from drgn import Program
from drgn.helpers.linux import list_for_each_entry
from drgn.helpers.linux.boot import pgtable_l5_enabled
from drgn.helpers.linux.percpu import percpu_counter_sum

from drgn_tools.corelens import CorelensModule
Expand Down Expand Up @@ -120,7 +121,7 @@ def get_mm_constants(prog: Program) -> Dict[str, int]:
# arch/x86/include/asm/pgtable_64_types.h
_pmd_shift = 21
if "vmalloc_base" in prog:
_vmalloc_size_tb = 32
_vmalloc_size_tb = 12800 if pgtable_l5_enabled(prog) else 32
mm_consts["VMALLOC_START"] = prog["vmalloc_base"].value_()
mm_consts["VMALLOC_END"] = (
mm_consts["VMALLOC_START"] + (_vmalloc_size_tb << 40) - 1
Expand Down

0 comments on commit 1954caf

Please sign in to comment.