laforge has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/41950?usp=email )
Change subject: osmo_io: Fix misalignment of iofd->cmsg used as struct cmsghdr
......................................................................
osmo_io: Fix misalignment of iofd->cmsg used as struct cmsghdr
Fixes following ASAN runtime error:
"""
src/stream.c:398:47: runtime error: member access within misaligned address 0x516000012b81 for type 'struct cmsghdr', which requires 8 byte alignment
0x516000012b81: note: pointer points here
51 00 00 00 30 00 00 00 00 00 00 00 84 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 03
^
"""
Current GCC documentation [1] states that __attribute__ ((__aligned__
(alignment))) is the older sytnax. The newer _Alignas mimics the
standarized alignas() in C23. Since we build with CLAGS=-std=gnu11 we
are fine using _Alignas, which was introduced in C11.
[1] https://www.gnu.org/software/c-intro-and-ref/manual/html_node/Type-Alignmen…
Related: OS#6905
Change-Id: Ia80dfc4dbffe85514b18dcf8d36b85bfafd76d64
---
M src/core/osmo_io_internal.h
1 file changed, 5 insertions(+), 2 deletions(-)
Approvals:
Jenkins Builder: Verified
osmith: Looks good to me, but someone else must approve
jolly: Looks good to me, but someone else must approve
laforge: Looks good to me, approved
diff --git a/src/core/osmo_io_internal.h b/src/core/osmo_io_internal.h
index c15262b..4f35fee 100644
--- a/src/core/osmo_io_internal.h
+++ b/src/core/osmo_io_internal.h
@@ -170,8 +170,11 @@
/*! msghdr is in the cancel_queue list */
bool in_cancel_queue;
- /*! control message buffer for passing sctp_sndrcvinfo along */
- char cmsg[0]; /* size is determined by iofd->cmsg_size on recvmsg, and by mcghdr->msg_controllen on sendmsg */
+ /*! control message buffer for passing sctp_sndrcvinfo along.
+ * Size is determined by iofd->cmsg_size on recvmsg, and by mcghdr->msg_controllen on sendmsg.
+ * Alignment of the array is required due to cast to "struct cmsghdr", eg. by CMSG_FIRSTHDR().
+ */
+ char _Alignas(struct cmsghdr) cmsg[0];
};
enum iofd_seg_act {
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/41950?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Ia80dfc4dbffe85514b18dcf8d36b85bfafd76d64
Gerrit-Change-Number: 41950
Gerrit-PatchSet: 3
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Hoernchen <ewild(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel <dwillmann(a)sysmocom.de>
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: jolly <andreas(a)eversberg.eu>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Attention is currently required from: Hoernchen, daniel, fixeria, pespin.
laforge has posted comments on this change by pespin. ( https://gerrit.osmocom.org/c/libosmocore/+/41950?usp=email )
Change subject: osmo_io: Fix misalignment of iofd->cmsg used as struct cmsghdr
......................................................................
Patch Set 3:
(1 comment)
Patchset:
PS1:
> CSMG_ALIGN returns the whole size including the required alignment, which is not what we want here. […]
Done
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/41950?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: Ia80dfc4dbffe85514b18dcf8d36b85bfafd76d64
Gerrit-Change-Number: 41950
Gerrit-PatchSet: 3
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Hoernchen <ewild(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel <dwillmann(a)sysmocom.de>
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: jolly <andreas(a)eversberg.eu>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Attention: Hoernchen <ewild(a)sysmocom.de>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Attention: daniel <dwillmann(a)sysmocom.de>
Gerrit-Comment-Date: Wed, 28 Jan 2026 11:14:43 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: laforge <laforge(a)osmocom.org>
Comment-In-Reply-To: pespin <pespin(a)sysmocom.de>
osmith has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ci/+/41960?usp=email )
Change subject: ttcn3-gbproxy-test-fr: don't use old libosmocore
......................................................................
ttcn3-gbproxy-test-fr: don't use old libosmocore
Fix that we are currently building osmo-gbproxy against an old
libosmocore in ttcn3-gbproxy-test-fr. This is currently causing the job
to fail with:
/usr/bin/ld: gb_proxy_vty.o: in function `log_set_bvc_filter':
/tmp/osmo-gbproxy/src/gb_proxy_vty.c:477: undefined reference to `log_set_filter'
/usr/bin/ld: /tmp/osmo-gbproxy/src/gb_proxy_vty.c:478: undefined reference to `log_set_filter_data'
collect2: error: ld returned 1 exit status
Related: libosmocore Ie48e7e635feb91509b9c034394df4fb16cb931a3
Change-Id: I15fcb4fd1f145bd913456ac08356e9fa65e34269
---
M jobs/ttcn3-testsuites.yml
1 file changed, 20 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-ci refs/changes/60/41960/1
diff --git a/jobs/ttcn3-testsuites.yml b/jobs/ttcn3-testsuites.yml
index 3202212..b7e0e51 100644
--- a/jobs/ttcn3-testsuites.yml
+++ b/jobs/ttcn3-testsuites.yml
@@ -145,6 +145,26 @@
cd "$DIR"
+ # For ttcn3-gbproxy-test-fr, build debian-buster-build first, so we
+ # don't build osmo-gbproxy against an old libosmocore:
+ # * ttcn3-gbproxy-test-fr must run with debian 10 (OS#6494#note-19).
+ # * osmo-gbproxy-master uses debian-buster-build.
+ # * osmo-gbproxy-master installs libosmocore (and other dependencies)
+ # from the osmocom:nightly binary repository, but builds
+ # osmo-gbproxy from git.
+ # * The Dockerfile of debian-buster-build invalidates the cache at
+ # the end if the osmocom:nightly binary repository has changed.
+ # * osmo-gbproxy-master relies on this, if the cache is not
+ # invalidated then it will install libosmocore etc. once and keep
+ # using the same versions via a cached build step.
+ # * We don't build debian-buster-build automatically anymore (because
+ # Debian 10 is EOL and this container is unused otherwise; this is
+ # done for e.g. debian-trixie-build as of writing via the
+ # "update-osmo-ci-on-slaves" job).
+ if [ "$IMAGE_SUFFIX" = "master-debian10" ]; then
+ make -C debian-buster-build
+ fi
+
uptime | grep --color=always -o "load.*"
RC=0
--
To view, visit https://gerrit.osmocom.org/c/osmo-ci/+/41960?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: osmo-ci
Gerrit-Branch: master
Gerrit-Change-Id: I15fcb4fd1f145bd913456ac08356e9fa65e34269
Gerrit-Change-Number: 41960
Gerrit-PatchSet: 1
Gerrit-Owner: osmith <osmith(a)sysmocom.de>
Attention is currently required from: Timur Davydov.
laforge has posted comments on this change by Timur Davydov. ( https://gerrit.osmocom.org/c/libosmocore/+/41941?usp=email )
Change subject: core: guard Linux netlink headers by libmnl usage
......................................................................
Patch Set 3: Code-Review+2
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/41941?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: I0b681deb1f1e025e3ea9996f19b1de06a5feb408
Gerrit-Change-Number: 41941
Gerrit-PatchSet: 3
Gerrit-Owner: Timur Davydov <dtv.comp(a)gmail.com>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Attention: Timur Davydov <dtv.comp(a)gmail.com>
Gerrit-Comment-Date: Wed, 28 Jan 2026 10:07:46 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Attention is currently required from: fixeria, pespin.
laforge has posted comments on this change by pespin. ( https://gerrit.osmocom.org/c/libosmocore/+/41891?usp=email )
Change subject: logging: Make struct log_context and struct log_target private
......................................................................
Patch Set 10:
(1 comment)
Patchset:
PS1:
> @laforge@gnumonks.org Yes, I think I already listed them in a comment here. […]
"Existing users" to me means "all the preeviously released versions of the applications which must continue to work with libosmocore after this patch has been merged.
"existing users" is not code that has just been hot-patched a few days ago to avoid the issue introduced here.
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/41891?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: Iecbd07995ccb465a44be0debcc97458b2b240a0e
Gerrit-Change-Number: 41891
Gerrit-PatchSet: 10
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-CC: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-CC: osmith <osmith(a)sysmocom.de>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Comment-Date: Wed, 28 Jan 2026 10:06:34 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: laforge <laforge(a)osmocom.org>
Comment-In-Reply-To: pespin <pespin(a)sysmocom.de>
Comment-In-Reply-To: fixeria <vyanitskiy(a)sysmocom.de>
Attention is currently required from: canghaiwuhen, fixeria.
laforge has posted comments on this change by canghaiwuhen. ( https://gerrit.osmocom.org/c/osmo-sgsn/+/41948?usp=email )
Change subject: Modified to dynamically adjust the returned QoS length to ensure compatibility with older modules.
......................................................................
Patch Set 8: Code-Review+1
--
To view, visit https://gerrit.osmocom.org/c/osmo-sgsn/+/41948?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: osmo-sgsn
Gerrit-Branch: master
Gerrit-Change-Id: I872d882de4ce186f644b1b3ab684963050709d4f
Gerrit-Change-Number: 41948
Gerrit-PatchSet: 8
Gerrit-Owner: canghaiwuhen <canghaiwuhen(a)gmail.com>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Attention: canghaiwuhen <canghaiwuhen(a)gmail.com>
Gerrit-Comment-Date: Wed, 28 Jan 2026 10:04:54 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
laforge has submitted this change. ( https://gerrit.osmocom.org/c/pysim/+/38015?usp=email )
Change subject: pySim.esim.saip: Don't try to generate file contents for MF/DF/ADF
......................................................................
pySim.esim.saip: Don't try to generate file contents for MF/DF/ADF
only EFs have data content
Change-Id: I02a54a3b2f73a0e9118db87f8b514d1dbf53971f
---
M pySim/esim/saip/__init__.py
1 file changed, 2 insertions(+), 0 deletions(-)
Approvals:
Jenkins Builder: Verified
dexter: Looks good to me, approved
diff --git a/pySim/esim/saip/__init__.py b/pySim/esim/saip/__init__.py
index 51b9d1f..6962ee8 100644
--- a/pySim/esim/saip/__init__.py
+++ b/pySim/esim/saip/__init__.py
@@ -441,6 +441,8 @@
into the asn.1 encoder. If optimize is True, it will try to encode only the differences from the
fillFileContent of the profile template. Otherwise, the entire file contents will be encoded
as-is."""
+ if not self.file_type in ['TR', 'LF', 'CY', 'BT']:
+ return []
if not optimize:
# simplistic approach: encode the full file, ignoring the template/default
return [('fillFileContent', self.body)]
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/38015?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I02a54a3b2f73a0e9118db87f8b514d1dbf53971f
Gerrit-Change-Number: 38015
Gerrit-PatchSet: 6
Gerrit-Owner: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter <pmaier(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: neels <nhofmeyr(a)sysmocom.de>
laforge has submitted this change. ( https://gerrit.osmocom.org/c/pysim/+/38014?usp=email )
Change subject: pySim.esim.saip: Implement optimized file content encoding
......................................................................
pySim.esim.saip: Implement optimized file content encoding
Make sure we make use of the fill pattern when encoding file contents:
Only encode the differences to the fill pattern of the file, in order
to reduce the profile download size.
Change-Id: I61e4a5e04beba5c9092979fc546292d5ef3d7aad
---
M pySim/esim/saip/__init__.py
M tests/unittests/test_esim_saip.py
2 files changed, 86 insertions(+), 6 deletions(-)
Approvals:
dexter: Looks good to me, but someone else must approve
laforge: Looks good to me, approved
Jenkins Builder: Verified
diff --git a/pySim/esim/saip/__init__.py b/pySim/esim/saip/__init__.py
index 6b6c01c..51b9d1f 100644
--- a/pySim/esim/saip/__init__.py
+++ b/pySim/esim/saip/__init__.py
@@ -21,6 +21,8 @@
import os
from typing import Tuple, List, Optional, Dict, Union
from collections import OrderedDict
+from difflib import SequenceMatcher, Match
+
import asn1tools
import zipfile
from pySim import javacard
@@ -44,6 +46,29 @@
logger = logging.getLogger(__name__)
+class NonMatch(Match):
+ """Representing a contiguous non-matching block of data; the opposite of difflib.Match"""
+ @classmethod
+ def from_matchlist(cls, l: List[Match], size:int) -> List['NonMatch']:
+ """Build a list of non-matching blocks of data from its inverse (list of matching blocks).
+ The caller must ensure that the input list is ordered, non-overlapping and only contains
+ matches at equal offsets in a and b."""
+ res = []
+ cur = 0
+ for match in l:
+ if match.a != match.b:
+ raise ValueError('only works for equal-offset matches')
+ assert match.a >= cur
+ nm_len = match.a - cur
+ if nm_len > 0:
+ # there's no point in generating zero-lenth non-matching sections
+ res.append(cls(a=cur, b=cur, size=nm_len))
+ cur = match.a + match.size
+ if size > cur:
+ res.append(cls(a=cur, b=cur, size=size-cur))
+
+ return res
+
class Naa:
"""A class defining a Network Access Application (NAA)"""
name = None
@@ -411,12 +436,38 @@
return ValueError("Unknown key '%s' in tuple list" % k)
return stream.getvalue()
- def file_content_to_tuples(self) -> List[Tuple]:
- # FIXME: simplistic approach. needs optimization. We should first check if the content
- # matches the expanded default value from the template. If it does, return empty list.
- # Next, we should compute the diff between the default value and self.body, and encode
- # that as a sequence of fillFileOffset and fillFileContent tuples.
- return [('fillFileContent', self.body)]
+ def file_content_to_tuples(self, optimize:bool = False) -> List[Tuple]:
+ """Encode the file contents into a list of fillFileContent / fillFileOffset tuples that can be fed
+ into the asn.1 encoder. If optimize is True, it will try to encode only the differences from the
+ fillFileContent of the profile template. Otherwise, the entire file contents will be encoded
+ as-is."""
+ if not optimize:
+ # simplistic approach: encode the full file, ignoring the template/default
+ return [('fillFileContent', self.body)]
+ # Try to 'compress' the file body, based on the default file contents.
+ if self.template:
+ default = self.template.expand_default_value_pattern(length=len(self.body))
+ if not default:
+ sm = SequenceMatcher(a=b'\xff'*len(self.body), b=self.body)
+ else:
+ if default == self.body:
+ # 100% match: return an empty tuple list to make eUICC use the default
+ return []
+ sm = SequenceMatcher(a=default, b=self.body)
+ else:
+ # no template at all: we can only remove padding
+ sm = SequenceMatcher(a=b'\xff'*len(self.body), b=self.body)
+ matching_blocks = sm.get_matching_blocks()
+ # we can only make use of matches that have the same offset in 'a' and 'b'
+ matching_blocks = [x for x in matching_blocks if x.size > 0 and x.a == x.b]
+ non_matching_blocks = NonMatch.from_matchlist(matching_blocks, self.file_size)
+ ret = []
+ cur = 0
+ for block in non_matching_blocks:
+ ret.append(('fillFileOffset', block.a - cur))
+ ret.append(('fillFileContent', self.body[block.a:block.a+block.size]))
+ cur += block.size
+ return ret
def __str__(self) -> str:
return "File(%s)" % self.pe_name
diff --git a/tests/unittests/test_esim_saip.py b/tests/unittests/test_esim_saip.py
index e7e324d..edf6d8d 100755
--- a/tests/unittests/test_esim_saip.py
+++ b/tests/unittests/test_esim_saip.py
@@ -90,5 +90,34 @@
self.assertTrue(oid.OID('1.0.1') > oid.OID('1.0'))
self.assertTrue(oid.OID('1.0.2') > oid.OID('1.0.1'))
+class NonMatchTest(unittest.TestCase):
+ def test_nonmatch(self):
+ # non-matches before, in between and after matches
+ match_list = [Match(a=10, b=10, size=5), Match(a=20, b=20, size=4)]
+ nm_list = NonMatch.from_matchlist(match_list, 26)
+ self.assertEqual(nm_list, [NonMatch(a=0, b=0, size=10), NonMatch(a=15, b=15, size=5),
+ NonMatch(a=24, b=24, size=2)])
+
+ def test_nonmatch_beg(self):
+ # single match at beginning
+ match_list = [Match(a=0, b=0, size=5)]
+ nm_list = NonMatch.from_matchlist(match_list, 20)
+ self.assertEqual(nm_list, [NonMatch(a=5, b=5, size=15)])
+
+ def test_nonmatch_end(self):
+ # single match at end
+ match_list = [Match(a=19, b=19, size=5)]
+ nm_list = NonMatch.from_matchlist(match_list, 24)
+ self.assertEqual(nm_list, [NonMatch(a=0, b=0, size=19)])
+
+ def test_nonmatch_none(self):
+ # no match at all
+ match_list = []
+ nm_list = NonMatch.from_matchlist(match_list, 24)
+ self.assertEqual(nm_list, [NonMatch(a=0, b=0, size=24)])
+
+
+
+
if __name__ == "__main__":
unittest.main()
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/38014?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I61e4a5e04beba5c9092979fc546292d5ef3d7aad
Gerrit-Change-Number: 38014
Gerrit-PatchSet: 7
Gerrit-Owner: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter <pmaier(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: neels <nhofmeyr(a)sysmocom.de>