• Pavel Emelyanov's avatar
    ipc: Restore mprotected sysvshmems · c7b5efd0
    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: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
    c7b5efd0
Name
Last commit
Last update
Documentation Loading commit data...
contrib Loading commit data...
crit Loading commit data...
criu Loading commit data...
images Loading commit data...
lib Loading commit data...
scripts Loading commit data...
test Loading commit data...
.gitignore Loading commit data...
.mailmap Loading commit data...
.travis.yml Loading commit data...
COPYING Loading commit data...
CREDITS Loading commit data...
INSTALL.md Loading commit data...
Makefile Loading commit data...
Makefile.install Loading commit data...
Makefile.versions Loading commit data...
README.md Loading commit data...