J-Link drivers cause "buffer overflow detected" error at Ubuntu 20.04

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • J-Link drivers cause "buffer overflow detected" error at Ubuntu 20.04


      Lately I faced critical error after updating J-Link drivers from 6.44d to 6.98a. After update my system cannot run debug with GDB. Process halted after connection to target with "buffer overflow detected" message.

      Target: KIT_XMC47_RELAX with on-board J-Link based on XMC4200
      Platform: Ubuntu 20.04 LTE (VirtualBox)
      Driver: 6.98a (and all previous since 6.94)

      I checked available drivers - all from 6.44d (which I initially used) till 6.92 are fine. Problem started at 6.94. Also checked with Ubuntu 18.04 - it's ok there. Also working at Win10.

      Display Spoiler

      SEGGER J-Link GDB Server V6.98a Command Line Version
      JLinkARM.dll V6.98a (DLL compiled Mar 5 2021 17:04:29)

      Command line: -if swd -port 50000 -swoport 50001 -telnetport 50002 -device XMC4700-2048
      -----GDB Server start settings-----
      GDBInit file: none
      GDB Server Listening port: 50000
      SWO raw output listening port: 50001
      Terminal I/O port: 50002
      Accept remote connection: yes
      Generate logfile: off
      Verify download: off
      Init regs on start: off
      Silent mode: off
      Single run mode: off
      Target connection timeout: 0 ms
      ------J-Link related settings------
      J-Link Host interface: USB
      J-Link script: none
      J-Link settings file: none
      ------Target related settings------
      Target device: XMC4700-2048
      Target interface: SWD
      Target interface speed: 4000kHz
      Target endian: little
      Connecting to J-Link...
      J-Link is connected.
      Firmware: J-Link Lite-XMC4200 Rev.1 compiled Mar 1 2019 11:28:26
      Hardware: V1.00
      S/N: 591052656
      Checking target voltage...
      Target voltage: 3.30 V
      Listening on TCP/IP port 50000
      Connecting to target...
      Connected to target
      *** buffer overflow detected ***: terminated

    • Hi,

      We have seen this before but only in combination with loading an RTOS plugin.
      As you also found out it is not a generic problem but only seems to happen under specific Ubuntu versions (18.x is fine, 20.x throws the error).
      It is a message from outside GDBServer (probably from GLIBC or so) that ends up in the terminal.
      When debugging the issue, there was a system call which triggered the error message but it was not obvious why because the buffer that was passed (to store a path) was way larger than the path that was stored.

      We will have a look into this again and check if we can reproduce.
      Can you provide the VirtualBox image if needed?
      We will try to setup it on our own but in case it is not reproducible, the image would help.

    • Good day and thanks for reply!

      I am sure that you will be able to re-create issue since I also tried with another freshly installed VM with same OS and drivers. Anyway I'm ready to prepare another VM instance (more compact than my usual ones) for you once again by first request.

      Also I tested latest drivers named V6.98b - problem still present. I am attaching screenshots of system error report -maybe they will be useful in tracking issue.

    • Good day, Erik.

      As I promised - below you can find a link to freshly installed, clean, packed and ready VM.

      Software: VirtualBox Version 6.1.18 r142142 (Qt5.6.2)
      User and pass: main/main
      Sample project path: /home/main/Desktop/Sample/
      Toolchain path: /home/main/Downloads/gcc-arm-none-eabi-10-2020-q4-major/
      IDE: Visual Studio Code (if it's possible to call it IDE)

      You won't be able to compile project since I made scripts only for Debug tests. Also - this project prepared and compiled in DAVE 4.4.2 (Infineon's IDE) and moved inside VM for debug (this made on purpose to make setup faster and also because I can't share exact project and used libs due to reasons).
      Anyway - all described in head post problems were recreated and easy to reproduce - right now installed driver version 6.92 and all works like charm but in Downloads folder you can find latest (per now) 6.98c and if you will replace current driver with it - debug became unavailable.

      How to use project:
      1) Open VS Code (from Favorite panel).
      2) Open Sample folder at Desktop in VS Code.
      3) Make sure JLink (in my case that's XMC4700 Relax Kit) attached to VM.
      4) Hit F5 button - Debug process will start and will wait at the start of main function.
      5) Fill free to Run, use Breakpoints, read-out variables etc.
    • New

      Sorry for the delay in response.
      We have not forgotten about this.

      Unfortunately, we do not have any resources available to look into this,
      but we will do so as soon as possible.
      We have some high priority projects with upcoming deadlines we have to get out of the way first.

      We are sorry for any inconvenience caused.

      Best regards
      Please read the forum rules before posting: Forum Rules

      Keep in mind, this is not a support forum. Its main purpose is user to user interaction.
      Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
      Should you be entitled to support you can contact us via our support system: segger.com/ticket/

      Or you can contact us via e-mail.