-
Pavel Emelyanov authored
Image a process has done shmget(2 pages), then shmat() then mprotect(1 page, ro). In this case criu will dump 1 shmem segment 2 pages long and 2 vmas 1 page each. But on restore time we'll call shmat() for _each_ vma and the very first one will occupy the whole 2 pages space in vm (there's no size argument for shmat, only for shmget) thus blocking the 2nd vma from shmat()-in again. The solution is: 1. check that each shmem segment is attached by the sequence of vmas that cover one w/o holes 2. shmat() only the first one 3. mprotect() all of them if needed (there's no hunks for this step in this path, mprotect is already called in pie/restorer.c and does things well) v2: * List can contain anon shmems (caught by zdtm) * There can be many attachments of a segment (caught by transition/ipc) Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com>
c7b5efd0