On Thu, Jan 27, 2022 at 7:22 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 caused by > "__rcu" mismatches. > > % make W=1 C=1 security/selinux/ > > Signed-off-by: Paul Moore <paul@xxxxxxxxxxxxxx> > --- > security/selinux/hooks.c | 6 +++--- > security/selinux/ibpkey.c | 2 +- > security/selinux/netnode.c | 5 +++-- > security/selinux/netport.c | 2 +- > 4 files changed, 8 insertions(+), 7 deletions(-) > > diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c > index 221e642025f5..0e857f86f5a7 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(¤t->sighand->siglock); > + spin_lock_irq(unrcu_pointer(¤t->sighand->siglock)); > if (!fatal_signal_pending(current)) { > flush_sigqueue(¤t->pending); > flush_sigqueue(¤t->signal->shared_pending); > @@ -2542,13 +2542,13 @@ static void selinux_bprm_committed_creds(struct linux_binprm *bprm) > sigemptyset(¤t->blocked); > recalc_sigpending(); > } > - spin_unlock_irq(¤t->sighand->siglock); > + spin_unlock_irq(unrcu_pointer(¤t->sighand->siglock)); Shouldn't this be: spin_[un]lock_irq(&unrcu_pointer(current->sighand)->siglock); -- Ondrej Mosnacek Software Engineer, Linux Security - SELinux kernel Red Hat, Inc.