Re: Watchdog bark! bark due to excessive logging from SELinux in Linux-modules;

From: Paul Moore
Date: Mon Aug 21 2023 - 12:44:03 EST


On Mon, Aug 21, 2023 at 7:14 AM Aaditya raj <rajaditya073@xxxxxxxxx> wrote:
>
> Hi Team ,
>
> There is an Watchdog bark issue seen due to excessive logging from SELinux , I have attached a patch to restrict excessive logging , please review the patch and please let me know if there is any issue.
>
> I have modified the file “security/selinux/hooks.c” on line number 1353 , replaced pr_warn with pr_warn_ratelimited.
>
> ---
> security/selinux/hooks.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)

Can you provide more information about what kernel you are using and
the filesystem(s) you have mounted which are causing this error,
including how they are mounted? I wouldn't expect a normal system to
flood the logs with many of these warnings, so I'm wondering if
something else is wrong ...

> diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
> index d06e350fedee..83f3e5a0ccc6 100644
> --- a/security/selinux/hooks.c
> +++ b/security/selinux/hooks.c
> @@ -1350,7 +1350,7 @@ static int inode_doinit_use_xattr(struct inode *inode, struct dentry *dentry,
> if (rc < 0) {
> kfree(context);
> if (rc != -ENODATA) {
> - pr_warn("SELinux: %s: getxattr returned %d for dev=%s ino=%ld\n",
> + pr_warn_ratelimited("SELinux: %s: getxattr returned %d for dev=%s ino=%ld\n",
> __func__, -rc, inode->i_sb->s_id, inode->i_ino);
> return rc;
> }

--
paul-moore.com