rtl apps crash "allocating zero-copy buffers", Pi 4, Ubuntu 20.04

Bug #1876624 reported by Edward Vielmetti
30
This bug affects 5 people
Affects Status Importance Assigned to Milestone
rtl-sdr (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

There is a discussion at https://www.reddit.com/r/RTLSDR/comments/ds73ow/rtl_process_being_killed_newbie_troubleshooting/
for reference.

When installed with the default librtlsdr-dev, the rtl apps crash
on Ubuntu 20.04 LTS with this error sequence. This example is from
rtl-test:

Reading samples in async mode...
Allocating 15 zero-copy buffers
Killed

The relevant patch from upstream is

https://github.com/steve-m/librtlsdr/commit/81833a1cf6288fee93a9157c0f60cafb5ec340b9

lib: disable usbfs zero-copy support by default

Although we added a detection mechanism for the presence of the Kernel
bug earlier, reading from the incorrectly mapped memory might cause a
bus error on some ARM systems.

With the overall performance benefit being rather minimal for the
data rates of rtl-sdr, disable zero-copy by default.

Revision history for this message
Edward Vielmetti (edward-vielmetti) wrote :

To be more precise, this is happening on a Pi 4 running arm64 (64-bit Arm). The upstream patch mentions "some Arm systems".

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in rtl-sdr (Ubuntu):
status: New → Confirmed
Revision history for this message
nyanpasu64 (nyanpasu64) wrote :

Same bug on a Pi 3B running Ubuntu 20.04 arm64.

https://www.reddit.com/r/RTLSDR/comments/ds73ow/rtl_process_being_killed_newbie_troubleshooting/f6ynsaw/ proposes a patch for this bug:

> Reason for this is a bug in librtlsdr. It detects a kernel/hw whithout mmap bug, but crashes in code that uses it. I have made a quickpatch for this.

--- rtl-sdr-0.6.orig/src/librtlsdr.c +++ rtl-sdr-0.6/src/librtlsdr.c
@@ -1748,7 +1748,7 @@ static int _rtlsdr_alloc_async_buffers(r
        dev->xfer_buf = malloc(dev->xfer_buf_num * sizeof(unsigned char *));
        memset(dev->xfer_buf, 0, dev->xfer_buf_num * sizeof(unsigned char *));

-#if defined (__linux__) && LIBUSB_API_VERSION >= 0x01000105
+#if defined (__linux__) && LIBUSB_API_VERSION >= 0x01000105 && 0
        fprintf(stderr, "Allocating %d zero-copy buffers\n", dev->xfer_buf_num);

        dev->use_zerocopy = 1;

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.