Skip to content
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

pagemap-cache: handle short reads #2411

Merged
merged 2 commits into from
May 28, 2024

Conversation

rst0git
Copy link
Member

@rst0git rst0git commented May 23, 2024

It is possible for pread() to return fewer number of bytes than requested. In such case, we need to repeat the read operation with appropriate offset.

Fixes: #2365

@rst0git rst0git requested a review from avagin May 23, 2024 13:31
@rst0git rst0git force-pushed the pagemap-cache-fix branch 3 times, most recently from 472a662 to f5789e3 Compare May 23, 2024 13:38
criu/pagemap-cache.c Fixed Show fixed Hide fixed
criu/pagemap-cache.c Fixed Show fixed Hide fixed
@rst0git rst0git force-pushed the pagemap-cache-fix branch 2 times, most recently from e7043b0 to 6737b5e Compare May 23, 2024 16:10
@avagin
Copy link
Member

avagin commented May 28, 2024

======================== Run zdtm/static/maps02 in uns =========================
Start test
./maps02 --pidfile=maps02.pid --outfile=maps02.out
Run criu dump
Run criu restore
=[log]=> dump/zdtm/static/maps02/117/1/restore.log
------------------------ grep Error ------------------------
b'(00.015045)      1: net: Try to restore a link 10:1:lo'
b'(00.015052)      1: net: Restoring link lo type 1'
b'(00.017672)      1: net: \tRunning ip addr restore'
b"ERROR: ld.so: object '/home/avagin/git/criu/test/ld-preload/libinterceptor.so' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored."
b'Error: ipv4: Address already assigned.'
b'Error: ipv6: address already assigned.'
------------------------ ERROR OVER ------------------------
Send the 15 signal to  145
Wait for zdtm/static/maps02(145) to die for 0.100000
Removing dump/zdtm/static/maps02/117
========================= Test zdtm/static/maps02 PASS =========================

Is this error expected?

test/zdtm.py Outdated Show resolved Hide resolved
@avagin
Copy link
Member

avagin commented May 28, 2024

Overall, it looks good to me. Thanks.

avagin and others added 2 commits May 28, 2024 11:19
It is possible for pread() to return fewer number of bytes than
requested. In such case, we need to repeat the read operation
with appropriate offset.

Signed-off-by: Andrei Vagin <[email protected]>
Signed-off-by: Radostin Stoyanov <[email protected]>
This commit adds a `--preload-libfault` option to ZDTM's run command.
This option runs CRIU with LD_PRELOAD to intercept libc functions
such as pread(). This method allows to simulate special cases,
for example, when a successful call to pread() transfers fewer
bytes than requested.

Signed-off-by: Radostin Stoyanov <[email protected]>
@rst0git
Copy link
Member Author

rst0git commented May 28, 2024

======================== Run zdtm/static/maps02 in uns =========================
...
b'(00.017672)      1: net: \tRunning ip addr restore'
b"ERROR: ld.so: object '/home/avagin/git/criu/test/ld-preload/libinterceptor.so' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored."

Is this error expected?

I was able to replicate this error on Ubuntu but not in Fedora.

It looks like the reason for the error is because the repository is under /home/avagin and the test is running with uns flavor, i.e., ip addr restore is running in the restored user namespace and unable to access the library path. However, I believe that we can ignore this as we are testing only the code path in CRIU and there is no need to set LD_PRELOAD for the ip tool.

@avagin avagin merged commit f4a16a0 into checkpoint-restore:criu-dev May 28, 2024
36 of 40 checks passed
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.

Checkpoint of chrome fails: pagemap-cache: Can't read 9397's pagemap file: No such file or directory
2 participants