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 ltao@redhat.com --- 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 }
Hi Tao
On Mon, May 10, 2021 at 10:11 PM Tao Liu ltao@redhat.com wrote:
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 ltao@redhat.com
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
fifi derror "saving vmcore-dmesg.txt failed"
}
2.29.2
Looks good, Acked-by: Kairui Song kasong@redhat.com
Hi Kairui,
Thanks for reviewing the patch!
Thanks, Tao Liu
On Tue, May 11, 2021 at 08:00:00AM +0800, Kairui Song wrote:
Hi Tao
On Mon, May 10, 2021 at 10:11 PM Tao Liu ltao@redhat.com wrote:
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 ltao@redhat.com
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
fifi derror "saving vmcore-dmesg.txt failed"
}
2.29.2
Looks good, Acked-by: Kairui Song kasong@redhat.com
-- Best Regards, Kairui Song