Commit b3cfe735 authored by Kinsbursky Stanislav's avatar Kinsbursky Stanislav Committed by Cyrill Gorcunov

dump: support SYSV IPC vma

This patch introduces the following changes:

1) introduces new flag VMA_AREA_SYSVIPC to mark corresponding vma entries.
2) enhance task /proc/<pid>/maps parsing to obtain first 5 letters of mapped
   file. If device major file belong to ins equal to 0 (tmpfs) and it's name
   starts with "/SYSV", then this mapping is considered as SYSV IPC and
   corresponding vma entry status is updated with VMA_AREA_SYSVIPC flag.
3) omit dumping of mapping pages for SYSV IPC vmas.
Signed-off-by: 's avatarStanislav Kinsbursky <skinsbursky@openvz.org>
Acked-by: 's avatarPavel Emelyanov <xemul@parallels.com>
Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
parent 40fc4d21
......@@ -169,6 +169,8 @@ struct ipc_msg_entry {
#define VMA_ANON_SHARED (1 << 8)
#define VMA_ANON_PRIVATE (1 << 9)
#define VMA_AREA_SYSVIPC (1 << 10)
#define vma_entry_is(vma, s) (((vma)->status & (s)) == (s))
#define vma_entry_len(vma) ((vma)->end - (vma)->start)
#define final_vma_entry(vma) ((vma)->start == 0 && (vma)->end == 0)
......
......@@ -448,6 +448,10 @@ int parasite_dump_pages_seized(struct parasite_ctl *ctl, struct list_head *vma_a
if (vma_area->vma.status & VMA_FILE_SHARED)
continue;
/* No dumps for SYSV IPC mappings */
if (vma_area->vma.status & VMA_AREA_SYSVIPC)
continue;
pr_info_vma(vma_area);
parasite_dumppages.vma_entry = vma_area->vma;
......
......@@ -45,11 +45,14 @@ int parse_maps(pid_t pid, int pid_dir, struct list_head *vma_area_list, bool use
while (fgets(big_buffer, sizeof(big_buffer), maps)) {
struct stat st_buf;
int num;
char file_path[6];
num = sscanf(big_buffer, "%lx-%lx %c%c%c%c %lx %02x:%02x %lu",
memset(file_path, 0, 6);
num = sscanf(big_buffer, "%lx-%lx %c%c%c%c %lx %02x:%02x %lu %5s",
&start, &end, &r, &w, &x, &s, &pgoff, &dev_maj,
&dev_min, &ino);
if (num != 10) {
&dev_min, &ino, file_path);
if (num < 10) {
pr_err("Can't parse: %s", big_buffer);
goto err;
}
......@@ -133,6 +136,11 @@ int parse_maps(pid_t pid, int pid_dir, struct list_head *vma_area_list, bool use
vma_area->vma.flags |= MAP_ANONYMOUS;
vma_area->vma.status |= VMA_ANON_SHARED;
vma_area->shmid = st_buf.st_ino;
if (!strcmp(file_path, "/SYSV")) {
pr_perror("path: %s\n", file_path);
vma_area->vma.status |= VMA_AREA_SYSVIPC;
}
} else {
if (vma_area->vma.flags & MAP_PRIVATE)
vma_area->vma.status |= VMA_FILE_PRIVATE;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment