-
Notifications
You must be signed in to change notification settings - Fork 678
coredump: fix handling of num_pages #2815
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
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>
| 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") |
There was a problem hiding this comment.
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:
Line 13 in e879d69
| required uint32 compat_nr_pages = 2; |
There was a problem hiding this comment.
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
}
]
}
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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']?
|
What does this test do? Why doesn't get this error? |
The test seems to be correct. It is just running |
|
Merged. Thanks. |
This patch fixes the following error: