From ca05b754af74ab81525ff372f589ccfbc3ac81d9 Mon Sep 17 00:00:00 2001 From: Tao Liu Date: Mon, 10 May 2021 22:10:26 +0800 Subject: [PATCH] Fix incorrect file permissions of vmcore-dmesg-incomplete.txt vmcore-dmesg-incomplete.txt is generated by shell redirection, which taking the default umask value. When dmesg collector exits with non-zero, the file will exist and anyone can have access to it. This patch fixed the issue by chmod the file, making it accessible only to its owner. Signed-off-by: Tao Liu Acked-by: Kairui Song --- kdump-lib-initramfs.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/kdump-lib-initramfs.sh b/kdump-lib-initramfs.sh index 15bbd85..d0d124f 100755 --- a/kdump-lib-initramfs.sh +++ b/kdump-lib-initramfs.sh @@ -188,6 +188,9 @@ save_vmcore_dmesg_fs() { sync dinfo "saving vmcore-dmesg.txt complete" else + if [ -f ${_path}/vmcore-dmesg-incomplete.txt ]; then + chmod 600 ${_path}/vmcore-dmesg-incomplete.txt + fi derror "saving vmcore-dmesg.txt failed" fi }