Re: [PATCH] rpc: ensure thread safe initialization of SASL library

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

 



On 7/8/19 12:39 PM, Daniel P. Berrangé wrote:
Neither the sasl_client_init or sasl_server_init methods are even
remotely threadsafe. They do a bunch of one-time initialization and
merely use a simple integer counter to avoid repeated work, not even
using atomic increment/reads on the counter. This can easily race in a
threaded program. Protect the calls using a virOnce initializer function
which is guaranteed threadsafe at least from libvirt's POV.

If the application using libvirt also uses another library that makes
use of SASL then the race still exists. It is impossible to fix that
fully except in SASL code itself.

Signed-off-by: Daniel P. Berrangé <berrange@xxxxxxxxxx>
---
  src/rpc/virnetsaslcontext.c | 50 ++++++++++++++++++++++++-------------
  1 file changed, 33 insertions(+), 17 deletions(-)

Reviewed-by: Michal Privoznik <mprivozn@xxxxxxxxxx>

Thanks Sahid for the report!

Michal

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux