Commit Graph

8691 Commits

Author SHA1 Message Date
Aleksander Morgado
bf2843ad77 libmm-glib: separate files for flags and enums types
This allows us to skip needing to include the non-existent
build_string_from_mask() or get_string() counterparts in the
documentation index.
2023-04-27 12:23:04 +00:00
Aleksander Morgado
fdf03f9b2c build-aux,mkenums: use mixed enums+flags template without docs in daemon 2023-04-27 12:23:04 +00:00
Aleksander Morgado
efcfce02a9 build-aux,mkenums: import custom mkenums tool from libqmi/libmbim
We're going to use certain new features included in the custom tool.
2023-04-27 12:23:04 +00:00
Andrew Lassalle
549e2f5118 iface-modem-3gpp: don't compare profile-name on attach APNs
When a request to set a new eps bearer settings is received, ignore the
profile-name when comparing the previous configuration with the new one,
since the modem's profile might already have a name that won't match the
settings provided by the user. Profile names are used in QMI modems.
If the profile name does not match the existing one, the modem will
detach and reattach to the network.
2023-04-19 19:10:12 +00:00
Aleksander Morgado
1a133dca5e helpers-mbim: fix MMSignal selection based on data class
MbimDataClass is a flags bitmask, not an enumeration.

This logic was broken if the reported data class was e.g. 4G+5GNSA.
2023-04-19 11:32:01 +00:00
Aleksander Morgado
552359b57e docs: update copyright 2023-04-14 08:50:38 +00:00
Aleksander Morgado
c0e613ee35 daemon: update copyright 2023-04-14 08:49:29 +00:00
Aleksander Morgado
19b910b60f cli: update copyright 2023-04-14 08:48:35 +00:00
Aleksander Morgado
7e0663f922 udev: new ID_MM_REQUIRED tag
Users with QMI or MBIM capable modems may want to ensure that these
are never managed using plain AT commands, as that also involves using
PPP. This fallback to AT could happen if the QMI or MBIM port probing
fails for whatever reason.

The new `ID_MM_REQUIRED` udev tag allows specifying that a given port
MUST be successfully grabbed when creating a new modem object, or
otherwise the modem object will not be created at all (even if there
are other fallback control ports like AT that could have been used).

Use this tag with caution.

It is assumed that when this tag is used some other external process
may be monitoring the existence of the modem object in DBus as exposed
by ModemManager, and if it does not appear for any reason then the
modem would be reseted with some other mechanism (e.g. GPIOs, if
available). If no such mechanism to autorecover the modem is in place,
using this tag may leave the modem exposed in the kernel but ignored
by ModemManager.

This tag must be applied on the specific port for which the existence
and usability must be ensured.

E.g. flagging the MBIM port of the Fibocom L850 module as required:

   $ vim /lib/udev/rules.d/78-mm-test.rules
   ACTION!="add|change|move|bind", GOTO="mm_test_rules_end"
   SUBSYSTEMS=="usb", ATTRS{bInterfaceNumber}=="?*", ENV{.MM_USBIFNUM}="$attr{bInterfaceNumber}"
   ATTRS{idVendor}=="2cb7", ATTRS{idProduct}=="0007", ENV{.MM_USBIFNUM}=="00", ENV{ID_MM_REQUIRED}="1"
   LABEL="mm_test_rules_end"

   $ sudo udevadm control --reload
   $ sudo udevadm trigger

   $ sudo udevadm info -p /sys/class/usbmisc/cdc-wdm0
   ...
   E: ID_MM_REQUIRED=1
   E: ID_MM_CANDIDATE=1
2023-04-13 11:54:04 +00:00
Aleksander Morgado
79b15cf87c plugin: refactor how list of probe flags is built
To make it clearer that the initial list of flags must be the one
based on which ones are expected in the subsystem and which one the
plugin is requesting.
2023-04-13 11:54:03 +00:00
Aleksander Morgado
cb2dea5dc4 port-probe: perform auto detection of port type hints for wwan
We can remove the port type hint udev tags for the wwan subsystem, as
that logic is now incorporated in the port type hint processing logic
in the daemon itself.

This makes it clearer to know what exact hints are being used, as the
logic is in a single place and it has proper logging of all possible
cases.
2023-04-13 11:53:54 +00:00
Aleksander Morgado
e77df40b68 port-probe: perform auto detection of port type hints for cdc_wdm
Do not do this in the plugin; instead, do it along with the logic that
looks for port type hints in udev, so that we can properly warn if
things don't match.
2023-04-13 11:53:03 +00:00
Aleksander Morgado
131e783a5f port-probe: improve logging of detected port type hints in udev tags
Explicitly log when a tag is found, and also warn if too many por type
hints are provided in the same port.
2023-04-13 11:49:19 +00:00
Aleksander Morgado
585d2af713 port-probe: simplify AT port type hints handling
When processing the hints for port probing we don't care if the AT
port is flagged as primary or secondary.
2023-04-13 11:44:50 +00:00
Marcus Folkesson
5406abc187 sierra: add port hints for HL7812
Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com>
2023-04-13 08:23:09 +00:00
Aleksander Morgado
9c5989f116 port-serial: close_force() may dispose the last object reference 2023-04-12 14:58:59 +02:00
Lubomir Rintel
42048cb2fc build: align GLIB_VERSION_MIN_REQUIRED with glib version we actually require
Now that we've dealt with everything that has been deprecated since
glib-2.44 until glib-2.56 (which we check), we can enable warnings that
guard against using the deprecated constructs.
2023-04-11 13:49:03 +00:00
Lubomir Rintel
0c1ad4eb77 base-modem-at: use better names for pairs of dependent cancellables
We cancel AT commands (or sequences) on cancellation of the modem's
cancellable as well as of the optional user-provided one.

However, the GTask can be associated with only one. That's okay if the
user didn't supply one -- we just use the modem's cancellable only.
Otherwise we chain the cancellables together (also cancel the user one
with the modem one) at cost of some extra complexity.

This aims to make the above a little clearer by using hopefully
better names.

Suggested-by: Aleksander Morgado <aleksandermj@chromium.org>
2023-04-11 13:49:03 +00:00
Lubomir Rintel
da55fa769e base-modem-at: make abort_task_if_port_unusable() unref the GTask
Aleksander seems to prefer it this way. Looks better.

Suggested-by: Aleksander Morgado <aleksandermj@chromium.org>
2023-04-11 13:49:03 +00:00
Lubomir Rintel
f0a77a2292 base-modem: remove mm_base_modem_get_cancellable()
No users left for the getter that takes a reference after a port of
MMBaseModemAT to GTask.

peek_cancellable() is used instead, because the GTask constructor
takes a reference itself.
2023-04-11 13:49:03 +00:00
Lubomir Rintel
476cb2bbc2 base-modem-at: port mm_base_modem_at_{command,sequence}_full() to GTask
Use GTask API in place of the deprecated GSimpleAsyncResult.
2023-04-11 13:49:03 +00:00
Lubomir Rintel
189606a8f3 port-serial-at: port mm_port_serial_at_command() to GTask
Use GTask API in place of the deprecated GSimpleAsyncResult.
2023-04-11 13:49:03 +00:00
Lubomir Rintel
c40876de95 port-serial-at: make mm_port_serial_at_command_finish() transfer ownership
This will make it slightly easier to port mm_port_serial_at_command() to
use GTask, since we won't have to keep a pointer to the result in GTask
after _finish() has been called.

In most cases the caller needs the value anyway, so this doesn't add too
much hasle.
2023-04-11 13:49:03 +00:00
Lubomir Rintel
e1e7bc8de6 port-serial: port mm_port_serial_command() to GTask
Use GTask API in place of the deprecated GSimpleAsyncResult.
2023-04-11 13:49:03 +00:00
Aleksander Morgado
4e879cbede iface-modem: fix incorrectly halted periodic signal checks
Whenever an explicit signal refresh was requested we would flag the
check as ongoing but never reset the flag, so it would never attempt
to reload it again.

Fixes 0080ed612d
Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/702
2023-04-11 10:47:19 +00:00
Aleksander Morgado
c61a7db1b6 helpers-qmi: support new personalization feature status type
The personalization feature enum used in "card status" is different to
the one used in other UIM operations like "depersonalization".

libqmi dependency updated to 1.33.6 to ensure we can use the new types.
2023-04-11 09:44:47 +00:00
Aleksander Morgado
06646001ce ci: don't attempt to build container on branches or pushes 2023-04-10 16:54:30 +00:00
Aleksander Morgado
06618fb3ae ci: add explicit debug build with all features
The release buildtype will disable certain warnings that we do see in
debug builds. Ensure we have a test build with all features enabled in
debug mode.
2023-04-10 15:47:06 +00:00
Aleksander Morgado
2af954a21a ci: always build with -Dwerror=true
Selecting the build type as release limits the amount of warnings that
are enabled, so ensure we always build with warnings treated as errors
so that we don't miss any warning that would happen on debug builds.
2023-04-10 15:30:06 +00:00
Aleksander Morgado
e3c3604838 cinterion: fix missing object in mm_obj_dbg() calls 2023-04-10 15:06:28 +00:00
Aleksander Morgado
a53990e074 cinterion: fix warning with -Wmissing-prototypes
../src/plugins/cinterion/mm-plugin-cinterion.c:65:1: warning: no previous prototype for ‘is_port_already_tagged’ [-Wmissing-prototypes]
     65 | is_port_already_tagged (MMPortProbe *probe)
        | ^~~~~~~~~~~~~~~~~~~~~~
2023-04-10 15:05:24 +00:00
Konrad Zapałowicz
4f4bd48db9 cinterion: use port type hints on modem probe
The Cinterion plugin is using the output of the SQPORT? to guess which
ports can be used for AT commands and data connection.

Yet at the same time the udev adds port type hints to the Cinterion
modem upon its discovery.

This commit changes the initialization in a way that from now on it
skips sending SQPORT? when the port type hints are already assigned. By
doing this we make sure that the udev port type hints are being used
when they are available. In case they are not the initialization relies
on the outout of SQPORT? as it did do far.

See: https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/merge_requests/782
2023-04-10 09:52:26 +00:00
Lubomir Rintel
fdb9c1f067 port-qmi: fix mm_port_qmi_release_client() prototype
GCC 13 got unhappy about using an int in place of an enum:

  ../src/mm-port-qmi.c:241:1: warning: conflicting types for ‘mm_port_qmi_release_client’ due to enum/integer mismatch; have ‘void(MMPortQmi *, QmiService,  MMPortQmiFlag)’ {aka ‘void(struct _MMPortQmi *, QmiService,  MMPortQmiFlag)’} [-Wenum-int-mismatch]
    241 | mm_port_qmi_release_client (MMPortQmi     *self,
        | ^~~~~~~~~~~~~~~~~~~~~~~~~~
  In file included from ../src/mm-port-qmi.c:26:
  ../src/mm-port-qmi.h:113:10: note: previous declaration of ‘mm_port_qmi_release_client’ with type ‘void(MMPortQmi *, QmiService,  guint)’ {aka ‘void(struct _MMPortQmi *, QmiService,  unsigned int)’}
    113 | void     mm_port_qmi_release_client         (MMPortQmi  *self,
        |          ^~~~~~~~~~~~~~~~~~~~~~~~~~
2023-04-10 09:21:46 +00:00
Lubomir Rintel
1da5b81fef test: fix _mm_log() prototypes
GCC 13 is unhappy to cast a MMLogLevel to a guint32:

  [188/539] Compiling C object src/plugins/test-shared-icera.p/icera_tests_test-modem-helpers-icera.c.o
  In file included from ../src/plugins/icera/tests/test-modem-helpers-icera.c:27:
  ../src/mm-log-test.h:25:1: warning: conflicting types for ‘_mm_log’ due to enum/integer mismatch; have ‘void(void *, const gchar *, const gchar *, const gchar *, guint32,  const gchar *, ...)’ {aka ‘void(void *, const char *, const char *, const char *, unsigned int,  const char *, ...)’} [-Wenum-int-mismatch]
     25 | _mm_log (gpointer     obj,
        | ^~~~~~~
  In file included from ../src/mm-log-test.h:20:
  ../src/mm-log.h:61:6: note: previous declaration of ‘_mm_log’ with type ‘void(void *, const gchar *, const gchar *, const gchar *, MMLogLevel,  const gchar *, ...)’ {aka ‘void(void *, const char *, const char *, const char *, MMLogLevel,  const char *, ...)’}
     61 | void _mm_log (gpointer     obj,
        |      ^~~~~~~

That's perfectly fine, just use the enum type directly.
2023-04-10 09:21:46 +00:00
Lubomir Rintel
df4aea5ada mmtty: handle MM_LOG_LEVEL_MSG in _mm_log()
GCC 13 is unhappy about mixing enums and ints. However, if we fix the
type un mmtty's _mm_log() prototype, the compiler will find something
else to be irritiated about:

  [1/2] Compiling C object test/mmtty.p/mmtty.c.o
  ../test/mmtty.c: In function ‘_mm_log’:
  ../test/mmtty.c:283:5: warning: enumeration value ‘MM_LOG_LEVEL_MSG’ not handled in switch [-Wswitch-enum]
    283 |     switch (level) {
        |     ^~~~~~
  [2/2] Linking target test/mmtty

Fix that first.
2023-04-10 09:21:46 +00:00
Aleksander Morgado
11539a2d82 sms-part-cdma: fix invalid reads due to wrong byte counts in read_bits
==174467== Invalid read of size 1
  ==174467==    at 0x10B80C: read_bits (mm-sms-part-cdma.c:255)
  ==174467==    by 0x10B886: read_bits (mm-sms-part-cdma.c:260)
  ==174467==    by 0x10DC2F: read_bearer_data_user_data (mm-sms-part-cdma.c:882)
  ==174467==    by 0x10DC2F: read_bearer_data (mm-sms-part-cdma.c:1000)
  ==174467==    by 0x10DC2F: mm_sms_part_cdma_new_from_binary_pdu (mm-sms-part-cdma.c:1180)
  ==174467==    by 0x10DF24: mm_sms_part_cdma_new_from_pdu (mm-sms-part-cdma.c:331)
  ==174467==    by 0x10A91D: common_test_valid_part_from_hexpdu (test-sms-part-cdma.c:114)
  ==174467==    by 0x10B0AC: common_test_valid_part_from_pdu (test-sms-part-cdma.c:126)
  ==174467==    by 0x10B0AC: test_invalid_ascii_user_data (test-sms-part-cdma.c:412)
  ==174467==    by 0x4A0264D: ??? (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2)
  ==174467==    by 0x4A023B4: ??? (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2)
  ==174467==    by 0x4A023B4: ??? (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2)
  ==174467==    by 0x4A023B4: ??? (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2)
  ==174467==    by 0x4A023B4: ??? (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2)
  ==174467==    by 0x4A02B1A: g_test_run_suite (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2)
  ==174467==  Address 0x51a6457 is 0 bytes after a block of size 7 alloc'd
  ==174467==    at 0x48455EF: calloc (vg_replace_malloc.c:1328)
  ==174467==    by 0x49DF6C0: g_malloc0 (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2)
  ==174467==    by 0x48ABD24: mm_utils_hexstr2bin (mm-common-helpers.c:1884)
  ==174467==    by 0x10DF06: mm_sms_part_cdma_new_from_pdu (mm-sms-part-cdma.c:325)
  ==174467==    by 0x10A91D: common_test_valid_part_from_hexpdu (test-sms-part-cdma.c:114)
  ==174467==    by 0x10B0AC: common_test_valid_part_from_pdu (test-sms-part-cdma.c:126)
  ==174467==    by 0x10B0AC: test_invalid_ascii_user_data (test-sms-part-cdma.c:412)
  ==174467==    by 0x4A0264D: ??? (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2)
  ==174467==    by 0x4A023B4: ??? (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2)
  ==174467==    by 0x4A023B4: ??? (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2)
  ==174467==    by 0x4A023B4: ??? (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2)
  ==174467==    by 0x4A023B4: ??? (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2)
  ==174467==    by 0x4A02B1A: g_test_run_suite (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2)
2023-03-30 22:51:48 +00:00
Aleksander Morgado
1b60330032 sms-part-cdma: fix invalid memory read when parsing empty ascii text
Same fix also applied to latin encoded text as it also makes sense there.

  ==158856== Invalid read of size 1
  ==158856==    at 0x10B814: read_bits (mm-sms-part-cdma.c:257)
  ==158856==    by 0x10DB07: read_bearer_data_user_data (mm-sms-part-cdma.c:878)
  ==158856==    by 0x10DB07: read_bearer_data (mm-sms-part-cdma.c:990)
  ==158856==    by 0x10DB07: mm_sms_part_cdma_new_from_binary_pdu (mm-sms-part-cdma.c:1170)
  ==158856==    by 0x10DE54: mm_sms_part_cdma_new_from_pdu (mm-sms-part-cdma.c:333)
  ==158856==    by 0x10A916: common_test_invalid_part_from_hexpdu (test-sms-part-cdma.c:90)
  ==158856==    by 0x10A916: common_test_invalid_part_from_pdu (test-sms-part-cdma.c:104)
  ==158856==    by 0x4A0264D: ??? (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2)
  ==158856==    by 0x4A023B4: ??? (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2)
  ==158856==    by 0x4A023B4: ??? (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2)
  ==158856==    by 0x4A023B4: ??? (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2)
  ==158856==    by 0x4A023B4: ??? (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2)
  ==158856==    by 0x4A02B1A: g_test_run_suite (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2)
  ==158856==    by 0x4A02BBC: g_test_run (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2)
  ==158856==    by 0x10A509: main (test-sms-part-cdma.c:595)
  ==158856==  Address 0x51a627b is 0 bytes after a block of size 11 alloc'd
  ==158856==    at 0x48455EF: calloc (vg_replace_malloc.c:1328)
  ==158856==    by 0x49DF6C0: g_malloc0 (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2)
  ==158856==    by 0x48ABD24: mm_utils_hexstr2bin (mm-common-helpers.c:1884)
  ==158856==    by 0x10DE36: mm_sms_part_cdma_new_from_pdu (mm-sms-part-cdma.c:327)
  ==158856==    by 0x10A916: common_test_invalid_part_from_hexpdu (test-sms-part-cdma.c:90)
  ==158856==    by 0x10A916: common_test_invalid_part_from_pdu (test-sms-part-cdma.c:104)
  ==158856==    by 0x4A0264D: ??? (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2)
  ==158856==    by 0x4A023B4: ??? (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2)
  ==158856==    by 0x4A023B4: ??? (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2)
  ==158856==    by 0x4A023B4: ??? (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2)
  ==158856==    by 0x4A023B4: ??? (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2)
  ==158856==    by 0x4A02B1A: g_test_run_suite (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2)
  ==158856==    by 0x4A02BBC: g_test_run (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2)
  ==158856==
2023-03-30 22:07:47 +00:00
Aleksander Morgado
6dccfc5abd sms-part-cdma: fix warning when attempting g_convert() with NULL input
GLib-CRITICAL **: 21:21:51.419: g_convert: assertion 'str != NULL' failed

  Program received signal SIGTRAP, Trace/breakpoint trap.
  0x00007ffff7db3e82 in g_logv () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
  (gdb) bt
  #0  0x00007ffff7db3e82 in g_logv () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
  #1  0x00007ffff7db40ef in g_log () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
  #2  0x00007ffff7d8a5da in g_convert () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
  #3  0x00005555555592cf in read_bearer_data_user_data (log_object=0x0, subparameter=<optimized out>, sms_part=0x555555578000)
      at ../src/mm-sms-part-cdma.c:929
  #4  read_bearer_data (log_object=0x0, parameter=<optimized out>, sms_part=0x555555578000) at ../src/mm-sms-part-cdma.c:982
  #5  mm_sms_part_cdma_new_from_binary_pdu
2023-03-30 22:07:45 +00:00
Aleksander Morgado
fae6d20ed0 sms-part-cdma: fix assertion in cause codes parameter id
ERROR:../src/mm-sms-part-cdma.c:678:read_cause_codes: assertion
  failed: (parameter->parameter_id == PARAMETER_ID_BEARER_REPLY_OPTION)
2023-03-30 21:16:58 +00:00
Aleksander Morgado
3d9497ffbe sms-part-3gpp: fix invalid memory ready by checking UDH length byte can be read
[debug] parsing PDU (0)...
  [debug]   no SMSC address given
  [debug]   submit type PDU detected
  [debug]   message reference: 1
  [debug]   address size: 1 digits (1 bytes)
  [debug]   number parsed: 00
  [debug]   validity available, format relative
  [debug]   PID: 0
  [debug]   user data encoding is GSM7
  [debug]   user data length: 0 elements
  [debug]   user data length: 0 bytes

  ==125780== Command: ./build/test/mmsmspdu --pdu=00F101010C0000000000 --verbose
  ==125780==
  ==125780== Invalid read of size 1
  ==125780==    at 0x10B422: mm_sms_part_3gpp_new_from_binary_pdu (mm-sms-part-3gpp.c:698)
  ==125780==    by 0x10BF57: mm_sms_part_3gpp_new_from_pdu (mm-sms-part-3gpp.c:368)
  ==125780==    by 0x10A44D: main (mmsmspdu.c:242)
  ==125780==  Address 0x519988a is 0 bytes after a block of size 10 alloc'd
  ==125780==    at 0x48455EF: calloc (vg_replace_malloc.c:1328)
  ==125780==    by 0x49DF6C0: g_malloc0 (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2)
  ==125780==    by 0x48ABD24: mm_utils_hexstr2bin (mm-common-helpers.c:1884)
  ==125780==    by 0x10BF36: mm_sms_part_3gpp_new_from_pdu (mm-sms-part-3gpp.c:362)
  ==125780==    by 0x10A44D: main (mmsmspdu.c:242)
2023-03-30 21:04:57 +00:00
Aleksander Morgado
dbafff23a4 sms-part-3gpp: avoid underflow in tp_user_data_size_elements
==101461== Command: ./build/test/mmsmspdu --pdu=004100010100014B00002E --verbose
  ==101461==
  [debug] parsing PDU (0)...
  [debug]   no SMSC address given
  [debug]   submit type PDU detected
  [debug]   message reference: 0
  [debug]   address size: 1 digits (1 bytes)
  [debug]   number parsed: 00
  [debug]   PID: 1
  [debug]   user data encoding is GSM7
  [debug]   user data length: 0 elements
  [debug]   user data length: 0 bytes
  [debug] decoding SMS text with 4294967294 elements

Based on a patch from Michal Mazur <mkm@semihalf.com>.
2023-03-30 20:32:37 +00:00
Aleksander Morgado
60ef408cd7 sms-part-3gpp: fix invalid memory read due to wrong size check when reading address
Before the actual number digits there is always a Type of Address byte
that we were not considering during the size check.

  [debug] parsing PDU (0)...
  [debug]   no SMSC address given
  [debug]   deliver type PDU detected
  [debug]   address size: 1 digits (1 bytes)

  ==90832== Command: ./build/test/mmsmspdu --pdu=001C011C --verbose
  ==90832==
  ==90832== Invalid read of size 1
  ==90832==    at 0x10AC90: sms_semi_octets_to_bcd_string (mm-sms-part-3gpp.c:71)
  ==90832==    by 0x10AC90: sms_decode_address (mm-sms-part-3gpp.c:157)
  ==90832==    by 0x10B0C5: mm_sms_part_3gpp_new_from_binary_pdu (mm-sms-part-3gpp.c:512)
  ==90832==    by 0x10BF77: mm_sms_part_3gpp_new_from_pdu (mm-sms-part-3gpp.c:368)
  ==90832==    by 0x10A44D: main (mmsmspdu.c:242)
  ==90832==  Address 0x5199874 is 0 bytes after a block of size 4 alloc'd
  ==90832==    at 0x48455EF: calloc (vg_replace_malloc.c:1328)
  ==90832==    by 0x49DF6C0: g_malloc0 (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2)
  ==90832==    by 0x48ABD24: mm_utils_hexstr2bin (mm-common-helpers.c:1884)
  ==90832==    by 0x10BF56: mm_sms_part_3gpp_new_from_pdu (mm-sms-part-3gpp.c:362)
  ==90832==    by 0x10A44D: main (mmsmspdu.c:242)
2023-03-30 20:32:37 +00:00
Aleksander Morgado
bc2aeeb7bd sms-part-3gpp: fix invalid memory read parsing address
[debug] parsing PDU (0)...
    [debug]   no SMSC address given
    [debug]   status report type PDU detected
    [debug]   message reference: 191
    [debug]   address size: 0 digits (0 bytes)

  ==78906== Command: ./build/test/mmsmspdu --pdu=000ABF00 --verbose
  ==78906==
  ==78906== Invalid read of size 1
  ==78906==    at 0x10AA80: sms_decode_address (mm-sms-part-3gpp.c:132)
  ==78906==    by 0x10AF7C: mm_sms_part_3gpp_new_from_binary_pdu (mm-sms-part-3gpp.c:507)
  ==78906==    by 0x10BE17: mm_sms_part_3gpp_new_from_pdu (mm-sms-part-3gpp.c:368)
  ==78906==    by 0x10A44D: main (mmsmspdu.c:202)
  ==78906==  Address 0x5199874 is 0 bytes after a block of size 4 alloc'd
  ==78906==    at 0x48455EF: calloc (vg_replace_malloc.c:1328)
  ==78906==    by 0x49DF6C0: g_malloc0 (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2)
  ==78906==    by 0x48ABD24: mm_utils_hexstr2bin (mm-common-helpers.c:1884)
  ==78906==    by 0x10BDF6: mm_sms_part_3gpp_new_from_pdu (mm-sms-part-3gpp.c:362)
  ==78906==    by 0x10A44D: main (mmsmspdu.c:202)
2023-03-30 20:32:37 +00:00
Aleksander Morgado
5d64ea7633 test-sms-part-3gpp: prepare common invalid PDU tester operation 2023-03-30 20:25:24 +00:00
Aleksander Morgado
7ec71020e7 test,mmsmspdu: fix verbose logging support 2023-03-30 20:14:44 +00:00
Michal Mazur
5656d01099 bearer-mbim: use mobile equipment error only if set
Always prefer the operation error when the nw_error is not set (has
value MBIM_NW_ERROR_NONE). If the activation state is ACTIVATED or
ACTIVATING then the behavior doesn't change.
2023-03-30 19:58:09 +00:00
Aleksander Morgado
3aefc983b5 sms-part-3gpp|cdma: new fuzzer tests 2023-03-30 13:19:30 +00:00
Aleksander Morgado
ea441d0f89 sierra: add EM7455 port type hints 2023-03-27 13:23:43 +00:00
Aleksander Morgado
024485e321 port-probe: don't assume port is QCDM when QCDM is not required
When QCDM is not required we don't run an explicit QCDM port probing
operation.

In this case, though, we should not assume that the port is QCDM
capable, even if it is also flagged as ignored.

Instead, we'll flag the port as QCDM capable and ignored only if there
was a udev port type hint associated to the port. Otherwise, we'll
report the port as not being QCDM capable, and the port won't even be
reported in the list of ports as its type is unknown.
2023-03-27 13:10:17 +00:00
Aleksander Morgado
7787c34af0 port-probe: minor refactor in QCDM probing 2023-03-27 12:54:46 +00:00