• Stanislav Kinsburskiy's avatar
    proc_parse: fix vma file open mode recognition · 57a691f6
    Stanislav Kinsburskiy authored
    WIth current code we have smth like
    
    1) If file was opened with O_WRONLY, this mode is simply lost.
    2) If file was opened with O_RDWR, but mapping is private, resulting mode will be O_RDONLY
    
    The correct place to get fd open flags for file mappings is
    /proc/<pid>/map_files.
    An attempt tp speculate on "shared" and "maywrite" bits doesn't garantee,
    that file will be opened with correct permissions on restore.
    Here is an example:
    
    Process mapping (read/write):
    
    # cat /proc/481943/maps | grep 7f7108077000-7f7108078000
    7f7108077000-7f7108078000 rw-p 00001000 00:35 7 <snip>
    
    1) Before suspend:
    
    # ls -l /proc/481427/map_files/7f7108077000-7f7108078000
    lrw------- <snip> /proc/481427/map_files/7f7108077000-7f7108078000 -> <snip>
    
    2) After restore:
    
    # ls -l /proc/481943/map_files/7f7108077000-7f7108078000
    lr-------- <snip> /proc/481943/map_files/7f7108077000-7f7108078000 -> <snip>
    
    Write bit is lost.
    
    This patch set vma->e->fdflags as /proc/<pid>/map_files/<vma> open mode.
    Signed-off-by: 's avatarStanislav Kinsburskiy <skinsbursky@virtuozzo.com>
    Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
    57a691f6
Name
Last commit
Last update
Documentation Loading commit data...
contrib Loading commit data...
coredump 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...