From 134a7686eda2f7e49c5235fcf12f814236fd564f Mon Sep 17 00:00:00 2001 From: Tao Liu Date: May 14 2021 06:27:03 +0000 Subject: Fix incorrect file permissions of vmcore-dmesg-incomplete.txt Resolves: bz1955453 Upstream: fedora Conflict: none commit ca05b754af74ab81525ff372f589ccfbc3ac81d9 Author: Tao Liu Date: Mon May 10 22:10:26 2021 +0800 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 Signed-off-by: Tao Liu --- diff --git a/kdump-lib-initramfs.sh b/kdump-lib-initramfs.sh index 5cb0223..341aa00 100755 --- a/kdump-lib-initramfs.sh +++ b/kdump-lib-initramfs.sh @@ -187,6 +187,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 }