-
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:
Stanislav Kinsburskiy <skinsbursky@virtuozzo.com> Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com>
57a691f6