Follow-up: I reproduced both page-size cases and tested a candidate fix.
This adds validation beyond the existing report; the patch is still a
candidate, not an upstream-confirmed fix.
I built from upstream v6.8.0 plus the Ubuntu 6.8.0-151.151 source delta,
with the old three-struct-page reset restored on normal tail restoration
only. The rollback path is left unchanged (`vmemmap_tail` is non-NULL
for that walk). The relevant change is:
```diff
+#define NR_RESET_STRUCT_PAGE 3
+static inline void reset_struct_pages(struct page *start)
+{
+ struct page *from = start + NR_RESET_STRUCT_PAGE;
+ BUILD_BUG_ON(NR_RESET_STRUCT_PAGE * 2 > PAGE_SIZE / sizeof(struct page));
+ memcpy(start, from, sizeof(*from) * NR_RESET_STRUCT_PAGE);
+}
+
+ copy_page(page_to_virt(dst), page_to_virt(src));
+ if (!walk->vmemmap_tail)
+ reset_struct_pages(page_to_virt(dst));
```
Diskless/networkless QEMU results (8 GiB, 2 vCPU; HVO on): stock
6.8.0-151 produced 60 bad-page reports for 1024 x 2 MiB pages and 60 for
2 x 1 GiB pages; both runs tainted the kernel. In the 1 GiB case, the
bad PFNs advanced by 0x40. The 6.8.0-149/HVO-on and 6.8.0-151/HVO-off
controls had zero reports. The patched build passed repeated 2 MiB and 1
GiB runs with zero reports and no taint; about 2 GiB returned to MemFree
in each case.
Could you review whether this 6.8-specific conditional reset is the
right adaptation? Validation so far is QEMU-only.
--
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2179422
Title:
Noble 6.8.0-151 (since -150?): freeing HugeTLB pages with
hugetlb_free_vmemmap=on gives "BUG: Bad page state" and leaks memory
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/2179422/+subscriptions
--
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs