FS#73674 - [openocd] stlink driver segfaults with libusb >= 1.0.24

Attached to Project: Community Packages
Opened by Timothy Lee (timothy.ty.lee) - Tuesday, 08 February 2022, 03:27 GMT
Last edited by Toolybird (Toolybird) - Monday, 08 May 2023, 23:05 GMT
Task Type Bug Report
Category Packages
Status Closed
Assigned To Santiago Torres (sangy)
Filipe Laíns (FFY00)
Architecture All
Severity High
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 4
Private No


On a system with newer libusb (>= 1.0.24), OpenOCD would segfault trying to connect to an ST-LINK/V2 in-circuit debugger.

Additional info:
* openocd package version: 1:0.11.0-1

Output of OpenOCD leading up to the crash:
$ openocd -f interface/stlink.cfg -f target/stm32l0.cfg
Open On-Chip Debugger 0.11.0
Licensed under GNU GPL v2
For bug reports, read
Info : auto-selecting first available session transport "hla_swd". To override use 'transport select <transport>'.
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : clock speed 300 kHz
Segmentation fault (core dumped)

This bug has an upstream ticket:
* https://sourceforge.net/p/openocd/tickets/308/

There is an upstream fix, which has not yet been included in any releases:
* https://review.openocd.org/c/openocd/+/6331

Steps to reproduce:
* Install latest version of openocd from the Community repo
* Connect a STM32L0538-DISCO board to the PC
* Run the command: openocd -f interface/stlink.cfg -f target/stm32l0.cfg
This task depends upon

Closed by  Toolybird (Toolybird)
Monday, 08 May 2023, 23:05 GMT
Reason for closing:  Fixed
Additional comments about closing:  openocd 1:0.12.0-1 in [community-testing]
Comment by Timothy Lee (timothy.ty.lee) - Tuesday, 08 February 2022, 03:30 GMT
Attached is an updated PKGBUILD file with the upstream patch.

The OpenOCD executable built from the updated PKGBUILD no longer crashes when connecting to an ST-LINK/V2 in-circuit debugger.
Comment by Angus Gratton (projectgus) - Tuesday, 01 March 2022, 09:30 GMT
Can confirm both the bug and the attached fix, thanks for preparing that Timothy.
Comment by Marcin Wieczorek (MarcinWieczorek) - Friday, 22 April 2022, 09:30 GMT
Me too. Problem fixed with given patch.
Comment by Toolybird (Toolybird) - Saturday, 22 October 2022, 21:34 GMT
Correcting severity level in line with [1]

[1] https://wiki.archlinux.org/title/Bug_reporting_guidelines#Severity