Re: [PATCH v7] usbip: make remote list honor parsable output

From: jasoncola1

Date: Thu Oct 01 2026 - 12:22:52 EST


Hi Shuah and all,

I tested the exact v7 patch with the host and client on two separate
x86_64 QEMU VMs, both running Linux 7.3.0-rc5, built from the official
v7.3-rc5 tag (72d3fcf802c45d00b300f25b848a93c3a2bd7c7e).

The host was 192.0.2.1 and the client 192.0.2.2. A QEMU USB mass-storage
device (46f4:0001, busid 2-1) was bound to usbip-host and exported by
the real usbipd on port 3240. Both client binaries were built from the
same 7.3-rc5 usbip-utils 2.0 sources; only the v7 change differs.

Before, on the client:
$ /opt/usbip-before/usbip list -p -r 192.0.2.1
Exportable USB devices
======================
- 192.0.2.1
2-1: QEMU : QEMU USB mass storage (46f4:0001)
: /sys/devices/pci0000:00/0000:00:03.0/usb2/2-1
: (Defined at Interface level) (00/00/00)
exit=0

After, on the same client against the same host:
$ /opt/usbip-after/usbip list -p -r 192.0.2.1
busid=2-1#usbid=46f4:0001#
exit=0

The output without -p was byte-identical before and after. The v7
client also attached the device at VHCI port 08, enumerated it as
/dev/sda, and read the full 1 MiB disk. Its SHA-256 matched the source:
87b755d14716cb3fd1622fae9c5dc5f7e2b758fb1b4c2575234839ba2f7d6b03
Detach succeeded and left no imported port. Unbinding on the host made
the parsable list exit 0 with zero bytes on stdout; rebinding restored
the record. All commands passed. The attached report records exact
commands, output, exit codes, source identifiers, and test limitations.

These were two VMs on one physical host, with emulated USB hardware,
not two physical machines. No code changes were made to v7; -p still
precedes -r. Codex assisted with test orchestration and this report.

Thanks,
Jason


On Thu, 01 Oct 2026 06:53:52 -0600, Shuah Khan
<skhan@xxxxxxxxxxxxxxxxxxx> wrote:
> On 10/1/26 06:49, Shuah Khan wrote:
> > On 9/26/26 22:00, Jason Colapietro wrote:
> >> Hi Shuah and all,
> >>
> >> The exact v7 patch has now been built and tested with a native Linux
> >> USB/IP stack.
> >>
> >> Test setup: Alpine Linux 3.23.4 on aarch64, kernel 6.18.53-0-lts,
> >> usbip-utils 2.0. A QEMU USB mass-storage device (46f4:0001, busid 2-1)
> >> was bound to usbip-host and exported by usbipd. The client connected
> >> to 127.0.0.1:3240.
> >>
> >> With the unpatched client, "usbip list -p -r 127.0.0.1" still printed
> >> the human-readable "Exportable USB devices" report, reproducing the
> >> bug. With the v7 client, the same command returned:
> >>
> >>      busid=2-1#usbid=46f4:0001#
> >>
> >> "usbip list -r 127.0.0.1" retained its human-readable output,
> >> including the device path and interface details. After unbinding the
> >> device, the parsable command exited successfully with zero bytes on
> >> stdout; rebinding restored the record.
> >>
> >> I also attached busid 2-1 through the v7 client. "usbip port" showed
> >> it imported through vhci_hcd at port 08, and lsusb showed the device
> >> on both the original and virtual host buses. Detach succeeded, leaving
> >> no imported port. The build, list, attach, and detach commands all
> >> exited successfully.
> >>
> >> This was one Linux VM with an emulated USB device and TCP loopback. I
> >> have not tested physical USB hardware or two separate machines. The
> >> existing option-order behavior is unchanged: -p must precede -r.
> >
> > Please test this with two systems hots running on one and client on the
> > other. Send me before and after output that shows the bug and that it is
> > fixed by your change.
>
> Another thing. This needs to be reproduced and tested on the latest kenel,
> Linux 7.3-rc5
>
> thanks,
> -- Shuah
# Linux USB/IP v7: two-system verification — October 1, 2026

**Result: PASS.** The exact submitted v7 patch was tested across two separate Linux 7.3-rc5 systems. The original client reproduced the ignored `-p` flag; the patched client returned the parsable record. All 25 captured command groups exited 0 and all harness assertions passed.

## Environment and provenance

- Two independent x86_64 QEMU 8.2.2 guests, using TCG and a private Ethernet link. Host `192.0.2.1/24`; client `192.0.2.2/24`. USB/IP traffic traversed the guests' TCP stacks; no loopback or mock USB/IP server was used.
- Official Linux tag `v7.3-rc5`, commit `72d3fcf802c45d00b300f25b848a93c3a2bd7c7e`. Kernel sources matched that Git tree with no tracked-file differences. Custom kernel configuration is included.
- Real `usbip-host`, `usbipd`, and `vhci_hcd`; usbip-utils 2.0 built with real libudev, without TCP wrappers. The original and patched client builds share the same source base and configuration. Only `src/usbip_list.c` differs, by the exact September 7 v7 email patch.
- Device: QEMU USB mass-storage `46f4:0001`, busid `2-1`, 1 MiB backing disk. The USB names file contains descriptive labels for this test device; numeric IDs and busid came from real sysfs and the USB/IP protocol.
- The patch applied without conflicts. `checkpatch.pl --strict`: 0 errors, 0 warnings, 0 checks.

## Captured kernel versions

