Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion coredump/criu_coredump/coredump.py
Original file line number Diff line number Diff line change
Expand Up @@ -794,7 +794,11 @@ def _get_page(self, pid, page_no):
off = 0 # in pages
for m in pagemap[1:]:
found = False
num_pages = m.get("nr_pages", m.compat_nr_pages)
num_pages = m.get("nr_pages", m.get("compat_nr_pages"))

if num_pages is None:
raise ValueError("num_pages and compat_nr_pages are missing")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how is it possible? cmpat_nr_pages is a required field:

required uint32 compat_nr_pages = 2;

Copy link
Member Author

@rst0git rst0git Nov 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error appears in the CentOS Stream 9 based test CI test for the master branch (https://cirrus-ci.com/task/4855368628568064) and I was able to replicate it locally:

$ sudo crit show test/others/criu-coredump/pagemap-44763.img
{
    "magic": "PAGEMAP",
    "entries": [
        {
            "pages_id": 1
        },
        {
            "vaddr": "0x400000",
            "compat_nr_pages": 0,
            "flags": "PE_PRESENT",
            "nr_pages": 1
        },
        {
            "vaddr": "0x402000",
            "compat_nr_pages": 0,
            "flags": "PE_PRESENT",
            "nr_pages": 2
        },
        {
            "vaddr": "0x7fe251884000",
            "compat_nr_pages": 0,
            "flags": "PE_PRESENT",
            "nr_pages": 2
        },
        {
            "vaddr": "0x7fe251a6b000",
            "compat_nr_pages": 0,
            "flags": "PE_PRESENT",
            "nr_pages": 7
        },
        {
            "vaddr": "0x7fe251a75000",
            "compat_nr_pages": 0,
            "flags": "PE_PRESENT",
            "nr_pages": 4
        },
        {
            "vaddr": "0x7fe251a96000",
            "compat_nr_pages": 0,
            "flags": "PE_PRESENT",
            "nr_pages": 2
        },
        {
            "vaddr": "0x7fe251a9e000",
            "compat_nr_pages": 0,
            "flags": "PE_PRESENT",
            "nr_pages": 2
        },
        {
            "vaddr": "0x7fe251ad4000",
            "compat_nr_pages": 0,
            "flags": "PE_PRESENT",
            "nr_pages": 4
        },
        {
            "vaddr": "0x7fffaf010000",
            "compat_nr_pages": 0,
            "flags": "PE_PRESENT",
            "nr_pages": 4
        }
    ]
}

Copy link
Member Author

@rst0git rst0git Nov 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this case m is a dictionary, so m['compat_nr_pages'] works but m.compat_nr_pages does not.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we use m['compat_nr_pages']?


for i in range(num_pages):
if m["vaddr"] + i * PAGESIZE == page_no * PAGESIZE:
found = True
Expand Down
Loading