Re: [PATCH] selinux: various sparse fixes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Jan 27, 2022 at 12:01 PM Paul Moore <paul@xxxxxxxxxxxxxx> wrote:
>
> When running the SELinux code through sparse, there are a handful of
> warnings.  This patch resolves some of these warnings by casting away
> the "__rcu" attribute in a few core kernel function calls.
>
>  % make W=1 C=1 security/selinux/
>
> Signed-off-by: Paul Moore <paul@xxxxxxxxxxxxxx>
> ---
>  security/selinux/hooks.c |    7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)

Self NACK as this is likely also a good candidate for the unrcu macro
treatment that Ondrej suggested.

> diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
> index c057896e7dcd..da04f3435268 100644
> --- a/security/selinux/hooks.c
> +++ b/security/selinux/hooks.c
> @@ -2534,7 +2534,7 @@ static void selinux_bprm_committed_creds(struct linux_binprm *bprm)
>         if (rc) {
>                 clear_itimer();
>
> -               spin_lock_irq(&current->sighand->siglock);
> +               spin_lock_irq((__force spinlock_t *)&current->sighand->siglock);
>                 if (!fatal_signal_pending(current)) {
>                         flush_sigqueue(&current->pending);
>                         flush_sigqueue(&current->signal->shared_pending);
> @@ -2542,13 +2542,14 @@ static void selinux_bprm_committed_creds(struct linux_binprm *bprm)
>                         sigemptyset(&current->blocked);
>                         recalc_sigpending();
>                 }
> -               spin_unlock_irq(&current->sighand->siglock);
> +               spin_unlock_irq((__force spinlock_t *)&current->sighand->siglock);
>         }
>
>         /* Wake up the parent if it is waiting so that it can recheck
>          * wait permission to the new task SID. */
>         read_lock(&tasklist_lock);
> -       __wake_up_parent(current, current->real_parent);
> +       __wake_up_parent(current,
> +                        (__force struct task_struct *)current->real_parent);
>         read_unlock(&tasklist_lock);
>  }

-- 
paul-moore.com



[Index of Archives]     [Selinux Refpolicy]     [Linux SGX]     [Fedora Users]     [Fedora Desktop]     [Yosemite Photos]     [Yosemite Camping]     [Yosemite Campsites]     [KDE Users]     [Gnome Users]

  Powered by Linux