[systemd-devel] [PATCH v2 0/7] kdbus: improve user domain accounting

Djalal Harouni tixxdz at opendz.org
Wed Jul 30 13:11:51 PDT 2014


Hi,

This is series v2 of:
http://lists.freedesktop.org/archives/systemd-devel/2014-July/021526.html

This series improves user domain accounting and fixes some bugs.

It should go on top of the "kdbus: allow multiple policies" series:
http://lists.freedesktop.org/archives/systemd-devel/2014-July/021514.html

The v2 fixes the race previously discussed but not fixed in v1 and which
was inherited from kdbus_domain_user_find_or_new().

If kdbus_domain_user_find_or_new() is called with same parameters and
if we do not find a previously linked domain user, then we release the
domain lock, and both threads will race to assign a different ID for the
same uid, thus, invalidating the users array. We fix this in this series
by using a new kdbus_domain_user_account() function which takes the same
domain lock to perform both find a previously domain user or create and
link a new one.

Summary:
Patches 1, 2 and 3 are preparation patches to improve the code.

Patch 4 fixes kdbus_domain_user_find_or_new(), callers assume that
kdbus_domain_user_find_or_new() will fail only with -ENOMEM, but it
may fail with -ESHUTDOWN, so adapt the code to return the appropriate
errors and fix all callers. This patch also fixes the discussed race in
kdbus_domain_user_find_or_new().

Patch 5 improves the bus user quota and reduces the number of domain
locks that might be taken in that path.
Currently kdbus_bus_new() execution path might take the domain lock 3 or
4 times, reduce this to max 1 or 2 times. The domain is the upper layer,
reducing the locks should reduce some overheads.

Patch 6 fixes a user quota accounting corruption.

Patch 7 kill dead code.

Thanks


More information about the systemd-devel mailing list