Skip to content

Conversation

@rst0git
Copy link
Member

@rst0git rst0git commented Nov 9, 2025

This patch fixes the following error:

$ sudo make -C test/others/criu-coredump run
...
Traceback (most recent call last):
  File "/home/circleci/criu/coredump/coredump", line 55, in <module>
    main()
  File "/home/circleci/criu/coredump/coredump", line 47, in main
    coredump(opts)
  File "/home/circleci/criu/coredump/coredump", line 14, in coredump
    cores = generator(os.path.realpath(opts['in']))
  File "/home/circleci/criu/coredump/criu_coredump/coredump.py", line 192, in __call__
    self.coredumps[pid] = self._gen_coredump(pid)
  File "/home/circleci/criu/coredump/criu_coredump/coredump.py", line 214, in _gen_coredump
    cd.vmas = self._gen_vmas(pid)
  File "/home/circleci/criu/coredump/criu_coredump/coredump.py", line 992, in _gen_vmas
    v.data = self._gen_mem_chunk(pid, vma, v.filesz)
  File "/home/circleci/criu/coredump/criu_coredump/coredump.py", line 879, in _gen_mem_chunk
    page_mem = self._get_page(pid, page_no)
  File "/home/circleci/criu/coredump/criu_coredump/coredump.py", line 797, in _get_page
    num_pages = m.get("nr_pages", m.compat_nr_pages)
AttributeError: 'dict' object has no attribute 'compat_nr_pages'
+ exit 1 make[1]: *** [Makefile:3: run] Error 1

This patch fixes the following error:

$ sudo make -C test/others/criu-coredump run
...
Traceback (most recent call last):
  File "/home/circleci/criu/coredump/coredump", line 55, in <module>
    main()
  File "/home/circleci/criu/coredump/coredump", line 47, in main
    coredump(opts)
  File "/home/circleci/criu/coredump/coredump", line 14, in coredump
    cores = generator(os.path.realpath(opts['in']))
  File "/home/circleci/criu/coredump/criu_coredump/coredump.py", line 192, in __call__
    self.coredumps[pid] = self._gen_coredump(pid)
  File "/home/circleci/criu/coredump/criu_coredump/coredump.py", line 214, in _gen_coredump
    cd.vmas = self._gen_vmas(pid)
  File "/home/circleci/criu/coredump/criu_coredump/coredump.py", line 992, in _gen_vmas
    v.data = self._gen_mem_chunk(pid, vma, v.filesz)
  File "/home/circleci/criu/coredump/criu_coredump/coredump.py", line 879, in _gen_mem_chunk
    page_mem = self._get_page(pid, page_no)
  File "/home/circleci/criu/coredump/criu_coredump/coredump.py", line 797, in _get_page
    num_pages = m.get("nr_pages", m.compat_nr_pages)
AttributeError: 'dict' object has no attribute 'compat_nr_pages'
+ exit 1
make[1]: *** [Makefile:3: run] Error 1

Signed-off-by: Radostin Stoyanov <rstoyanov@fedoraproject.org>
@rst0git rst0git requested a review from avagin November 9, 2025 16:29
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']?

@avagin
Copy link
Member

avagin commented Nov 9, 2025

What does this test do? Why doesn't get this error?

@rst0git
Copy link
Member Author

rst0git commented Nov 9, 2025

What does this test do? Why doesn't get this error?

The test seems to be correct. It is just running criu-coredump and fails due to a syntax error in the Python code. I somehow missed this in #2809.

@avagin
Copy link
Member

avagin commented Nov 10, 2025

Merged. Thanks.

@avagin avagin closed this Nov 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants