On Fri, Feb 25, 2022 at 8:36 AM Coiby Xu <coxu@redhat.com> wrote:
Hi Lichen,

Thanks for the patch!

On Thu, Feb 24, 2022 at 05:23:41PM +0800, Lichen Liu wrote:
>kdumpctl will restore files default SELinux security contexts via restorecon
>command, but the files in /tmp don't have a default label, restorecon will
>complain like below:
>"Warning no default label for /tmp/mkfadumprd.XXXXXX/fadump.img"

I don't know much about restorecon. Does it mean restorecon doesn't do
anything for /tmp/mkfadumprd.XXXXXX/fadump.img? If the answer is yes,
I think it's better to not call restorecon or or even not call
selinux_relabel at all for the files in /tmp.
Yes, restorecon doesn't do anything if the file doesn't have a default label.
I found that dracut will run restorecon too, I'll check it before preparing another
patch.
 

>
>Redirect the stdout to /dev/null for ignoring the harmless warning.
>
>Signed-off-by: Lichen Liu <lichliu@redhat.com>
>---
> kdumpctl | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/kdumpctl b/kdumpctl
>index 9fd76ac..3928bda 100755
>--- a/kdumpctl
>+++ b/kdumpctl
>@@ -906,7 +906,7 @@ selinux_relabel()
>       while IFS= read -r -d '' _i; do
>               _attr=$(getfattr -m "security.selinux" "$_i" 2> /dev/null)
>               if [[ -z $_attr ]]; then
>-                      restorecon "$_i"
>+                      restorecon "$_i" > /dev/null
>               fi
>       done < <(find "$_path" -print0)
> }
>--
>2.27.0
>_______________________________________________
>kexec mailing list -- kexec@lists.fedoraproject.org
>To unsubscribe send an email to kexec-leave@lists.fedoraproject.org
>Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
>List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
>List Archives: https://lists.fedoraproject.org/archives/list/kexec@lists.fedoraproject.org
>Do not reply to spam on the list, report it: https://pagure.io/fedora-infrastructure

--
Best regards,
Coiby