* [PATCH] selinux: drop unnecessary smp_load_acquire() call
@ 2020-04-08 9:08 Ondrej Mosnacek
2020-04-15 23:00 ` Paul Moore
0 siblings, 1 reply; 2+ messages in thread
From: Ondrej Mosnacek @ 2020-04-08 9:08 UTC (permalink / raw)
To: selinux, Paul Moore; +Cc: Stephen Smalley, Jeff Vander Stoep
In commit 66f8e2f03c02 ("selinux: sidtab reverse lookup hash table") the
corresponding load is moved under the spin lock, so there is no race
possible and we can read the count directly. The smp_store_release() is
still needed to avoid racing with the lock-free readers.
Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
---
security/selinux/ss/sidtab.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/security/selinux/ss/sidtab.c b/security/selinux/ss/sidtab.c
index a308ce1e6a13..f90397284a57 100644
--- a/security/selinux/ss/sidtab.c
+++ b/security/selinux/ss/sidtab.c
@@ -276,8 +276,7 @@ int sidtab_context_to_sid(struct sidtab *s, struct context *context,
if (*sid)
goto out_unlock;
- /* read entries only after reading count */
- count = smp_load_acquire(&s->count);
+ count = s->count;
convert = s->convert;
/* bail out if we already reached max entries */
--
2.25.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] selinux: drop unnecessary smp_load_acquire() call
2020-04-08 9:08 [PATCH] selinux: drop unnecessary smp_load_acquire() call Ondrej Mosnacek
@ 2020-04-15 23:00 ` Paul Moore
0 siblings, 0 replies; 2+ messages in thread
From: Paul Moore @ 2020-04-15 23:00 UTC (permalink / raw)
To: Ondrej Mosnacek; +Cc: selinux, Stephen Smalley, Jeff Vander Stoep
On Wed, Apr 8, 2020 at 5:08 AM Ondrej Mosnacek <omosnace@redhat.com> wrote:
>
> In commit 66f8e2f03c02 ("selinux: sidtab reverse lookup hash table") the
> corresponding load is moved under the spin lock, so there is no race
> possible and we can read the count directly. The smp_store_release() is
> still needed to avoid racing with the lock-free readers.
>
> Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
> ---
> security/selinux/ss/sidtab.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
Merged into selinux/next, thanks.
--
paul moore
www.paul-moore.com
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-04-15 23:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-08 9:08 [PATCH] selinux: drop unnecessary smp_load_acquire() call Ondrej Mosnacek
2020-04-15 23:00 ` Paul Moore
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).