Commit ce4c8c1d authored by Andrey Vagin's avatar Andrey Vagin Committed by Pavel Emelyanov

crtools: don't prevent to dump memory mappings on /dev/zero (v2)

Oracle has such mappings.

v2: add check, that a file is a character device
Signed-off-by: 's avatarAndrey Vagin <avagin@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 4a706463
...@@ -263,6 +263,8 @@ int do_open_proc(pid_t pid, int flags, const char *fmt, ...); ...@@ -263,6 +263,8 @@ int do_open_proc(pid_t pid, int flags, const char *fmt, ...);
#define pr_img_head(type, ...) pr_msg("\n"#type __VA_ARGS__ "\n----------------\n") #define pr_img_head(type, ...) pr_msg("\n"#type __VA_ARGS__ "\n----------------\n")
#define pr_img_tail(type) pr_msg("----------------\n") #define pr_img_tail(type) pr_msg("----------------\n")
#define DEVZERO (makedev(1, 5))
#define KDEV_MINORBITS 20 #define KDEV_MINORBITS 20
#define KDEV_MINORMASK ((1UL << KDEV_MINORBITS) - 1) #define KDEV_MINORMASK ((1UL << KDEV_MINORBITS) - 1)
#define MKKDEV(ma, mi) (((ma) << KDEV_MINORBITS) | (mi)) #define MKKDEV(ma, mi) (((ma) << KDEV_MINORBITS) | (mi))
......
...@@ -303,7 +303,9 @@ int parse_smaps(pid_t pid, struct list_head *vma_area_list, bool use_map_files) ...@@ -303,7 +303,9 @@ int parse_smaps(pid_t pid, struct list_head *vma_area_list, bool use_map_files)
pr_perror("Failed fstat on %d's map %lu", pid, start); pr_perror("Failed fstat on %d's map %lu", pid, start);
goto err; goto err;
} }
if (!S_ISREG(st_buf.st_mode)) {
if (!S_ISREG(st_buf.st_mode) &&
!(S_ISCHR(st_buf.st_mode) && st_buf.st_rdev == DEVZERO)) {
pr_err("Can't handle non-regular mapping on %d's map %lu\n", pid, start); pr_err("Can't handle non-regular mapping on %d's map %lu\n", pid, start);
goto err; goto err;
} }
......
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