Re: [PATCH v3 1/5] libselinux: avc: use pthread mutexes by default when no lock callbacks set
Stephen Smalley <[email protected]>
| Newsgroups | org.kernel.vger.selinux |
|---|---|
| Message-ID | <CAEjxPJ4sG=8sp2HSKeSw4MzJHX7ULfLS8WE8hkdJK0xyCaZNRg@mail.gmail.com> |
On Wed, Jul 15, 2026 at 2:59 PM James Carter <[email protected]> wrote: > > On Mon, Jul 6, 2026 at 10:32 AM Stephen Smalley > <[email protected]> wrote: > > > > The AVC has a set of locking calls but defaults to no locking, and > > only the deprecated avc_init() allowed applications to set their own > > locking callbacks. Since selinux_check_access() is now commonly used > > by applications implementing userspace SELinux permission checks and > > it uses avc_open() internally, such calls are currently not > > thread-safe. Provide fallbacks to using pthread mutexes by > > default. Single-threaded programs that do not link -lpthread will be > > unaffected due to the existing __pthread_mutex() helpers. Applications > > that explicitly specify locking callbacks via the deprecated > > avc_init() will also be unaffected. > > > > This is the first step toward a thread-safe selinux_check_access(); > > the class-string cache and status-page transition handling are > > addressed in follow-up changes. > > > > Fixes: #287 #335 #336 > > Link: https://lore.kernel.org/selinux/CAJsHiNx1E7x1jaBkS0i4L1nBWXp8YXLHRWcCaDaH4LOn=zm+Zw@mail.gmail.com/ > > Link: https://lore.kernel.org/selinux/[email protected]/ > > Reported-by: Seth Moore <[email protected]> > > Reported-by: Purushottam Choudhary <[email protected]> > > > > Signed-off-by: Stephen Smalley <[email protected]> > > For these five patches: > Acked-by: James Carter <[email protected]> All five merged.