fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/erlang/osmo-s1gw/+/42450?usp=email )
Change subject: rest_server: fix TOC/TOU race when listing/fetching E-RABs
......................................................................
rest_server: fix TOC/TOU race when listing/fetching E-RABs
The list of E-RAB FSM pids is a snapshot taken at one point in time.
By the time we interrogate each erab_fsm process individually, any of
them may have already terminated (e.g. bearer released mid-request).
The current code fails to generate a response if this happens.
* fetch_erab_info/1: add a pid() clause that wraps erab_list_item/1
in a try/catch, returning 'error' if the process is gone.
* fetch_erab_info/1: catch both exit forms
** `{noproc, _}` raised by gen_statem:call/2 on a monitored pid, and
** the bare noproc atom for other code paths.
* fetch_erab_list/1: switch from lists:map to lists:filtermap and
call fetch_erab_info/1 per E-RAB, silently dropping any that died
between the snapshot and the per-process interrogation.
Change-Id: I160b413aa535f2379ad4e40a3ae8f37c5bce2067
Related: SYS#7066
---
M src/rest_server.erl
1 file changed, 14 insertions(+), 6 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/erlang/osmo-s1gw refs/changes/50/42450/1
diff --git a/src/rest_server.erl b/src/rest_server.erl
index bc9a4a9..cbdd6e6 100644
--- a/src/rest_server.erl
+++ b/src/rest_server.erl
@@ -523,14 +523,17 @@
error.
--spec fetch_erab_info(binary()) -> {ok, erab_fsm:erab_info()} | error.
+-spec fetch_erab_info(binary() | pid()) -> {ok, erab_fsm:erab_info()} | error.
fetch_erab_info(<< "pid:", Val/bytes >>) ->
- Pid = parse_pid(Val),
- %% guard against non-existent process IDs
- %% TODO: check if the given Pid is actually an erab_fsm
+ fetch_erab_info(parse_pid(Val));
+
+fetch_erab_info(Pid) when is_pid(Pid) ->
+ %% erab_fsm process may have already terminated
+ %% guard against that by catching noproc
try erab_list_item({pid, Pid}) of
ErabInfo -> {ok, ErabInfo}
catch
+ exit:noproc -> error;
exit:{noproc, _} -> error
end;
@@ -542,12 +545,17 @@
-spec fetch_erab_list(enb_registry:enb_info()) -> [map()].
fetch_erab_list(#{pid := EnbPid}) ->
ERABs = enb_proxy:fetch_erab_list(EnbPid),
- lists:map(fun erab_list_item/1, ERABs).
+ lists:filtermap(
+ fun({_, Pid}) ->
+ case fetch_erab_info(Pid) of
+ {ok, ErabInfo} -> {true, ErabInfo};
+ error -> false
+ end
+ end, ERABs).
-spec erab_list_item({term(), pid()}) -> map().
erab_list_item({_, Pid}) ->
- %% XXX: E-RAB FSM process might be dead here
Info = erab_fsm:fetch_info(Pid),
{MmeUeId, ErabId} = maps:get(uid, Info),
M0 = #{mme_ue_id => MmeUeId,
--
To view, visit https://gerrit.osmocom.org/c/erlang/osmo-s1gw/+/42450?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: erlang/osmo-s1gw
Gerrit-Branch: master
Gerrit-Change-Id: I160b413aa535f2379ad4e40a3ae8f37c5bce2067
Gerrit-Change-Number: 42450
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>
Attention is currently required from: dexter.
fixeria has posted comments on this change by dexter. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/42434?usp=email )
Change subject: eIM_Tests: align RSP version number in HTTP header
......................................................................
Patch Set 1: Code-Review+1
--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/42434?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I125c3b13697c71d35788e54b7d88a9f943bb7a71
Gerrit-Change-Number: 42434
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <pmaier(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Attention: dexter <pmaier(a)sysmocom.de>
Gerrit-Comment-Date: Thu, 19 Mar 2026 19:26:36 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Attention is currently required from: Hoernchen, fixeria, laforge, pespin.
Timur Davydov has posted comments on this change by Timur Davydov. ( https://gerrit.osmocom.org/c/osmo-trx/+/42411?usp=email )
Change subject: transceiver: add optional WebSDR device support
......................................................................
Patch Set 10:
(1 comment)
File Transceiver52M/Transceiver.cpp:
https://gerrit.osmocom.org/c/osmo-trx/+/42411/comment/709001f7_55929b8f?usp… :
PS10, Line 1132: msgLen = read(mDataSockets[chan], buffer, sizeof(buffer));
> You should instead properly split read/write from/to sockets into its own method.
Could you please clarify if I understood you correctly?
Do you mean that the socket read/write operations should be split into separate methods, and then overridden in the WebSDR subclass so that, instead of operating on sockets, they would operate on some intermediate buffers?
That approach should work, and architecturally it would probably look cleaner. My concern is that in the WebSDR case this would require placing the data into an intermediate buffer before calling method, as example driveTxPriorityQueue, and then reading it back here, which introduces an extra copy and may negatively affect performance.
Is that the direction you had in mind?
--
To view, visit https://gerrit.osmocom.org/c/osmo-trx/+/42411?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: Ia0d340c323c2eea28fbe82601ba0af7cfbd68f6d
Gerrit-Change-Number: 42411
Gerrit-PatchSet: 10
Gerrit-Owner: Timur Davydov <dtv.comp(a)gmail.com>
Gerrit-Reviewer: Hoernchen <ewild(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-CC: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: Hoernchen <ewild(a)sysmocom.de>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Comment-Date: Thu, 19 Mar 2026 19:19:00 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: pespin <pespin(a)sysmocom.de>