Attached debdiff for Jammy.
** Description changed:
[ Impact ]
On Jammy with the 6.8 HWE kernel, makedumpfile 1.7.0 can’t identify hugetlb
pages, so "-d 8" or the default "-d 31" does not exclude them. Hugepage
contents end up in the crash dump and for this reason the dumps are much larger
and take longer to save and may contain user data that should be filtered.
Since 6.3 the kernel changed how hugetlb pages are recognized by the kernel
several times. Ubuntu's 6.8 kernel has the 6.9 kernel change: its vmcoreinfo
exports NUMBER(PAGE_HUGETLB_MAPCOUNT_VALUE) and no PG_hugetlb, so
makedumpfile needs commit 985e575 to recognise hugetlb pages. But it doesn’t
apply without 9661c1d.
Noble has both fixes: 9661c1d comes from upstream makedumpfile (version
+1.7.4) and 985e575 is applied as an Ubuntu patch in 1:1.7.5-1ubuntu1
from LP: #2125145.
[ Test Plan ]
Jammy VM with linux-generic-hwe-22.04 (6.8), kdump-tools installed and "ready
to kdump", hugepages reserved on the kernel command line, example:
default_hugepagesz=1G hugepagesz=1G hugepages=4
First, confirm the kernel uses the new check:
sudo head -c 4000000 /proc/kcore | strings | grep
PAGE_HUGETLB_MAPCOUNT_VALUE
## Test 1 - without crashing the V: ##
sudo makedumpfile -f --mem-usage /proc/kcore
Before the fix: the hugetlb pool is accounted for under ZERO (and KERN_DATA)
and USER is small.
After the fix: USER grows by about HugePages_Total * Hugepagesize / 4 KiB (50
x 1 GiB = 13107200 pages) and ZERO + KERN_DATA shrink by about the same amount.
Example on a Jammy VM with 50 allocated 1G hugepages:
########### Before the fix:
ubuntu@ubuntu:~$ sudo makedumpfile -f --mem-usage /proc/kcore
The kernel version is not supported.
The makedumpfile operation may be incomplete.
TYPE PAGES EXCLUDABLE DESCRIPTION
----------------------------------------------------------------------
ZERO 12120893 yes Pages filled with zero
NON_PRI_CACHE 179465 yes Cache pages without
private flag
PRI_CACHE 61558 yes Cache pages with
private flag
USER 20575 yes User process pages
FREE 348293 yes Free pages
KERN_DATA 1372169 no Dumpable kernel data
page size: 4096
Total pages on system: 14102953
Total size on system: 57765695488 Byte
########## After the fix:
ubuntu@ubuntu:~$ sudo makedumpfile -f --mem-usage /proc/kcore
The kernel version is not supported.
The makedumpfile operation may be incomplete.
TYPE PAGES EXCLUDABLE DESCRIPTION
----------------------------------------------------------------------
ZERO 38246 yes Pages filled with zero
NON_PRI_CACHE 274662 yes Cache pages without
private flag
PRI_CACHE 77736 yes Cache pages with
private flag
USER 13127927 yes User process pages
FREE 227967 yes Free pages
KERN_DATA 356415 no Dumpable kernel data
page size: 4096
Total pages on system: 14102953
Total size on system: 57765695488 Byte
So now, the hugepages are accounted under USER.
## Test 2 - real crash dump, default MAKEDUMP_ARGS ("-c -d 31"): ##
Check that kdump is ready and the pool is reserved:
kdump-config show | grep -i ready
grep -i huge /proc/meminfo
Trigger a crash:
echo c | sudo tee /proc/sysrq-trigger
###### Before the fix:
The hugetlb pool is not excluded, so the dump is much bigger and takes longer
to collect.
ubuntu@ubuntu:/var/crash/202611231512$ ls -lh
total 1.6G
-rw------- 1 root root 64K Nov 23 15:13 dmesg.202611231512
-rw-r--r-- 1 root root 1.6G Nov 23 15:13 dump.202611231512
#### After the fix:
The pool is excluded, so the dump is much smaller and is collected faster.
ubuntu@ubuntu:/var/crash/202611251147$ ls -lh
total 130M
-rw------- 1 root root 62K Nov 25 11:47 dmesg.202611251147
-rw-r--r-- 1 root root 130M Nov 25 11:47 dump.202611251147
As an extra evidence with a small C program (hugepage_marker.c). It maps
N 1 GiB hugepages, fills each one with a marker text
(HUGEPAGE_MARKER<page index>), prints the physical address of every page
and then crashes the system. After the crash I open the dump with crash
and read the pages with "rd -p": if the marker text is returned, the
page is in the dump; if "page excluded" is returned, it was filtered
out.
The physical addresses are printed in the log and change from each boot,
so they are different in the two runs below.
Before the fix:
The hugepages are in the dump.
# run the hugepage_marker.c
sudo sh -c './hugepage_marker -n 2 -s 1G -m start -a crash > /root/no-fix.log
2>&1'
# page 0 (physical 0x140000000)
crash> rd -p -a 0x140000000 64
rd: page excluded: physical address: 140000000 type: "ascii"
crash> rd -p -a 0x160000000 64
160000000:
ER00000000HUGEPAGE_MARKER00000000HUGEPAGE_MARKER00000000HUGE
16000003c: PAGE
crash> rd -p -a 0x17ffff000 64
17ffff000:
UGEPAGE_MARKER00000000HUGEPAGE_MARKER00000000HUGEPAGE_MARKER
17ffff03c: 0000
# page 1 (physical 0x180000000)
crash> rd -p -a 0x180000000 64
rd: page excluded: physical address: 180000000 type: "ascii"
crash> rd -p -a 0x1a0000000 64
1a0000000:
ER00000001HUGEPAGE_MARKER00000001HUGEPAGE_MARKER00000001HUGE
1a000003c: PAGE
crash> rd -p -a 0x1bffff000 64
1bffff000:
UGEPAGE_MARKER00000001HUGEPAGE_MARKER00000001HUGEPAGE_MARKER
1bffff03c: 0000
The middle and the last address of both pages return the marker, so the
hugepages are in the dump. Only the very first 4 KiB of each page is
reported as excluded (because the old makedumpfile only recognises the
first page of the compound page, not the rest).
After the fix:
The hugepages are not in the dump.
sudo sh -c './hugepage_marker -n 2 -s 1G -m start -a crash >
/root/fix.log 2>&1'
# page 0 (physical 0x100000000)
crash> rd -p -a 0x100000000 64
rd: page excluded: physical address: 100000000 type: "ascii"
crash> rd -p -a 0x120000000 64
rd: page excluded: physical address: 120000000 type: "ascii"
crash> rd -p -a 0x13ffff000 64
rd: page excluded: physical address: 13ffff000 type: "ascii"
# page 1 (physical 0x140000000)
crash> rd -p -a 0x140000000 64
rd: page excluded: physical address: 140000000 type: "ascii"
crash> rd -p -a 0x160000000 64
rd: page excluded: physical address: 160000000 type: "ascii"
crash> rd -p -a 0x17ffff000 64
rd: page excluded: physical address: 17ffff000 type: "ascii"
Now start, middle and end of both pages are excluded.
I checked for regression with the default "-c -d 31", on the GA 5.15
kernel and on the HWE 6.8 kernel: a crash produced dump + dmesg files in
/var/crash; crash opened the dump; "sys", "bt", "kmem -i" worked.
[ Where problems could occur ]
- The patches change how makedumpfile classifies compound pages when it filters
a dump. A bug could be that it excludes pages that should be kept so there
would be missing data in the dump or keep pages that should go, resulting in
larger dumps.
+ These patches change how makedumpfile classifies compound pages when it
filters a dump. A bug here could make it exclude pages that should be kept,
leaving an incomplete dump that crash may not be able to open or analyse. It
could also make it keep pages that should be excluded, making larger dumps.
- The new code paths only run when vmcoreinfo exports PG_hugetlb or
- PAGE_HUGETLB_MAPCOUNT_VALUE (6.6+ kernels), so the GA 5.15 kernel keeps the
old behaviour. Only two small things would run on every kernel: an extra
condition in isHugetlb() that won't be true on 5.15, and two optional numbers
that are read from vmcoreinfo that are not found there (for 5.15). The
regression tests on 5.15 check that nothing changed.
+ The new code paths only run when vmcoreinfo exports PG_hugetlb (6.6+) or
+ PAGE_HUGETLB_MAPCOUNT_VALUE (6.9+), so on the GA 5.15 kernel
+ makedumpfile keeps its old behaviour. Only three small changes run on
+ every kernel: an extra condition in isHugetlb() that won't be true on
+ 5.15; two optional values looked up in vmcoreinfo that 5.15 doesn't
+ export, so they stay unset and a read of page._mapcount moved earlier in
+ the loop, which reads the same value.
- A problem would also be: a dump that is incomplete or that crash cannot
- open.
+ Regression tests on 5.15 check that this behaviour hasn't changed.
[ Other Info ]
Commits 9661c1d and 985e575 are backported.
Commit 985e575: the Jammy HWE kernel is 6.8 and its vmcoreinfo exports
PAGE_HUGETLB_MAPCOUNT_VALUE (and not PG_hugetlb). makedumpfile only
recognises a hugetlb page if it understands how they are marked by the kernel.
In 985e575 it reads that number and checks the _mapcount of the page, so the
hugetlb pages are found and "-d 8" or "-d 31" can exclude them.
Commit 9661c1d: 985e575 does not apply without it. 9661c1d introduces
IS_HUGETLB, the check_order label and the PG_hugetlb field that 985e575 builds
on.
Noble has both backported commits: 9661c1d from upstream and 985e575 as an
Ubuntu patch in 1:1.7.5-1ubuntu1 (LP: #2125145).
** Patch added: "lp2175732-jammy.debdiff"
https://bugs.launchpad.net/ubuntu/+source/makedumpfile/+bug/2175732/+attachment/6021123/+files/lp2175732-jammy.debdiff
** Changed in: makedumpfile (Ubuntu Jammy)
Assignee: (unassigned) => Ioana Lazea (ioanalazea)
--
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2175732
Title:
makedumpfile 1.7.0 cannot identify hugetlb pages
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/makedumpfile/+bug/2175732/+subscriptions
--
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs