Date: Wednesday, May 11, 2022 @ 12:05:40 Author: heftig Revision: 444996
archrelease: copy trunk to testing-x86_64 Added: dbus-broker/repos/testing-x86_64/0001-util-user-keep-reference-to-user-in-each-usage-table.patch (from rev 444995, dbus-broker/trunk/0001-util-user-keep-reference-to-user-in-each-usage-table.patch) dbus-broker/repos/testing-x86_64/PKGBUILD (from rev 444995, dbus-broker/trunk/PKGBUILD) Deleted: dbus-broker/repos/testing-x86_64/PKGBUILD -----------------------------------------------------------------+ 0001-util-user-keep-reference-to-user-in-each-usage-table.patch | 72 ++++++++ PKGBUILD | 81 +++++----- 2 files changed, 115 insertions(+), 38 deletions(-) Copied: dbus-broker/repos/testing-x86_64/0001-util-user-keep-reference-to-user-in-each-usage-table.patch (from rev 444995, dbus-broker/trunk/0001-util-user-keep-reference-to-user-in-each-usage-table.patch) =================================================================== --- 0001-util-user-keep-reference-to-user-in-each-usage-table.patch (rev 0) +++ 0001-util-user-keep-reference-to-user-in-each-usage-table.patch 2022-05-11 12:05:40 UTC (rev 444996) @@ -0,0 +1,72 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: David Rheinsberg <david.rheinsb...@gmail.com> +Date: Wed, 11 May 2022 08:41:48 +0200 +Subject: [PATCH] util/user: keep reference to user in each usage table + +Keep a reference to an owning user in each usage table. We want to allow +callers to hold charges without holding on to any user references. + +Also fix the peer-deinitialization to be ordered correctly and free the +user references last (in particular, after the charges). This is not +strictly necessary, but now follows our coding style and would have +avoided possible failures. + +This fixes an assertion failure when disconnecting entire groups of +peers of the same user, due to the recent fix that actually made +peer-accounting do something. + +Reported-by: Torge Matthies +Reported-by: Mel34 +Signed-off-by: David Rheinsberg <david.rheinsb...@gmail.com> +--- + src/bus/peer.c | 2 +- + src/util/user.c | 3 ++- + 2 files changed, 3 insertions(+), 2 deletions(-) + +diff --git a/src/bus/peer.c b/src/bus/peer.c +index 18bd1947ebc7..69ed0fde6933 100644 +--- a/src/bus/peer.c ++++ b/src/bus/peer.c +@@ -358,12 +358,12 @@ Peer *peer_free(Peer *peer) { + name_owner_deinit(&peer->owned_names); + policy_snapshot_free(peer->policy); + connection_deinit(&peer->connection); +- user_unref(peer->user); + user_charge_deinit(&peer->charges[2]); + user_charge_deinit(&peer->charges[1]); + user_charge_deinit(&peer->charges[0]); + free(peer->seclabel); + free(peer->gids); ++ user_unref(peer->user); + free(peer); + + close(fd); +diff --git a/src/util/user.c b/src/util/user.c +index 7856b768e91e..d0edb5e83210 100644 +--- a/src/util/user.c ++++ b/src/util/user.c +@@ -48,22 +48,23 @@ static int user_usage_new(UserUsage **usagep, User *user, uid_t uid) { + return error_origin(-ENOMEM); + + usage->n_refs = REF_INIT; +- usage->user = user; ++ usage->user = user_ref(user); + usage->uid = uid; + usage->user_node = (CRBNode)C_RBNODE_INIT(usage->user_node); + + *usagep = usage; + return 0; + } + + static void user_usage_free(_Atomic unsigned long *n_refs, void *userdata) { + UserUsage *usage = c_container_of(n_refs, UserUsage, n_refs); + size_t i; + + for (i = 0; i < usage->user->registry->n_slots; ++i) + c_assert(!usage->slots[i]); + + user_usage_unlink(usage); ++ user_unref(usage->user); + free(usage); + } + Deleted: PKGBUILD =================================================================== --- PKGBUILD 2022-05-11 12:05:26 UTC (rev 444995) +++ PKGBUILD 2022-05-11 12:05:40 UTC (rev 444996) @@ -1,38 +0,0 @@ -# Maintainer: Jan Alexander Steffens (heftig) <hef...@archlinux.org> -# Contributor: David Herrmann <dh.herrm...@gmail.com> - -pkgname=dbus-broker -pkgver=30 -pkgrel=1 -pkgdesc="Linux D-Bus Message Broker" -url="https://github.com/bus1/dbus-broker/wiki" -arch=(x86_64) -license=(Apache) -depends=(systemd-libs expat audit) -makedepends=(meson systemd python-docutils) -options=(debug) -source=(https://github.com/bus1/dbus-broker/releases/download/v$pkgver/$pkgname-$pkgver.tar.xz) -sha256sums=('bf22ba6a13680ba93b99f0bccb54dde9f4f6bdff5f298dbc8cdb067a80f3827a') - -prepare() { - cd $pkgname-$pkgver -} - -build() { - arch-meson $pkgname-$pkgver build \ - -D audit=true \ - -D docs=true \ - -D linux-4-17=true \ - -D system-console-users=gdm,sddm,lightdm,lxdm - meson compile -C build -} - -check() { - meson test -C build --print-errorlogs -} - -package() { - meson install -C build --destdir "$pkgdir" -} - -# vim:set sw=2 et: Copied: dbus-broker/repos/testing-x86_64/PKGBUILD (from rev 444995, dbus-broker/trunk/PKGBUILD) =================================================================== --- PKGBUILD (rev 0) +++ PKGBUILD 2022-05-11 12:05:40 UTC (rev 444996) @@ -0,0 +1,43 @@ +# Maintainer: Jan Alexander Steffens (heftig) <hef...@archlinux.org> +# Contributor: David Herrmann <dh.herrm...@gmail.com> + +pkgname=dbus-broker +pkgver=30 +pkgrel=2 +pkgdesc="Linux D-Bus Message Broker" +url="https://github.com/bus1/dbus-broker/wiki" +arch=(x86_64) +license=(Apache) +depends=(systemd-libs expat audit) +makedepends=(meson systemd python-docutils) +options=(debug) +source=(https://github.com/bus1/dbus-broker/releases/download/v$pkgver/$pkgname-$pkgver.tar.xz + 0001-util-user-keep-reference-to-user-in-each-usage-table.patch) +sha256sums=('bf22ba6a13680ba93b99f0bccb54dde9f4f6bdff5f298dbc8cdb067a80f3827a' + 'e7107b54a0051e3945cfde3a8cfc617abcef63b38dd0c5783ba805fedab9e2d1') + +prepare() { + cd $pkgname-$pkgver + + # Fix asserts in system bus + patch -Np1 -i ../0001-util-user-keep-reference-to-user-in-each-usage-table.patch +} + +build() { + arch-meson $pkgname-$pkgver build \ + -D audit=true \ + -D docs=true \ + -D linux-4-17=true \ + -D system-console-users=gdm,sddm,lightdm,lxdm + meson compile -C build +} + +check() { + meson test -C build --print-errorlogs +} + +package() { + meson install -C build --destdir "$pkgdir" +} + +# vim:set sw=2 et: