From a97089d2438ffc1ce6be3fead6192d983835227d Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Sun, 6 Sep 2026 20:46:40 -0400 Subject: [PATCH 1/9] Coverity: fix scan result archive path and upload handling Use an absolute path for the Coverity analysis archive so its location is independent of the current working directory. This prevents the archive from being created in the build directory and then failing subsequent validation and upload steps. These path issues were not encountered during local testing because the script's working directory happened to match the expected archive location. They only surfaced on the GitHub Actions runner, where the script changes into the build directory before creating the archive. Also validate directory changes and use the configured Coverity notification email and properly quoted archive path for uploads. Signed-off-by: Robin Getz --- .github/workflows/coverity.sh | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/.github/workflows/coverity.sh b/.github/workflows/coverity.sh index d51cc6708..85aaf7cf4 100755 --- a/.github/workflows/coverity.sh +++ b/.github/workflows/coverity.sh @@ -166,9 +166,13 @@ printf "\033[33;1mCoverity Build Capture version: %s\033[0m\n" "$COVERITY_TOOL_V # Configure RESULTS_DIR="$REPO_ROOT/cov-int" BUILD_DIR="$REPO_ROOT/build-coverity" -RESULTS_ARCHIVE=analysis-results.tgz -cd "$REPO_ROOT" -if [ ! -f "${REPO_ROOT}/${RESULTS_ARCHIVE}" ] ; then +RESULTS_ARCHIVE="$REPO_ROOT/analysis-results.tgz" +cd "$REPO_ROOT" || { + echo "ERROR: Unable to change to repository root: $REPO_ROOT" >&2 + exit 1 +} + +if [ ! -f "$RESULTS_ARCHIVE" ] ; then rm -rf "$RESULTS_DIR" rm -rf "$BUILD_DIR" @@ -179,7 +183,7 @@ if [ ! -f "${REPO_ROOT}/${RESULTS_ARCHIVE}" ] ; then # Build printf "\033[33;1mRunning Coverity Scan Analysis Tool...\033[0m\n" - cd "$BUILD_DIR" + cov-build --dir "$RESULTS_DIR" ninja -C "$BUILD_DIR" -j "$JOBS" if grep -q "No files were emitted." "$RESULTS_DIR/build-log.txt"; then echo "ERROR: Coverity did not emit any files." >&2 @@ -193,8 +197,8 @@ if [ ! -f "${REPO_ROOT}/${RESULTS_ARCHIVE}" ] ; then tar czf "$RESULTS_ARCHIVE" -C "$REPO_ROOT" cov-int fi -if ! tar tf "${REPO_ROOT}/${RESULTS_ARCHIVE}" | grep '^cov-int/build-log.txt$' >/dev/null; then - echo "ERROR: Coverity archive ${REPO_ROOT}/${RESULTS_ARCHIVE} does not contain cov-int/build-log.txt" >&2 +if ! tar tf "$RESULTS_ARCHIVE" | grep '^cov-int/build-log.txt$' >/dev/null; then + echo "ERROR: Coverity archive $RESULTS_ARCHIVE does not contain cov-int/build-log.txt" >&2 exit 1 fi @@ -258,8 +262,8 @@ else --silent --write-out "\n%{http_code}\n" \ --form project="$COVERITY_SCAN_PROJECT_NAME" \ --form token="$COVERITY_SCAN_TOKEN" \ - --form email=blackhole@blackhole.io \ - --form file=@$RESULTS_ARCHIVE \ + --form "email=$COVERITY_SCAN_NOTIFICATION_EMAIL" \ + --form "file=@$RESULTS_ARCHIVE" \ --form version="$VERSION_SHA" \ --form description="Automated Build: $VERSION_SHA" \ $UPLOAD_URL) From 1b20e538d32bfe64c0868ac6901a3d5c1ab93f10 Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Sun, 6 Sep 2026 23:53:53 -0400 Subject: [PATCH 2/9] plutoSDR: Make thread running state atomic m_running is used to synchronize the PlutoSDR manager and runner threads. The manager-side startWork() and stopWork() functions control whether the runner in run() should execute. startWork() reads m_running before starting the QThread and then waits for run() to set it true. stopWork() sets m_running false to request that the runner exit, while run() continuously reads the flag and sets it false when it terminates. These accesses occur across the manager and runner threads without atomic synchronization. Make m_running an atomic_bool in the PlutoSDR input, output, MIMO input, and MIMO output threads to eliminate the data race identified by ThreadSanitizer. This can prevent inconsistent thread state during user-driven device start, stop, and reload operations, where the GUI can cause the manager thread to start or stop a PlutoSDR runner while that runner is processing. Signed-off-by: Robin Getz --- plugins/samplemimo/plutosdrmimo/plutosdrmithread.h | 3 ++- plugins/samplemimo/plutosdrmimo/plutosdrmothread.h | 3 ++- plugins/samplesink/plutosdroutput/plutosdroutputthread.h | 3 ++- plugins/samplesource/plutosdrinput/plutosdrinputthread.h | 3 ++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/plugins/samplemimo/plutosdrmimo/plutosdrmithread.h b/plugins/samplemimo/plutosdrmimo/plutosdrmithread.h index 32bc8b8ae..38517cfb5 100644 --- a/plugins/samplemimo/plutosdrmimo/plutosdrmithread.h +++ b/plugins/samplemimo/plutosdrmimo/plutosdrmithread.h @@ -21,6 +21,7 @@ #ifndef _PLUTOSDR_PLUTOSDRMITHREAD_H_ #define _PLUTOSDR_PLUTOSDRMITHREAD_H_ +#include #include #include #include @@ -53,7 +54,7 @@ signals: private: QMutex m_startWaitMutex; QWaitCondition m_startWaiter; - bool m_running; + std::atomic_bool m_running; DevicePlutoSDRBox *m_plutoBox; qint16 *m_buf[2]; //!< one buffer per I/Q channel diff --git a/plugins/samplemimo/plutosdrmimo/plutosdrmothread.h b/plugins/samplemimo/plutosdrmimo/plutosdrmothread.h index d557d019f..6e5396bf7 100644 --- a/plugins/samplemimo/plutosdrmimo/plutosdrmothread.h +++ b/plugins/samplemimo/plutosdrmimo/plutosdrmothread.h @@ -21,6 +21,7 @@ #ifndef _PLUTOSDR_PLUTOSDRMOTHREAD_H_ #define _PLUTOSDR_PLUTOSDRMOTHREAD_H_ +#include #include #include #include @@ -52,7 +53,7 @@ signals: private: QMutex m_startWaitMutex; QWaitCondition m_startWaiter; - bool m_running; + std::atomic_bool m_running; DevicePlutoSDRBox *m_plutoBox; qint16 *m_buf[2]; //!< one buffer per I/Q channel diff --git a/plugins/samplesink/plutosdroutput/plutosdroutputthread.h b/plugins/samplesink/plutosdroutput/plutosdroutputthread.h index a1403fbcc..7cc8ed118 100644 --- a/plugins/samplesink/plutosdroutput/plutosdroutputthread.h +++ b/plugins/samplesink/plutosdroutput/plutosdroutputthread.h @@ -21,6 +21,7 @@ #ifndef PLUGINS_SAMPLESOURCE_PLUTOSDROUTPUT_PLUTOSDROUTPUTTHREAD_H_ #define PLUGINS_SAMPLESOURCE_PLUTOSDROUTPUT_PLUTOSDROUTPUTTHREAD_H_ +#include #include #include #include @@ -51,7 +52,7 @@ signals: private: QMutex m_startWaitMutex; QWaitCondition m_startWaiter; - bool m_running; + std::atomic_bool m_running; DevicePlutoSDRBox *m_plutoBox; int16_t *m_buf; //!< holds I+Q values of each sample from device diff --git a/plugins/samplesource/plutosdrinput/plutosdrinputthread.h b/plugins/samplesource/plutosdrinput/plutosdrinputthread.h index 57ea016dd..8aa78a8df 100644 --- a/plugins/samplesource/plutosdrinput/plutosdrinputthread.h +++ b/plugins/samplesource/plutosdrinput/plutosdrinputthread.h @@ -21,6 +21,7 @@ #ifndef PLUGINS_SAMPLESOURCE_PLUTOSDRINPUT_PLUTOSDRINPUTTHREAD_H_ #define PLUGINS_SAMPLESOURCE_PLUTOSDRINPUT_PLUTOSDRINPUTTHREAD_H_ +#include #include #include #include @@ -53,7 +54,7 @@ signals: private: QMutex m_startWaitMutex; QWaitCondition m_startWaiter; - bool m_running; + std::atomic_bool m_running; DevicePlutoSDRBox *m_plutoBox; int16_t *m_buf; //!< holds I+Q values of each sample from device From 324a3271a4ed44c9d3960f16107889a8ac2f94de Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Sun, 6 Sep 2026 23:57:34 -0400 Subject: [PATCH 3/9] adsbdemodsink: Protect magnitude statistics with mutex ADSBDemodSink::processOneSample() updates m_magsqSum, m_magsqPeak, and m_magsqCount from the sample processing path, while getMagSqLevels() reads and updates the same statistics when the GUI requests the current magnitude levels. Thus, two different threads can read and write the same variables concurrently. Protect both access paths with a new m_magsqMutex to prevent concurrent updates and reads of the magnitude statistics. This eliminates the data race identified by ThreadSanitizer and prevents the GUI from observing partially updated magnitude statistics while ADS-B samples are being processed. Signed-off-by: Robin Getz --- plugins/channelrx/demodadsb/adsbdemodsink.cpp | 12 ++++++++---- plugins/channelrx/demodadsb/adsbdemodsink.h | 4 ++++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/plugins/channelrx/demodadsb/adsbdemodsink.cpp b/plugins/channelrx/demodadsb/adsbdemodsink.cpp index fa599f1e0..024643769 100644 --- a/plugins/channelrx/demodadsb/adsbdemodsink.cpp +++ b/plugins/channelrx/demodadsb/adsbdemodsink.cpp @@ -121,10 +121,14 @@ void ADSBDemodSink::feed(const SampleVector::const_iterator& begin, const Sample void ADSBDemodSink::processOneSample(Real magsq) { - m_magsqSum += magsq; - if (magsq > m_magsqPeak) - m_magsqPeak = magsq; - m_magsqCount++; + { + QMutexLocker locker(&m_magsqMutex); + + m_magsqSum += magsq; + if (magsq > m_magsqPeak) + m_magsqPeak = magsq; + m_magsqCount++; + } m_sampleBuffer[m_writeBuffer][m_writeIdx] = magsq; m_writeIdx++; if (!m_bufferDateTimeValid[m_writeBuffer]) diff --git a/plugins/channelrx/demodadsb/adsbdemodsink.h b/plugins/channelrx/demodadsb/adsbdemodsink.h index c57e312d5..fc458bf25 100644 --- a/plugins/channelrx/demodadsb/adsbdemodsink.h +++ b/plugins/channelrx/demodadsb/adsbdemodsink.h @@ -35,6 +35,8 @@ public: void getMagSqLevels(double& avg, double& peak, int& nbSamples) { + QMutexLocker locker(&m_magsqMutex); + if (m_magsqCount > 0) { m_magsq = m_magsqSum / m_magsqCount; @@ -107,6 +109,8 @@ private: int m_magsqCount; MagSqLevelsStore m_magSqLevelStore; + QMutex m_magsqMutex; + MessageQueue *m_messageQueueToGUI; MessageQueue *m_messageQueueToWorker; From 121836d69afd5b29962e380817e32b3ba8ecd00b Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Mon, 7 Sep 2026 00:02:27 -0400 Subject: [PATCH 4/9] glspectrumview: Make display change flag atomic ThreadSanitizer identified a race on GLSpectrumView::m_displayChanged between the GUI thread and the spectrum processing thread. The spectrum processing path sets m_displayChanged when display configuration changes, while the GUI update path reads and clears the flag in GLSpectrumView::tick(). These accesses can occur concurrently when the display is being updated, allowing tick() to read or clear m_displayChanged while another thread is setting it. Make m_displayChanged an atomic_bool so the cross-thread notification between the spectrum processing and GUI threads is synchronized. This eliminates the data race identified by ThreadSanitizer and ensures display-change notifications are not subject to unsynchronized reads and writes. Signed-off-by: Robin Getz --- sdrgui/gui/glspectrumview.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sdrgui/gui/glspectrumview.h b/sdrgui/gui/glspectrumview.h index c06107d50..66db9b67f 100644 --- a/sdrgui/gui/glspectrumview.h +++ b/sdrgui/gui/glspectrumview.h @@ -26,6 +26,7 @@ #ifndef INCLUDE_GLSPECTRUMVIEW_H #define INCLUDE_GLSPECTRUMVIEW_H +#include #include #include #include @@ -431,7 +432,7 @@ private: QMatrix4x4 m_glHistogramSpectrumMatrix; QMatrix4x4 m_glHistogramBoxMatrix; bool m_displayHistogram; - bool m_displayChanged; + std::atomic_bool m_displayChanged; bool m_displaySourceOrSink; int m_displayStreamIndex; float m_frequencyZoomFactor; From 5549dd2c5c6b67ed5919c55c9ddc1de6a788a616 Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Mon, 7 Sep 2026 00:12:40 -0400 Subject: [PATCH 5/9] dspdevicesinkengine: Make DSPDeviceSinkEngine m_state atomic DSPDeviceSinkEngine::setState() updates m_state while state() and external users of the engine read the same variable. These accesses can occur from different threads without atomic synchronization. Make m_state an atomic State to eliminate the data race identified by ThreadSanitizer. This prevents callers from observing an unsynchronized DSP device sink engine state while the engine transitions between states. Signed-off-by: Robin Getz --- sdrbase/dsp/dspdevicesinkengine.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sdrbase/dsp/dspdevicesinkengine.h b/sdrbase/dsp/dspdevicesinkengine.h index d8c100bff..fc84d2010 100644 --- a/sdrbase/dsp/dspdevicesinkengine.h +++ b/sdrbase/dsp/dspdevicesinkengine.h @@ -22,6 +22,7 @@ #ifndef SDRBASE_DSP_DSPDEVICESINKENGINE_H_ #define SDRBASE_DSP_DSPDEVICESINKENGINE_H_ +#include #include #include #include @@ -83,7 +84,7 @@ private: MessageQueue m_inputMessageQueue; // m_state; QString m_errorMessage; QString m_deviceDescription; From 63fe8d02ff1ce26936ff73dd8481f21bd8bc5c17 Mon Sep 17 00:00:00 2001 From: AsciiWolf Date: Sun, 6 Sep 2026 23:42:08 +0200 Subject: [PATCH 6/9] flatpak: Update rtl-sdr to 2.0.3 Also use the official osmocom repo. No need to use the fork --- flatpak/org.sdrangel.SDRangel.yaml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/flatpak/org.sdrangel.SDRangel.yaml b/flatpak/org.sdrangel.SDRangel.yaml index b2d93a454..7eddbc8e4 100644 --- a/flatpak/org.sdrangel.SDRangel.yaml +++ b/flatpak/org.sdrangel.SDRangel.yaml @@ -380,9 +380,8 @@ modules: - -Wno-dev sources: - type: git - url: https://github.com/steve-m/librtlsdr.git - # latest master for 2.0.2 versioning fix - commit: ae0dd6d4f09088d13500a854091b45ad281ca4f0 + url: https://github.com/osmocom/rtl-sdr.git + commit: 797f8143266d983c56d8f35d2d442527529dd8a5 - name: plutosdr buildsystem: cmake-ninja From 5721bbdf70246a050ce0981f4356c01469bfc0ff Mon Sep 17 00:00:00 2001 From: AsciiWolf Date: Sun, 6 Sep 2026 23:44:42 +0200 Subject: [PATCH 7/9] snap: Update rtl-sdr to 2.0.3 --- snap/snapcraft.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index d18ec45b1..0cb33f235 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -524,7 +524,7 @@ parts: plugin: cmake source: https://github.com/osmocom/rtl-sdr.git source-type: git - source-commit: 420086af84d7eaaf98ff948cd11fea2cae71734a + source-commit: 797f8143266d983c56d8f35d2d442527529dd8a5 build-packages: - libusb-1.0-0-dev cmake-parameters: From f49fb9cf8123e419efbc3ccfd6d9ac5f5c2798ac Mon Sep 17 00:00:00 2001 From: AsciiWolf Date: Mon, 7 Sep 2026 12:52:48 +0200 Subject: [PATCH 8/9] external: Update rtl-sdr to 2.0.3 --- external/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt index eaa3aa2d5..6506ace2e 100644 --- a/external/CMakeLists.txt +++ b/external/CMakeLists.txt @@ -27,7 +27,7 @@ set(MIRISDR_TAG "v2.0.0") set(LIBSIGMF_TAG "new-namespaces") set(PTHREADS4W_TAG "Version-2-11-0-release") -set(RTLSDR_TAG "v2.0.1") +set(RTLSDR_TAG "v2.0.3") set(RTLSDR_UDEV OFF) set(SOAPYSDR_TAG "1667b4e6301d7ad47b340dcdcd6e9969bf57d843") set(SOAPYSDR_SDRPLAY_TAG "soapy-sdrplay-0.2.0") From d2514292ddcfc266401ac4aa00d4c113ea0368ad Mon Sep 17 00:00:00 2001 From: Jon Beniston Date: Mon, 7 Sep 2026 13:23:45 +0100 Subject: [PATCH 9/9] USRP: Support devices without GPIO, such as n210. --- plugins/samplesink/usrpoutput/usrpoutput.cpp | 26 ++++++++++++++++---- plugins/samplesource/usrpinput/usrpinput.cpp | 26 ++++++++++++++++---- 2 files changed, 42 insertions(+), 10 deletions(-) diff --git a/plugins/samplesink/usrpoutput/usrpoutput.cpp b/plugins/samplesink/usrpoutput/usrpoutput.cpp index 96f5cc2a7..b5ba7eb02 100644 --- a/plugins/samplesink/usrpoutput/usrpoutput.cpp +++ b/plugins/samplesink/usrpoutput/usrpoutput.cpp @@ -816,13 +816,22 @@ bool USRPOutput::applySettings(const USRPOutputSettings& settings, const QListgetDevice()) { - m_deviceShared.m_deviceParams->getDevice()->set_gpio_attr("FP0", "CTRL", ~settings.m_gpioDir, 0xff); // 0 for GPIO, 1 for ATR - m_deviceShared.m_deviceParams->getDevice()->set_gpio_attr("FP0", "DDR", settings.m_gpioDir, 0xff); // 0 for input, 1 for output - qDebug() << "USRPOutput::applySettings: set GPIO dir to " << settings.m_gpioDir; + std::vector banks = m_deviceShared.m_deviceParams->getDevice()->get_gpio_banks(0); + for (const auto& bank : banks) + { + if (!gpioBank.compare(bank)) + { + m_deviceShared.m_deviceParams->getDevice()->set_gpio_attr(gpioBank, "CTRL", ~settings.m_gpioDir, 0xff); // 0 for GPIO, 1 for ATR + m_deviceShared.m_deviceParams->getDevice()->set_gpio_attr(gpioBank, "DDR", settings.m_gpioDir, 0xff); // 0 for input, 1 for output + qDebug() << "USRPOutput::applySettings: set GPIO dir to" << settings.m_gpioDir; + } + } } } @@ -830,8 +839,15 @@ bool USRPOutput::applySettings(const USRPOutputSettings& settings, const QListgetDevice()) { - m_deviceShared.m_deviceParams->getDevice()->set_gpio_attr("FP0", "OUT", settings.m_gpioPins, 0xff); - qDebug() << "USRPOutput::applySettings: set GPIO pins to " << settings.m_gpioPins; + std::vector banks = m_deviceShared.m_deviceParams->getDevice()->get_gpio_banks(0); + for (const auto& bank : banks) + { + if (!gpioBank.compare(bank)) + { + m_deviceShared.m_deviceParams->getDevice()->set_gpio_attr(gpioBank, "OUT", settings.m_gpioPins, 0xff); + qDebug() << "USRPOutput::applySettings: set GPIO pins to" << settings.m_gpioPins; + } + } } } diff --git a/plugins/samplesource/usrpinput/usrpinput.cpp b/plugins/samplesource/usrpinput/usrpinput.cpp index d4e89f042..27b682758 100644 --- a/plugins/samplesource/usrpinput/usrpinput.cpp +++ b/plugins/samplesource/usrpinput/usrpinput.cpp @@ -898,13 +898,22 @@ bool USRPInput::applySettings(const USRPInputSettings& settings, const QListgetDevice()) { - m_deviceShared.m_deviceParams->getDevice()->set_gpio_attr("FP0", "CTRL", ~settings.m_gpioDir, 0xff); // 0 for GPIO, 1 for ATR - m_deviceShared.m_deviceParams->getDevice()->set_gpio_attr("FP0", "DDR", settings.m_gpioDir, 0xff); // 0 for input, 1 for output - qDebug() << "USRPInput::applySettings: set GPIO dir to " << settings.m_gpioDir; + std::vector banks = m_deviceShared.m_deviceParams->getDevice()->get_gpio_banks(0); + for (const auto& bank : banks) + { + if (!gpioBank.compare(bank)) + { + m_deviceShared.m_deviceParams->getDevice()->set_gpio_attr(gpioBank, "CTRL", ~settings.m_gpioDir, 0xff); // 0 for GPIO, 1 for ATR + m_deviceShared.m_deviceParams->getDevice()->set_gpio_attr(gpioBank, "DDR", settings.m_gpioDir, 0xff); // 0 for input, 1 for output + qDebug() << "USRPInput::applySettings: set GPIO dir to" << settings.m_gpioDir; + } + } } } @@ -912,8 +921,15 @@ bool USRPInput::applySettings(const USRPInputSettings& settings, const QListgetDevice()) { - m_deviceShared.m_deviceParams->getDevice()->set_gpio_attr("FP0", "OUT", settings.m_gpioPins, 0xff); - qDebug() << "USRPInput::applySettings: set GPIO pins to " << settings.m_gpioPins; + std::vector banks = m_deviceShared.m_deviceParams->getDevice()->get_gpio_banks(0); + for (const auto& bank : banks) + { + if (!gpioBank.compare(bank)) + { + m_deviceShared.m_deviceParams->getDevice()->set_gpio_attr(gpioBank, "OUT", settings.m_gpioPins, 0xff); + qDebug() << "USRPInput::applySettings: set GPIO pins to" << settings.m_gpioPins; + } + } } }