CRaC / criu

Other
28 stars 10 forks source link

Use read_all/pread_all where we expect full buffer to be read #12

Open rvansa opened 11 months ago

rvansa commented 11 months ago

I've found that some GHA's in OpenJDK/crac are failing due to this error, and I think I've seen that even locally (on ia32) though rarely:

(00.040592) Error (criu/pagemap-cache.c:158): pagemap-cache: Can't read 9142's pagemap file: No such file or directory
(00.040595) Error (criu/pagemap-cache.c:173): pagemap-cache: Failed to fill cache for 9142 (ffe3b000-ffe3c000)
(00.040617) page-pipe: Killing page pipe
(00.040798) ----------------------------------------
(00.040804) Error (criu/mem.c:625): Can't dump page with parasite

Turns out that some parts of code use read(...) or pread(...) without handling that the call returns less bytes than the full size of the buffer; I've replaced those places where the expectation is obvious (error message if the returned value does not match buffer size) with read_all and new pread_all utility function.

rvansa commented 11 months ago

@wkia Please review.

wkia commented 10 months ago

@rvansa Sorry, missed this PR.

LGTM

jankratochvil commented 7 months ago

LGTM now.