```text
Linux usbip-host 7.3.0-rc5 #5 PREEMPT Thu Oct 1 16:46:50 CEST 2026 x86_64 GNU/Linux
usbip-host
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 1000
link/ether 52:54:00:12:34:01 brd ff:ff:ff:ff:ff:ff
inet 192.0.2.1/24 scope global eth0
valid_lft forever preferred_lft forever
inet6 fe80::5054:ff:fe12:3401/64 scope link tentative
valid_lft forever preferred_lft forever
```

```text
Linux usbip-client 7.3.0-rc5 #5 PREEMPT Thu Oct 1 16:46:50 CEST 2026 x86_64 GNU/Linux
usbip-client
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 1000
link/ether 52:54:00:12:34:02 brd ff:ff:ff:ff:ff:ff
inet 192.0.2.2/24 scope global eth0
valid_lft forever preferred_lft forever
inet6 fe80::5054:ff:fe12:3402/64 scope link tentative
valid_lft forever preferred_lft forever
```

## Requested before-and-after output

```text
$ /opt/usbip-before/usbip list -p -r 192.0.2.1
Exportable USB devices
======================
- 192.0.2.1
2-1: QEMU : QEMU USB mass storage (46f4:0001)
: /sys/devices/pci0000:00/0000:00:03.0/usb2/2-1
: (Defined at Interface level) (00/00/00)
exit=0
```

```text
$ /opt/usbip-after/usbip list -p -r 192.0.2.1
busid=2-1#usbid=46f4:0001#
exit=0
```

## Additional verification

| Check | Verified result |
|---|---|
| Original `list -p -r` versus original `list -r` | Byte-identical raw output, confirming the ignored flag |
| Original versus patched `list -r` | Byte-identical raw output |
| Patched parsable format | Exactly one `busid=2-1#usbid=46f4:0001#` record plus newline |
| Attach | Exit 0; imported at VHCI port 08 from `192.0.2.1:3240` |
| Enumeration | Client `/dev/sda` under `vhci_hcd.0`; sysfs IDs `46f4:0001` |
| Data transfer | Full 1 MiB imported disk SHA-256 matched the backing image |
| Detach | Exit 0; no imported port afterward |
| Empty list | Exit 0; stdout exactly zero bytes after host unbind |
| Rebind | Same parsable record returned again |

```text
$ /opt/usbip-after/usbip port
Imported USB devices
====================
Port 08: <Port in Use> at Super Speed(5000Mbps)
QEMU : QEMU USB mass storage (46f4:0001)
2-1 -> usbip://192.0.2.1:3240/2-1
-> remote bus/dev 002/002
exit=0
```

```text
$ sha256sum /dev/sda
87b755d14716cb3fd1622fae9c5dc5f7e2b758fb1b4c2575234839ba2f7d6b03 /dev/sda
exit=0
```

```text
$ sleep 2; /opt/usbip-after/usbip port
Imported USB devices
====================
exit=0
```

```text
$ /opt/usbip-after/usbip list -p -r 192.0.2.1 > /tmp/empty.stdout 2>/tmp/empty.stderr; rc=$?; wc -c /tmp/empty.stdout; cat /tmp/empty.stderr; exit_code=$rc; test "$exit_code" -eq 0
0 /tmp/empty.stdout
usbip: info: no exportable devices found on 192.0.2.1
exit=0
```

```text
$ /opt/usbip-after/usbip list -p -r 192.0.2.1
busid=2-1#usbid=46f4:0001#
exit=0
```

## Scope and limitations

These are two separate VMs on one physical host, with emulated USB hardware. Physical USB hardware, two physical computers, and a WAN were not tested. The kernel is the requested release candidate with a custom configuration. The existing option-order behavior is preserved: `-p` precedes `-r`.

The exported mass-storage device supplied zero interface records in the list reply after binding; this run does not exercise a nonzero-interface list payload. The existing v7 patch continues to receive interface records, but no new claim of such coverage is made here.

No new patch revision or code fix was needed. This report supplies the missing requested verification; maintainer acceptance remains pending. Codex assisted with test orchestration and the report.

## Evidence package

The ZIP includes full serial transcripts, structured results with untrimmed output, per-command logs, kernel configuration and build log, exact v7 patch, original email, client sources and binaries, the tested kernel and initramfs, and the test harness. To rerun with QEMU installed: `python3 run-two-vms.py`. `build-test-kernel.sh` rebuilds the kernel from the pinned source archive and included configuration.

## SHA-256 identities

- `linux-codeload.tar.gz`: `382d6aa48640351df7da6321e156c39155b4a99b0985d4370f7e608729987453`
- `usbip-v7.patch`: `dfb1495fc9d04b83c08e896647e8b5c58fe91198abab006e659d43e86c3987f1`
- `usbip-before/src/usbip_list.c`: `2ed37e969d42a565bc4a317be6fbee2a0244745d9733b036a4622551078ebfec`
- `usbip-after/src/usbip_list.c`: `9472b864b91756bb4753169f54de3c163f61f651f81f189ce28c3932798e9cbe`
- `usbip-before/src/usbip`: `07a18fb8fd994cece07804759e334e0d332eb0984d4050f73aba178fba800915`
- `usbip-after/src/usbip`: `caedbdc35a4581148f512c1de147a8716d1bc5883e71e8e540ef1d7fc2ed092e`
- `linux-7.3-rc5/arch/x86/boot/bzImage`: `08d30afafc0f48e1f88faa512f3445510a36cbfb49ca0cdee755af92696570fc`
- `guest-initramfs.cpio.gz`: `91d9a00b12b296aba305bd9a5e88072e392d81b9a173685afd0d7953b55621f2`
- `usb-test-disk.img`: `87b755d14716cb3fd1622fae9c5dc5f7e2b758fb1b4c2575234839ba2f7d6b03`