laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-remsim/+/42664?usp=email )
Change subject: Fix: Prevent race conditions when accessing slotmap in bankd
......................................................................
Fix: Prevent race conditions when accessing slotmap in bankd
If a client connects to a worker, the worker will check if there is an
existing mapping between a reader and this client. If it exists,
slotmap_by_client() will return a pointer. If the mapping is deleted at
this time by the server, the worker uses a pointer to a mapping entry
that has just been freed.
To prevent this, the worker locks the slot map and calls the new
function slotmap_by_client_nolock(). After it has finished working with
the returned pointer, it unlocks the slot map again. A possible delete
by the main thread would be delayed.
Change-Id: I3464726f37beb7c47b4e1f00c018ffa4f3948906
---
M src/bankd/bankd_main.c
M src/slotmap.c
M src/slotmap.h
3 files changed, 21 insertions(+), 9 deletions(-)
Approvals:
Jenkins Builder: Verified
lynxis lazus: Looks good to me, approved
diff --git a/src/bankd/bankd_main.c b/src/bankd/bankd_main.c
index 479adf0..fc8f480 100644
--- a/src/bankd/bankd_main.c
+++ b/src/bankd/bankd_main.c
@@ -700,8 +700,10 @@
{
struct slot_mapping *slmap;
- slmap = slotmap_by_client(worker->bankd->slotmaps, &worker->client.clslot);
+ slotmaps_rdlock(worker->bankd->slotmaps);
+ slmap = slotmap_by_client_nolock(worker->bankd->slotmaps, &worker->client.clslot);
if (!slmap) {
+ slotmaps_unlock(worker->bankd->slotmaps);
LOGW(worker, "No slotmap (yet) for client C(%u:%u)\n",
worker->client.clslot.client_id, worker->client.clslot.slot_nr);
/* check in 10s if the map has been installed meanwhile by main thread */
@@ -712,6 +714,7 @@
slmap->client.client_id, slmap->client.slot_nr,
slmap->bank.bank_id, slmap->bank.slot_nr);
worker->slot = slmap->bank;
+ slotmaps_unlock(worker->bankd->slotmaps);
worker_set_state_timeout(worker, BW_ST_CONN_CLIENT_MAPPED, 10);
return worker_open_card(worker);
}
diff --git a/src/slotmap.c b/src/slotmap.c
index b1be0ab..1883cf5 100644
--- a/src/slotmap.c
+++ b/src/slotmap.c
@@ -53,20 +53,27 @@
return (map->bank.bank_id << 16) | map->bank.slot_nr;
}
+/* lookup of map by client:slot */
+struct slot_mapping *slotmap_by_client_nolock(struct slotmaps *maps, const struct client_slot *client)
+{
+ struct slot_mapping *map;
+
+ llist_for_each_entry(map, &maps->mappings, list) {
+ if (client_slot_equals(&map->client, client))
+ return map;
+ }
+ return NULL;
+}
+
/* thread-safe lookup of map by client:slot */
struct slot_mapping *slotmap_by_client(struct slotmaps *maps, const struct client_slot *client)
{
struct slot_mapping *map;
slotmaps_rdlock(maps);
- llist_for_each_entry(map, &maps->mappings, list) {
- if (client_slot_equals(&map->client, client)) {
- slotmaps_unlock(maps);
- return map;
- }
- }
+ map = slotmap_by_client_nolock(maps, client);
slotmaps_unlock(maps);
- return NULL;
+ return map;
}
/* thread-safe lookup of map by bank:slot */
@@ -83,7 +90,6 @@
}
slotmaps_unlock(maps);
return NULL;
-
}
/* thread-safe creating of a new bank<->client map */
diff --git a/src/slotmap.h b/src/slotmap.h
index 3d07c8d..a14e1cf 100644
--- a/src/slotmap.h
+++ b/src/slotmap.h
@@ -70,6 +70,9 @@
uint32_t slotmap_get_id(const struct slot_mapping *map);
+/* lookup of map by client:slot */
+struct slot_mapping *slotmap_by_client_nolock(struct slotmaps *maps, const struct client_slot *client);
+
/* thread-safe lookup of map by client:slot */
struct slot_mapping *slotmap_by_client(struct slotmaps *maps, const struct client_slot *client);
--
To view, visit https://gerrit.osmocom.org/c/osmo-remsim/+/42664?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: osmo-remsim
Gerrit-Branch: master
Gerrit-Change-Id: I3464726f37beb7c47b4e1f00c018ffa4f3948906
Gerrit-Change-Number: 42664
Gerrit-PatchSet: 4
Gerrit-Owner: jolly <andreas(a)eversberg.eu>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: lynxis lazus <lynxis(a)fe80.eu>
laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-remsim/+/42645?usp=email )
Change subject: Fix: Remove slot mapping at bankd when client disconnects
......................................................................
Fix: Remove slot mapping at bankd when client disconnects
If a client disconnects before removing the slot mapping, the worker
must undefine its 'bank_id' and 'slot_nr' and must change its state to
'UNMAPPED'.
send_signal_to_worker() searches for a worker that has a given bank and
slot. If a client re-connects to a different worker and if the bank and
slot would be still assigned to the old worker, the old worker could
receive signals when assigning or removing slot mapping. The new worker
would not be mapped.
Change-Id: I2fd03490e2506c55104309a0ef952389119023b8
---
M src/bankd/bankd_main.c
1 file changed, 9 insertions(+), 0 deletions(-)
Approvals:
Jenkins Builder: Verified
lynxis lazus: Looks good to me, approved
diff --git a/src/bankd/bankd_main.c b/src/bankd/bankd_main.c
index 5e33b41..479adf0 100644
--- a/src/bankd/bankd_main.c
+++ b/src/bankd/bankd_main.c
@@ -1102,6 +1102,15 @@
close(g_worker->client.fd);
memset(&g_worker->client.peer_addr, 0, sizeof(g_worker->client.peer_addr));
g_worker->client.fd = -1;
+ if (g_worker->state >= BW_ST_CONN_CLIENT_MAPPED) {
+ struct slot_mapping *slmap;
+ slmap = slotmap_by_client(g_worker->bankd->slotmaps, &g_worker->client.clslot);
+ if (slmap) {
+ g_worker->slot.bank_id = 0xffff;
+ g_worker->slot.slot_nr = 0xffff;
+ worker_set_state(g_worker, BW_ST_CONN_CLIENT_UNMAPPED, true);
+ }
+ }
g_worker->client.clslot.client_id = g_worker->client.clslot.slot_nr = 0;
}
--
To view, visit https://gerrit.osmocom.org/c/osmo-remsim/+/42645?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: osmo-remsim
Gerrit-Branch: master
Gerrit-Change-Id: I2fd03490e2506c55104309a0ef952389119023b8
Gerrit-Change-Number: 42645
Gerrit-PatchSet: 2
Gerrit-Owner: jolly <andreas(a)eversberg.eu>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: lynxis lazus <lynxis(a)fe80.eu>
Attention is currently required from: Timur Davydov.
laforge has posted comments on this change by Timur Davydov. ( https://gerrit.osmocom.org/c/osmo-bts/+/42690?usp=email )
Change subject: build: make sched_* usage optional
......................................................................
Patch Set 3: Code-Review+1
--
To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/42690?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: I5af357c1e2074fa1e05ac6bc20af8535c474d906
Gerrit-Change-Number: 42690
Gerrit-PatchSet: 3
Gerrit-Owner: Timur Davydov <dtv.comp(a)gmail.com>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Attention: Timur Davydov <dtv.comp(a)gmail.com>
Gerrit-Comment-Date: Mon, 27 Apr 2026 23:19:31 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Attention is currently required from: Timur Davydov, fixeria.
laforge has posted comments on this change by Timur Davydov. ( https://gerrit.osmocom.org/c/osmo-bts/+/42689?usp=email )
Change subject: build: make timerfd usage optional
......................................................................
Patch Set 3: Code-Review+1
--
To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/42689?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: Id5a700c865f984e8f99199a1e365bb7f1462030a
Gerrit-Change-Number: 42689
Gerrit-PatchSet: 3
Gerrit-Owner: Timur Davydov <dtv.comp(a)gmail.com>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-CC: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Attention: Timur Davydov <dtv.comp(a)gmail.com>
Gerrit-Comment-Date: Mon, 27 Apr 2026 23:19:15 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Attention is currently required from: Timur Davydov.
laforge has posted comments on this change by Timur Davydov. ( https://gerrit.osmocom.org/c/osmo-bts/+/42688?usp=email )
Change subject: build: make linux/if_packet.h usage optional
......................................................................
Patch Set 2: Code-Review+1
--
To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/42688?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: I8a02b0676e65fa4b6191073c84e0646a2e67a010
Gerrit-Change-Number: 42688
Gerrit-PatchSet: 2
Gerrit-Owner: Timur Davydov <dtv.comp(a)gmail.com>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Attention: Timur Davydov <dtv.comp(a)gmail.com>
Gerrit-Comment-Date: Mon, 27 Apr 2026 23:18:46 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Attention is currently required from: Timur Davydov, pespin.
laforge has posted comments on this change by Timur Davydov. ( https://gerrit.osmocom.org/c/libosmocore/+/42653?usp=email )
Change subject: vty: make CPU scheduling optional based on platform support
......................................................................
Patch Set 2: Code-Review+1
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/42653?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Ic5b7e39fac16531d370cb81f769ba87fef18cb81
Gerrit-Change-Number: 42653
Gerrit-PatchSet: 2
Gerrit-Owner: Timur Davydov <dtv.comp(a)gmail.com>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: Timur Davydov <dtv.comp(a)gmail.com>
Gerrit-Comment-Date: Mon, 27 Apr 2026 23:18:02 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Attention is currently required from: Timur Davydov.
laforge has posted comments on this change by Timur Davydov. ( https://gerrit.osmocom.org/c/libosmocore/+/42709?usp=email )
Change subject: vty: fix osmo_cpu_sched_vty_init() prototype
......................................................................
Patch Set 1: Code-Review+1
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/42709?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Ia86e8063178ad82de098c2ff693cfbcd7e9f2192
Gerrit-Change-Number: 42709
Gerrit-PatchSet: 1
Gerrit-Owner: Timur Davydov <dtv.comp(a)gmail.com>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Attention: Timur Davydov <dtv.comp(a)gmail.com>
Gerrit-Comment-Date: Mon, 27 Apr 2026 23:17:30 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Attention is currently required from: Timur Davydov, laforge, pespin, tnt.
Hoernchen has posted comments on this change by Timur Davydov. ( https://gerrit.osmocom.org/c/osmo-trx/+/42248?usp=email )
Change subject: transceiver: add optional Laurent burst LUT modulation (int16)
......................................................................
Patch Set 15:
(1 comment)
File Transceiver52M/sigProcLib.cpp:
https://gerrit.osmocom.org/c/osmo-trx/+/42248/comment/cfdda5cc_033c778e?usp… :
PS15, Line 776: return (burst_lut_prepared) ? modulateBurstLaurentLutInt(bits) : modulateBurstLaurent(bits);
The feature is either enabled using the ifdef and there is a lut or it's not enabled and there is no lut. No weird fallbacks or lut checks.
--
To view, visit https://gerrit.osmocom.org/c/osmo-trx/+/42248?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Change-Id: I1715c2d33dc55fe1c7be5c6e7259d378ea5e80b2
Gerrit-Change-Number: 42248
Gerrit-PatchSet: 15
Gerrit-Owner: Timur Davydov <dtv.comp(a)gmail.com>
Gerrit-Reviewer: Hoernchen <ewild(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: tnt <tnt(a)246tNt.com>
Gerrit-CC: laforge <laforge(a)osmocom.org>
Gerrit-CC: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Gerrit-Attention: tnt <tnt(a)246tNt.com>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: Timur Davydov <dtv.comp(a)gmail.com>
Gerrit-Comment-Date: Mon, 27 Apr 2026 22:49:08 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No