Fix incorrect file permissions of vmcore-dmesg-incomplete.txt

Resolves: bz1955453
Upstream: fedora
Conflict: none

commit ca05b754af
Author: Tao Liu <ltao@redhat.com>
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 <ltao@redhat.com>
    Acked-by: Kairui Song <kasong@redhat.com>

Signed-off-by: Tao Liu <ltao@redhat.com>
This commit is contained in:
Tao Liu 2021-05-14 11:26:49 +08:00
parent 2b7d3aa34d
commit 134a7686ed

View File

@ -187,6 +187,9 @@ save_vmcore_dmesg_fs() {
sync sync
dinfo "saving vmcore-dmesg.txt complete" dinfo "saving vmcore-dmesg.txt complete"
else else
if [ -f ${_path}/vmcore-dmesg-incomplete.txt ]; then
chmod 600 ${_path}/vmcore-dmesg-incomplete.txt
fi
derror "saving vmcore-dmesg.txt failed" derror "saving vmcore-dmesg.txt failed"
fi fi
} }